Completed
Pull Request — develop (#1656)
by
unknown
17:57
created
future/includes/class-gv-renderer-entry.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,16 +58,16 @@
 block discarded – undo
58 58
 		if ( $view->joins ) {
59 59
 			$form_ids = array();
60 60
 			foreach ( $view->joins as $join ) {
61
-				$form_ids[] = $join->join->ID;
62
-				$form_ids[] = $join->join_on->ID;
61
+				$form_ids[ ] = $join->join->ID;
62
+				$form_ids[ ] = $join->join_on->ID;
63 63
 			}
64 64
 			foreach ( $entry->entries as $e ) {
65
-				if ( ! in_array( $e['form_id'], $form_ids ) ) {
65
+				if ( ! in_array( $e[ 'form_id' ], $form_ids ) ) {
66 66
 					gravityview()->log->error( 'The requested entry does not belong to this View. Entry #{entry_id}, #View {view_id}', array( 'entry_id' => $e->ID, 'view_id' => $view->ID ) );
67 67
 					return null;
68 68
 				}
69 69
 			}
70
-		} else if ( $view->form && $view->form->ID != $entry['form_id'] ) {
70
+		} else if ( $view->form && $view->form->ID != $entry[ 'form_id' ] ) {
71 71
 			gravityview()->log->error( 'The requested entry does not belong to this View. Entry #{entry_id}, #View {view_id}', array( 'entry_id' => $entry->ID, 'view_id' => $view->ID ) );
72 72
 			return null;
73 73
 		}
Please login to merge, or discard this patch.
future/includes/class-gv-entry-multi.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			if ( ! $entry instanceof Entry ) {
45 45
 				continue;
46 46
 			}
47
-			$_entry->entries[ $entry['form_id'] ]  = &$entry;
47
+			$_entry->entries[ $entry[ 'form_id' ] ] = &$entry;
48 48
 		}
49 49
 		return $_entry;
50 50
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
 			foreach ( $this->entries as $entry ) {
67 67
 				$entry = $entry->as_entry();
68
-				$_entry['_multi'][ $entry['form_id'] ] = $entry;
68
+				$_entry[ '_multi' ][ $entry[ 'form_id' ] ] = $entry;
69 69
 			}
70 70
 		}
71 71
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	public function get_permalink( \GV\View $view = null, \GV\Request $request = null, $track_directory = true ) {
88 88
 		$slugs = array();
89 89
 		add_filter( 'gravityview/entry/slug', $callback = function( $slug ) use ( &$slugs ) {
90
-			$slugs[] = $slug;
90
+			$slugs[ ] = $slug;
91 91
 			return implode( ',', $slugs );
92 92
 		}, 10, 1 );
93 93
 
Please login to merge, or discard this patch.
includes/widgets/poll/class-gravityview-widget-poll.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	function __construct() {
23 23
 
24 24
 		$this->widget_id = 'poll';
25
-		$this->widget_description = __('Displays the results of Poll Fields that exist in the form.', 'gravityview' );
26
-		$this->widget_subtitle = sprintf( _x('Note: this will display poll results for %sall form entries%s, not only the entries displayed in the View.', 'The string placeholders are for emphasis HTML', 'gravityview' ), '<em>', '</em>' );
25
+		$this->widget_description = __( 'Displays the results of Poll Fields that exist in the form.', 'gravityview' );
26
+		$this->widget_subtitle = sprintf( _x( 'Note: this will display poll results for %sall form entries%s, not only the entries displayed in the View.', 'The string placeholders are for emphasis HTML', 'gravityview' ), '<em>', '</em>' );
27 27
 
28 28
 		$default_values = array(
29 29
 			'header' => 1,
@@ -32,27 +32,27 @@  discard block
 block discarded – undo
32 32
 
33 33
 		$settings = array(
34 34
 			'percentages' => array(
35
-				'label' => __('Display Percentages', 'gravityview'),
35
+				'label' => __( 'Display Percentages', 'gravityview' ),
36 36
 				'type' => 'checkbox',
37 37
 				'value' => true,
38 38
 				'tooltip' => __( 'Display results percentages as part of results? Supported values are: true, false. Defaults to "true".', 'gravityview' ),
39 39
 			),
40 40
 			'counts' => array(
41
-				'label' => __('Display Counts', 'gravityview'),
41
+				'label' => __( 'Display Counts', 'gravityview' ),
42 42
 				'type' => 'checkbox',
43 43
 				'value' => true,
44 44
 				'tooltip' => __( 'Display number of times each choice has been selected when displaying results? Supported values are: true, false. Defaults to "true".', 'gravityview' ),
45 45
 			),
46 46
 			'style' => array(
47 47
 				'type' => 'select',
48
-				'label' => __('Style', 'gravityview'),
48
+				'label' => __( 'Style', 'gravityview' ),
49 49
 				'tooltip' => __( 'The Polls Add-On currently supports 4 built in styles: red, green, orange, blue. Defaults to "green".', 'gravityview' ),
50 50
 				'value' => 'green',
51 51
 				'choices' => array(
52
-					'green' => __('Green', 'gravityview'),
53
-					'blue' => __('Blue', 'gravityview'),
54
-					'red' => __('Red', 'gravityview'),
55
-					'orange' => __('Orange', 'gravityview'),
52
+					'green' => __( 'Green', 'gravityview' ),
53
+					'blue' => __( 'Blue', 'gravityview' ),
54
+					'red' => __( 'Red', 'gravityview' ),
55
+					'orange' => __( 'Orange', 'gravityview' ),
56 56
 				),
57 57
 			),
58 58
 		);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
63 63
 		}
64 64
 
65
-		parent::__construct( __( 'Poll Results', 'gravityview' ) , null, $default_values, $settings );
65
+		parent::__construct( __( 'Poll Results', 'gravityview' ), null, $default_values, $settings );
66 66
 	}
67 67
 
68 68
 	/**
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$GFPolls = GFPolls::get_instance();
91 91
 
92
-		wp_enqueue_script('gpoll_js', $GFPolls->get_base_url() . '/js/gpoll.js', array('jquery'), $GFPolls->_version);
92
+		wp_enqueue_script( 'gpoll_js', $GFPolls->get_base_url() . '/js/gpoll.js', array( 'jquery' ), $GFPolls->_version );
93 93
 
94 94
 		$GFPolls->localize_scripts();
95 95
 
96
-		wp_enqueue_style('gpoll_css', $GFPolls->get_base_url() . '/css/gpoll.css', null, $GFPolls->_version);
96
+		wp_enqueue_style( 'gpoll_css', $GFPolls->get_base_url() . '/css/gpoll.css', null, $GFPolls->_version );
97 97
 	}
98 98
 
99 99
 	/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function pre_render_frontend() {
105 105
 
106
-		if( ! class_exists('GFPolls') ) {
106
+		if ( ! class_exists( 'GFPolls' ) ) {
107 107
 
108 108
 			gravityview()->log->error( 'Poll Widget not displayed; the Poll Addon is not loaded' );
109 109
 
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
 
113 113
 		$view = gravityview()->views->get();
114 114
 
115
-		$poll_fields = array( $view->form->form['id'] => GFCommon::get_fields_by_type( $view->form, array( 'poll' ) ) );
115
+		$poll_fields = array( $view->form->form[ 'id' ] => GFCommon::get_fields_by_type( $view->form, array( 'poll' ) ) );
116 116
 
117 117
 		foreach ( $view->joins as $join ) {
118
-			$poll_fields[ $join->join_on->form['id'] ] = GFCommon::get_fields_by_type( $join->join_on->form, array( 'poll' ) );
118
+			$poll_fields[ $join->join_on->form[ 'id' ] ] = GFCommon::get_fields_by_type( $join->join_on->form, array( 'poll' ) );
119 119
 		}
120 120
 
121 121
 		$poll_fields = array_filter( $poll_fields );
@@ -167,12 +167,12 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public function render_frontend( $widget_args, $content = '', $context = '' ) {
169 169
 
170
-		if( ! $this->pre_render_frontend() ) {
170
+		if ( ! $this->pre_render_frontend() ) {
171 171
 			return;
172 172
 		}
173 173
 
174 174
 		// Make sure the class is loaded in DataTables
175
-		if( !class_exists( 'GFFormDisplay' ) ) {
175
+		if ( ! class_exists( 'GFFormDisplay' ) ) {
176 176
 			include_once( GFCommon::get_base_path() . '/form_display.php' );
177 177
 		}
178 178
 
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
 
181 181
 		$settings = $this->get_frontend_settings( $widget_args );
182 182
 
183
-		$percentages = empty( $settings['percentages'] ) ? 'false' : 'true';
183
+		$percentages = empty( $settings[ 'percentages' ] ) ? 'false' : 'true';
184 184
 
185
-		$counts = empty( $settings['counts'] ) ? 'false' : 'true';
185
+		$counts = empty( $settings[ 'counts' ] ) ? 'false' : 'true';
186 186
 
187
-		if( !empty( $settings['field'] ) ) {
188
-			$merge_tag = sprintf( '{gpoll: field="%d" style="%s" percentages="%s" counts="%s"}', $settings['field'], $settings['style'], $percentages, $counts );
187
+		if ( ! empty( $settings[ 'field' ] ) ) {
188
+			$merge_tag = sprintf( '{gpoll: field="%d" style="%s" percentages="%s" counts="%s"}', $settings[ 'field' ], $settings[ 'style' ], $percentages, $counts );
189 189
 		} else {
190
-			$merge_tag = sprintf( '{all_poll_results: style="%s" percentages="%s" counts="%s"}', $settings['style'], $percentages, $counts );
190
+			$merge_tag = sprintf( '{all_poll_results: style="%s" percentages="%s" counts="%s"}', $settings[ 'style' ], $percentages, $counts );
191 191
 		}
192 192
 
193 193
 		$gravityview_view = GravityView_View::getInstance();
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$gravityview_view->poll_settings = $settings;
198 198
 		$gravityview_view->poll_fields = $this->poll_fields;
199 199
 
200
-		$gravityview_view->render('widget', 'poll', false );
200
+		$gravityview_view->render( 'widget', 'poll', false );
201 201
 
202 202
 		unset( $gravityview_view->poll_merge_tag, $gravityview_view->poll_settings, $gravityview_view->poll_form, $gravityview_view->poll_fields );
203 203
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-template-entry-table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public function the_field( \GV\Field $field ) {
28 28
 		$renderer = new Field_Renderer();
29
-		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source();
29
+		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source();
30 30
 
31 31
 		return $renderer->render( $field, $this->view, $source, $this->entry->from_field( $field ), $this->request );
32 32
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		foreach ( $fields->all() as $field ) {
64 64
 			$context = Template_Context::from_template( $this, compact( 'field' ) );
65 65
 
66
-			$form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form;
66
+			$form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form;
67 67
 			$entry = $this->entry->from_field( $field );
68 68
 
69 69
 			if ( ! $entry ) {
Please login to merge, or discard this patch.
future/includes/class-gv-template-entry-list.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @return string
27 27
 	 */
28 28
 	public function the_field( \GV\Field $field, $extras = null ) {
29
-		$form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form;
29
+		$form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form;
30 30
 		$entry = $this->entry->from_field( $field );
31 31
 
32 32
 		if ( ! $entry ) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		}
35 35
 
36 36
 		$renderer = new Field_Renderer();
37
-		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source();
37
+		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source();
38 38
 		
39 39
 		$value = $renderer->render( $field, $this->view, $source, $entry, $this->request );
40 40
 		
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 		$hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context );
63 63
 
64 64
 		if ( is_numeric( $field->ID ) ) {
65
-			$extras['field'] = $field->as_configuration();
65
+			$extras[ 'field' ] = $field->as_configuration();
66 66
 		}
67 67
 
68
-		$extras['entry'] = $this->entry->as_entry();
69
-		$extras['hide_empty'] = $hide_empty;
70
-		$extras['label'] = $label;
71
-		$extras['value'] = $value;
68
+		$extras[ 'entry' ] = $this->entry->as_entry();
69
+		$extras[ 'hide_empty' ] = $hide_empty;
70
+		$extras[ 'label' ] = $label;
71
+		$extras[ 'value' ] = $value;
72 72
 
73 73
 		return \gravityview_field_output( $extras, $context );
74 74
 	}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 3 patches
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -573,7 +573,8 @@  discard block
 block discarded – undo
573 573
 
574 574
 							// Only allow quantity to be set if it's allowed to be edited
575 575
 							if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) {
576
-							} else { // otherwise set to what it previously was
576
+							} else {
577
+// otherwise set to what it previously was
577 578
 								$_POST[ $input_name ] = $entry[ $input['id'] ];
578 579
 							}
579 580
 						} else {
@@ -958,7 +959,7 @@  discard block
 block discarded – undo
958 959
 
959 960
 			$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
960 961
 
961
-			if( ! $this->is_valid ){
962
+			if( ! $this->is_valid ) {
962 963
 
963 964
 				// Keeping this compatible with Gravity Forms.
964 965
 				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
@@ -2070,9 +2071,7 @@  discard block
 block discarded – undo
2070 2071
 		// Verify
2071 2072
 		else if( ! $this->is_edit_entry() ) {
2072 2073
 			$valid = false;
2073
-		}
2074
-
2075
-		else {
2074
+		} else {
2076 2075
 			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2077 2076
 		}
2078 2077
 
Please login to merge, or discard this patch.
Indentation   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 
103 103
 	/**
104 104
 	 * ID of the current post. May also be ID of the current View.
105
-     *
106
-     * @since 2.0.13
107 105
 	 *
108
-     * @var int
106
+	 * @since 2.0.13
107
+	 *
108
+	 * @var int
109 109
 	 */
110 110
 	public $post_id;
111 111
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function prevent_maybe_process_form() {
191 191
 
192
-	    if( ! $this->is_edit_entry_submission() ) {
192
+		if( ! $this->is_edit_entry_submission() ) {
193 193
 			return;
194 194
 		}
195 195
 
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 	 * When Edit entry view is requested setup the vars
229 229
 	 */
230 230
 	private function setup_vars() {
231
-        global $post;
231
+		global $post;
232 232
 
233 233
 		$gravityview_view = GravityView_View::getInstance();
234 234
 
235 235
 
236 236
 		$entries = $gravityview_view->getEntries();
237
-	    self::$original_entry = $entries[0];
238
-	    $this->entry = $entries[0];
237
+		self::$original_entry = $entries[0];
238
+		$this->entry = $entries[0];
239 239
 
240 240
 		self::$original_form = GFAPI::get_form( $this->entry['form_id'] );
241 241
 		$this->form = $gravityview_view->getForm();
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 
381 381
 			GFFormsModel::save_lead( $form, $this->entry );
382 382
 
383
-	        // Delete the values for hidden inputs
384
-	        $this->unset_hidden_field_values();
383
+			// Delete the values for hidden inputs
384
+			$this->unset_hidden_field_values();
385 385
 
386 386
 			$this->entry['date_created'] = $date_created;
387 387
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 			// Perform actions normally performed after updating a lead
395 395
 			$this->after_update();
396 396
 
397
-	        /**
397
+			/**
398 398
 			 * Must be AFTER after_update()!
399 399
 			 * @see https://github.com/gravityview/GravityView/issues/764
400 400
 			 */
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 
403 403
 			/**
404 404
 			 * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry
405
-             * @since 2.1 Added $gv_data parameter
405
+			 * @since 2.1 Added $gv_data parameter
406 406
 			 * @param array $form Gravity Forms form array
407 407
 			 * @param string $entry_id Numeric ID of the entry that was updated
408 408
 			 * @param GravityView_Edit_Entry_Render $this This object
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 * @return void
427 427
 	 */
428 428
 	private function unset_hidden_field_values() {
429
-	    global $wpdb;
429
+		global $wpdb;
430 430
 
431 431
 		/**
432 432
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
451 451
 		}
452 452
 
453
-	    foreach ( $this->entry as $input_id => $field_value ) {
453
+		foreach ( $this->entry as $input_id => $field_value ) {
454 454
 
455 455
 			if ( ! is_numeric( $input_id ) ) {
456 456
 				continue;
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 				continue;
461 461
 			}
462 462
 
463
-		    // Reset fields that are or would be hidden
464
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), $this->entry ) ) {
463
+			// Reset fields that are or would be hidden
464
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), $this->entry ) ) {
465 465
 
466 466
 				$empty_value = $field->get_value_save_entry(
467 467
 					is_array( $field->get_entry_inputs() ) ? array() : '',
@@ -473,16 +473,16 @@  discard block
 block discarded – undo
473 473
 					$empty_value = '';
474 474
 				}
475 475
 
476
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
476
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
477 477
 
478
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
478
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
479 479
 
480
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
480
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
481 481
 				// after submission
482
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
483
-			    $_POST[ $post_input_id ] = '';
484
-		    }
485
-	    }
482
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
483
+				$_POST[ $post_input_id ] = '';
484
+			}
485
+		}
486 486
 	}
487 487
 
488 488
 	/**
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 
638 638
 		$form = $this->filter_conditional_logic( $this->form );
639 639
 
640
-	    /** @type GF_Field $field */
640
+		/** @type GF_Field $field */
641 641
 		foreach( $form['fields'] as $k => &$field ) {
642 642
 
643 643
 			/**
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 
653 653
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
654 654
 				foreach( $field->inputs as $key => $input ) {
655
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
655
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
656 656
 				}
657 657
 			}
658 658
 		}
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 
693 693
 				$inputs = $field->get_entry_inputs();
694 694
 				if ( is_array( $inputs ) ) {
695
-				    foreach ( $inputs as $input ) {
695
+					foreach ( $inputs as $input ) {
696 696
 						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
697 697
 
698 698
 						if ( 'product' === $field->type ) {
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 						}
712 712
 
713 713
 						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
714
-				    }
714
+					}
715 715
 				} else {
716 716
 					// Set to what it previously was if it's not editable
717 717
 					if ( ! in_array( $field->id, $allowed_fields ) ) {
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
758 758
 
759 759
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
760
-	        $ary = stripslashes_deep( $ary );
760
+			$ary = stripslashes_deep( $ary );
761 761
 			$img_url = \GV\Utils::get( $ary, 0 );
762 762
 
763 763
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 	private function maybe_update_post_fields( $form ) {
831 831
 
832 832
 		if( empty( $this->entry['post_id'] ) ) {
833
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
833
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
834 834
 			return;
835 835
 		}
836 836
 
@@ -865,49 +865,49 @@  discard block
 block discarded – undo
865 865
 
866 866
 				switch( $field->type ) {
867 867
 
868
-				    case 'post_title':
869
-				        $post_title = $value;
870
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
871
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
872
-				        }
873
-				        $updated_post->post_title = $post_title;
874
-				        $updated_post->post_name  = $post_title;
875
-				        unset( $post_title );
876
-				        break;
877
-
878
-				    case 'post_content':
879
-				        $post_content = $value;
880
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
881
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
882
-				        }
883
-				        $updated_post->post_content = $post_content;
884
-				        unset( $post_content );
885
-				        break;
886
-				    case 'post_excerpt':
887
-				        $updated_post->post_excerpt = $value;
888
-				        break;
889
-				    case 'post_tags':
890
-				        wp_set_post_tags( $post_id, $value, false );
891
-				        break;
892
-				    case 'post_category':
893
-				        break;
894
-				    case 'post_custom_field':
868
+					case 'post_title':
869
+						$post_title = $value;
870
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
871
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
872
+						}
873
+						$updated_post->post_title = $post_title;
874
+						$updated_post->post_name  = $post_title;
875
+						unset( $post_title );
876
+						break;
877
+
878
+					case 'post_content':
879
+						$post_content = $value;
880
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
881
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
882
+						}
883
+						$updated_post->post_content = $post_content;
884
+						unset( $post_content );
885
+						break;
886
+					case 'post_excerpt':
887
+						$updated_post->post_excerpt = $value;
888
+						break;
889
+					case 'post_tags':
890
+						wp_set_post_tags( $post_id, $value, false );
891
+						break;
892
+					case 'post_category':
893
+						break;
894
+					case 'post_custom_field':
895 895
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
896 896
 							$value = $value[ $field_id ];
897 897
 						}
898 898
 
899
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
900
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
901
-				        }
899
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
900
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
901
+						}
902 902
 
903 903
 						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
904 904
 
905
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
906
-				        break;
905
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
906
+						break;
907 907
 
908
-				    case 'post_image':
909
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
910
-				        break;
908
+					case 'post_image':
909
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
910
+						break;
911 911
 
912 912
 				}
913 913
 
@@ -1077,14 +1077,14 @@  discard block
 block discarded – undo
1077 1077
 			?><h2 class="gv-edit-entry-title">
1078 1078
 				<span><?php
1079 1079
 
1080
-				    /**
1081
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
1082
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
1083
-				     * @param GravityView_Edit_Entry_Render $this This object
1084
-				     */
1085
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
1080
+					/**
1081
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
1082
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
1083
+					 * @param GravityView_Edit_Entry_Render $this This object
1084
+					 */
1085
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
1086 1086
 
1087
-				    echo esc_attr( $edit_entry_title );
1087
+					echo esc_attr( $edit_entry_title );
1088 1088
 			?></span>
1089 1089
 			</h2>
1090 1090
 
@@ -1139,13 +1139,13 @@  discard block
 block discarded – undo
1139 1139
 				);
1140 1140
 
1141 1141
 				/**
1142
-				* @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1143
-				* @since 1.16.3
1144
-				* @param array $labels Default button labels associative array
1145
-				* @param array $form The Gravity Forms form
1146
-				* @param array $entry The Gravity Forms entry
1147
-				* @param int $view_id The current View ID
1148
-				*/
1142
+				 * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1143
+				 * @since 1.16.3
1144
+				 * @param array $labels Default button labels associative array
1145
+				 * @param array $form The Gravity Forms form
1146
+				 * @param array $entry The Gravity Forms entry
1147
+				 * @param int $view_id The current View ID
1148
+				 */
1149 1149
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1150 1150
 
1151 1151
 				$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit'];
@@ -1182,26 +1182,26 @@  discard block
 block discarded – undo
1182 1182
 
1183 1183
 				switch ( $edit_redirect ) {
1184 1184
 
1185
-                    case '0':
1186
-	                    $redirect_url = $back_link;
1187
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1188
-                        break;
1189
-
1190
-                    case '1':
1191
-	                    $redirect_url = $directory_link = GravityView_API::directory_link();
1192
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1193
-	                    break;
1194
-
1195
-                    case '2':
1196
-	                    $redirect_url = $edit_redirect_url;
1197
-	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1198
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1199
-                        break;
1200
-
1201
-                    case '':
1202
-                    default:
1203
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1204
-                        break;
1185
+					case '0':
1186
+						$redirect_url = $back_link;
1187
+						$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1188
+						break;
1189
+
1190
+					case '1':
1191
+						$redirect_url = $directory_link = GravityView_API::directory_link();
1192
+						$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1193
+						break;
1194
+
1195
+					case '2':
1196
+						$redirect_url = $edit_redirect_url;
1197
+						$redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1198
+						$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1199
+						break;
1200
+
1201
+					case '':
1202
+					default:
1203
+						$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1204
+						break;
1205 1205
 				}
1206 1206
 
1207 1207
 				if ( isset( $redirect_url ) ) {
@@ -1267,13 +1267,13 @@  discard block
 block discarded – undo
1267 1267
 				);
1268 1268
 
1269 1269
 				/**
1270
-				* @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1271
-				* @since 1.16.3
1272
-				* @param array $labels Default button labels associative array
1273
-				* @param array $form The Gravity Forms form
1274
-				* @param array $entry The Gravity Forms entry
1275
-				* @param int $view_id The current View ID
1276
-				*/
1270
+				 * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1271
+				 * @since 1.16.3
1272
+				 * @param array $labels Default button labels associative array
1273
+				 * @param array $form The Gravity Forms form
1274
+				 * @param array $entry The Gravity Forms entry
1275
+				 * @param int $view_id The current View ID
1276
+				 */
1277 1277
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1278 1278
 
1279 1279
 				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 
1320 1320
 		ob_get_clean();
1321 1321
 
1322
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1322
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1323 1323
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1324 1324
 		remove_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1325 1325
 		remove_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
 
1380 1380
 		// for now we don't support Save and Continue feature.
1381 1381
 		if( ! self::$supports_save_and_continue ) {
1382
-	        unset( $form['save'] );
1382
+			unset( $form['save'] );
1383 1383
 		}
1384 1384
 
1385 1385
 		$form = $this->unselect_default_values( $form );
@@ -1406,30 +1406,30 @@  discard block
 block discarded – undo
1406 1406
 			return $field_content;
1407 1407
 		}
1408 1408
 
1409
-        $message = null;
1409
+		$message = null;
1410 1410
 
1411
-        // First, make sure they have the capability to edit the post.
1412
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1411
+		// First, make sure they have the capability to edit the post.
1412
+		if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1413 1413
 
1414
-            /**
1415
-             * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1416
-             * @param string $message The existing "You don't have permission..." text
1417
-             */
1418
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1414
+			/**
1415
+			 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1416
+			 * @param string $message The existing "You don't have permission..." text
1417
+			 */
1418
+			$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1419 1419
 
1420
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1421
-            /**
1422
-             * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1423
-             * @param string $message The existing "This field is not editable; the post no longer exists." text
1424
-             */
1425
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1426
-        }
1420
+		} elseif( null === get_post( $this->entry['post_id'] ) ) {
1421
+			/**
1422
+			 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1423
+			 * @param string $message The existing "This field is not editable; the post no longer exists." text
1424
+			 */
1425
+			$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1426
+		}
1427 1427
 
1428
-        if( $message ) {
1429
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1430
-        }
1428
+		if( $message ) {
1429
+			$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1430
+		}
1431 1431
 
1432
-        return $field_content;
1432
+		return $field_content;
1433 1433
 	}
1434 1434
 
1435 1435
 	/**
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
 			|| ! empty( $field_content )
1458 1458
 			|| in_array( $field->type, array( 'honeypot' ) )
1459 1459
 		) {
1460
-	        return $field_content;
1460
+			return $field_content;
1461 1461
 		}
1462 1462
 
1463 1463
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1465,24 +1465,24 @@  discard block
 block discarded – undo
1465 1465
 
1466 1466
 		$field_value = $this->get_field_value( $field );
1467 1467
 
1468
-	    // Prevent any PHP warnings, like undefined index
1469
-	    ob_start();
1468
+		// Prevent any PHP warnings, like undefined index
1469
+		ob_start();
1470 1470
 
1471
-	    $return = null;
1471
+		$return = null;
1472 1472
 
1473 1473
 		/** @var GravityView_Field $gv_field */
1474 1474
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1475 1475
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1476 1476
 		} else {
1477
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1478
-	    }
1477
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1478
+		}
1479 1479
 
1480
-	    // If there was output, it's an error
1481
-	    $warnings = ob_get_clean();
1480
+		// If there was output, it's an error
1481
+		$warnings = ob_get_clean();
1482 1482
 
1483
-	    if( !empty( $warnings ) ) {
1484
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1485
-	    }
1483
+		if( !empty( $warnings ) ) {
1484
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1485
+		}
1486 1486
 
1487 1487
 		return $return;
1488 1488
 	}
@@ -1517,8 +1517,8 @@  discard block
 block discarded – undo
1517 1517
 				$input_id = strval( $input['id'] );
1518 1518
 
1519 1519
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1520
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1521
-				    $allow_pre_populated = false;
1520
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1521
+					$allow_pre_populated = false;
1522 1522
 				}
1523 1523
 
1524 1524
 			}
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1543 1543
 				$categories = array();
1544 1544
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1545
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1545
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1546 1546
 				}
1547 1547
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1548 1548
 			}
@@ -1552,25 +1552,25 @@  discard block
 block discarded – undo
1552 1552
 		// if value is empty get the default value if defined
1553 1553
 		$field_value = $field->get_value_default_if_empty( $field_value );
1554 1554
 
1555
-	    /**
1556
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1557
-	     * @since 1.11
1558
-	     * @since 1.20 Added third param
1559
-	     * @param mixed $field_value field value used to populate the input
1560
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1561
-	     * @param GravityView_Edit_Entry_Render $this Current object
1562
-	     */
1563
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1564
-
1565
-	    /**
1566
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1567
-	     * @since 1.17
1568
-	     * @since 1.20 Added third param
1569
-	     * @param mixed $field_value field value used to populate the input
1570
-	     * @param GF_Field $field Gravity Forms field object
1571
-	     * @param GravityView_Edit_Entry_Render $this Current object
1572
-	     */
1573
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1555
+		/**
1556
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1557
+		 * @since 1.11
1558
+		 * @since 1.20 Added third param
1559
+		 * @param mixed $field_value field value used to populate the input
1560
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1561
+		 * @param GravityView_Edit_Entry_Render $this Current object
1562
+		 */
1563
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1564
+
1565
+		/**
1566
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1567
+		 * @since 1.17
1568
+		 * @since 1.20 Added third param
1569
+		 * @param mixed $field_value field value used to populate the input
1570
+		 * @param GF_Field $field Gravity Forms field object
1571
+		 * @param GravityView_Edit_Entry_Render $this Current object
1572
+		 */
1573
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1574 1574
 
1575 1575
 		return $field_value;
1576 1576
 	}
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1598 1598
 			// expects certain field array items to be set.
1599 1599
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1600
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1600
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1601 1601
 			}
1602 1602
 
1603 1603
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1611,31 +1611,31 @@  discard block
 block discarded – undo
1611 1611
 				 */
1612 1612
 				case 'fileupload':
1613 1613
 
1614
-				    // Set the previous value
1615
-				    $entry = $this->get_entry();
1614
+					// Set the previous value
1615
+					$entry = $this->get_entry();
1616 1616
 
1617
-				    $input_name = 'input_'.$field->id;
1618
-				    $form_id = $form['id'];
1617
+					$input_name = 'input_'.$field->id;
1618
+					$form_id = $form['id'];
1619 1619
 
1620
-				    $value = NULL;
1620
+					$value = NULL;
1621 1621
 
1622
-				    // Use the previous entry value as the default.
1623
-				    if( isset( $entry[ $field->id ] ) ) {
1624
-				        $value = $entry[ $field->id ];
1625
-				    }
1622
+					// Use the previous entry value as the default.
1623
+					if( isset( $entry[ $field->id ] ) ) {
1624
+						$value = $entry[ $field->id ];
1625
+					}
1626 1626
 
1627
-				    // If this is a single upload file
1628
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1629
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1630
-				        $value = $file_path['url'];
1627
+					// If this is a single upload file
1628
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1629
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1630
+						$value = $file_path['url'];
1631 1631
 
1632
-				    } else {
1632
+					} else {
1633 1633
 
1634
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1635
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1636
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1634
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1635
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1636
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1637 1637
 
1638
-				    }
1638
+					}
1639 1639
 
1640 1640
 					if ( \GV\Utils::get( $field, 'multipleFiles' ) ) {
1641 1641
 						// If there are fresh uploads, process and merge them.
@@ -1656,17 +1656,17 @@  discard block
 block discarded – undo
1656 1656
 						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1657 1657
 					}
1658 1658
 
1659
-				    $this->entry[ $input_name ] = $value;
1660
-				    $_POST[ $input_name ] = $value;
1659
+					$this->entry[ $input_name ] = $value;
1660
+					$_POST[ $input_name ] = $value;
1661 1661
 
1662
-				    break;
1662
+					break;
1663 1663
 
1664 1664
 				case 'number':
1665
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1666
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1667
-				        $_POST['input_'.$field->id ] = NULL;
1668
-				    }
1669
-				    break;
1665
+					// Fix "undefined index" issue at line 1286 in form_display.php
1666
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1667
+						$_POST['input_'.$field->id ] = NULL;
1668
+					}
1669
+					break;
1670 1670
 			}
1671 1671
 
1672 1672
 		}
@@ -1787,7 +1787,7 @@  discard block
 block discarded – undo
1787 1787
 
1788 1788
 						// count uploaded files and existent entry files
1789 1789
 						$count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1790
-						               ( is_array( $value ) ? count( $value ) : 0 );
1790
+									   ( is_array( $value ) ? count( $value ) : 0 );
1791 1791
 
1792 1792
 						if ( $count_files > $field->maxFiles ) {
1793 1793
 							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
@@ -1809,47 +1809,47 @@  discard block
 block discarded – undo
1809 1809
 
1810 1810
 				switch ( $field_type ) {
1811 1811
 
1812
-				    // Captchas don't need to be re-entered.
1813
-				    case 'captcha':
1812
+					// Captchas don't need to be re-entered.
1813
+					case 'captcha':
1814 1814
 
1815
-				        // Post Image fields aren't editable, so we un-fail them.
1816
-				    case 'post_image':
1817
-				        $field->failed_validation = false;
1818
-				        unset( $field->validation_message );
1819
-				        break;
1815
+						// Post Image fields aren't editable, so we un-fail them.
1816
+					case 'post_image':
1817
+						$field->failed_validation = false;
1818
+						unset( $field->validation_message );
1819
+						break;
1820 1820
 
1821 1821
 				}
1822 1822
 
1823 1823
 				// You can't continue inside a switch, so we do it after.
1824 1824
 				if( empty( $field->failed_validation ) ) {
1825
-				    continue;
1825
+					continue;
1826 1826
 				}
1827 1827
 
1828 1828
 				// checks if the No Duplicates option is not validating entry against itself, since
1829 1829
 				// we're editing a stored entry, it would also assume it's a duplicate.
1830 1830
 				if( !empty( $field->noDuplicates ) ) {
1831 1831
 
1832
-				    $entry = $this->get_entry();
1832
+					$entry = $this->get_entry();
1833 1833
 
1834
-				    // If the value of the entry is the same as the stored value
1835
-				    // Then we can assume it's not a duplicate, it's the same.
1836
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1837
-				        //if value submitted was not changed, then don't validate
1838
-				        $field->failed_validation = false;
1834
+					// If the value of the entry is the same as the stored value
1835
+					// Then we can assume it's not a duplicate, it's the same.
1836
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1837
+						//if value submitted was not changed, then don't validate
1838
+						$field->failed_validation = false;
1839 1839
 
1840
-				        unset( $field->validation_message );
1840
+						unset( $field->validation_message );
1841 1841
 
1842
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1842
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1843 1843
 
1844
-				        continue;
1845
-				    }
1844
+						continue;
1845
+					}
1846 1846
 				}
1847 1847
 
1848 1848
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1849 1849
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1850
-				    unset( $field->validation_message );
1850
+					unset( $field->validation_message );
1851 1851
 					$field->failed_validation = false;
1852
-				    continue;
1852
+					continue;
1853 1853
 				}
1854 1854
 
1855 1855
 				$gv_valid = false;
@@ -1913,8 +1913,8 @@  discard block
 block discarded – undo
1913 1913
 		// Hide fields depending on admin settings
1914 1914
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1915 1915
 
1916
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1917
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1916
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1917
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1918 1918
 
1919 1919
 		/**
1920 1920
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -2005,11 +2005,11 @@  discard block
 block discarded – undo
2005 2005
 		// The edit tab has been configured, so we loop through to configured settings
2006 2006
 		foreach ( $configured_fields as $configured_field ) {
2007 2007
 
2008
-	        /** @var GF_Field $field */
2009
-	        foreach ( $fields as $field ) {
2008
+			/** @var GF_Field $field */
2009
+			foreach ( $fields as $field ) {
2010 2010
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2011
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2012
-				    break;
2011
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2012
+					break;
2013 2013
 				}
2014 2014
 
2015 2015
 			}
@@ -2065,28 +2065,28 @@  discard block
 block discarded – undo
2065 2065
 	 */
2066 2066
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
2067 2067
 
2068
-	    /**
2068
+		/**
2069 2069
 		 * @filter `gravityview/edit_entry/use_gf_admin_only_setting` When Edit tab isn't configured, should the Gravity Forms "Admin Only" field settings be used to control field display to non-admins? Default: true
2070
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
2071
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
2072
-	     * @since 1.9.1
2073
-	     * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
2074
-	     * @param array $form GF Form array
2075
-	     * @param int $view_id View ID
2076
-	     */
2077
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2078
-
2079
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2070
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
2071
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
2072
+		 * @since 1.9.1
2073
+		 * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions.
2074
+		 * @param array $form GF Form array
2075
+		 * @param int $view_id View ID
2076
+		 */
2077
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2078
+
2079
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2080 2080
 			foreach( $fields as $k => $field ) {
2081 2081
 				if( $field->adminOnly ) {
2082
-				    unset( $fields[ $k ] );
2082
+					unset( $fields[ $k ] );
2083 2083
 				}
2084 2084
 			}
2085 2085
 			return array_values( $fields );
2086 2086
 		}
2087 2087
 
2088
-	    foreach( $fields as &$field ) {
2089
-		    $field->adminOnly = false;
2088
+		foreach( $fields as &$field ) {
2089
+			$field->adminOnly = false;
2090 2090
 		}
2091 2091
 
2092 2092
 		return $fields;
@@ -2106,13 +2106,13 @@  discard block
 block discarded – undo
2106 2106
 	 */
2107 2107
 	private function unselect_default_values( $form ) {
2108 2108
 
2109
-	    foreach ( $form['fields'] as &$field ) {
2109
+		foreach ( $form['fields'] as &$field ) {
2110 2110
 
2111 2111
 			if ( empty( $field->choices ) ) {
2112
-                continue;
2112
+				continue;
2113 2113
 			}
2114 2114
 
2115
-            foreach ( $field->choices as &$choice ) {
2115
+			foreach ( $field->choices as &$choice ) {
2116 2116
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
2117 2117
 					$choice['isSelected'] = false;
2118 2118
 				}
@@ -2149,36 +2149,36 @@  discard block
 block discarded – undo
2149 2149
 
2150 2150
 			if( 'checkbox' === $field->type ) {
2151 2151
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
2152
-				    $input_id = $input['id'];
2153
-				    $choice = $field->choices[ $key ];
2154
-				    $value = \GV\Utils::get( $this->entry, $input_id );
2155
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
2156
-				    if( $match ) {
2157
-				        $field->choices[ $key ]['isSelected'] = true;
2158
-				    }
2152
+					$input_id = $input['id'];
2153
+					$choice = $field->choices[ $key ];
2154
+					$value = \GV\Utils::get( $this->entry, $input_id );
2155
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
2156
+					if( $match ) {
2157
+						$field->choices[ $key ]['isSelected'] = true;
2158
+					}
2159 2159
 				}
2160 2160
 			} else {
2161 2161
 
2162 2162
 				// We need to run through each field to set the default values
2163 2163
 				foreach ( $this->entry as $field_id => $field_value ) {
2164 2164
 
2165
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
2165
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
2166 2166
 
2167
-				        if( 'list' === $field->type ) {
2168
-				            $list_rows = maybe_unserialize( $field_value );
2167
+						if( 'list' === $field->type ) {
2168
+							$list_rows = maybe_unserialize( $field_value );
2169 2169
 
2170
-				            $list_field_value = array();
2171
-				            foreach ( (array) $list_rows as $row ) {
2172
-				                foreach ( (array) $row as $column ) {
2173
-				                    $list_field_value[] = $column;
2174
-				                }
2175
-				            }
2170
+							$list_field_value = array();
2171
+							foreach ( (array) $list_rows as $row ) {
2172
+								foreach ( (array) $row as $column ) {
2173
+									$list_field_value[] = $column;
2174
+								}
2175
+							}
2176 2176
 
2177
-				            $field->defaultValue = serialize( $list_field_value );
2178
-				        } else {
2179
-				            $field->defaultValue = $field_value;
2180
-				        }
2181
-				    }
2177
+							$field->defaultValue = serialize( $list_field_value );
2178
+						} else {
2179
+							$field->defaultValue = $field_value;
2180
+						}
2181
+					}
2182 2182
 				}
2183 2183
 			}
2184 2184
 		}
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
 			foreach ( $form['fields'] as &$field ) {
2240 2240
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2241 2241
 
2242
-				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2242
+					list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2243 2243
 
2244 2244
 					if ( $field['id'] == $rule_field_id ) {
2245 2245
 						unset( $field->conditionalLogic['rules'][ $rule_i ] );
@@ -2290,7 +2290,7 @@  discard block
 block discarded – undo
2290 2290
 			return $has_conditional_logic;
2291 2291
 		}
2292 2292
 
2293
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2293
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2294 2294
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
2295 2295
 	}
2296 2296
 
@@ -2357,14 +2357,14 @@  discard block
 block discarded – undo
2357 2357
 
2358 2358
 		if( $echo && $error !== true ) {
2359 2359
 
2360
-	        $error = esc_html( $error );
2360
+			$error = esc_html( $error );
2361 2361
 
2362
-	        /**
2363
-	         * @since 1.9
2364
-	         */
2365
-	        if ( ! empty( $this->entry ) ) {
2366
-		        $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;" ) );
2367
-	        }
2362
+			/**
2363
+			 * @since 1.9
2364
+			 */
2365
+			if ( ! empty( $this->entry ) ) {
2366
+				$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;" ) );
2367
+			}
2368 2368
 
2369 2369
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2370 2370
 		}
Please login to merge, or discard this patch.
Spacing   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	function load() {
136 136
 
137 137
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
138
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
138
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
139 139
 
140 140
 		// Don't display an embedded form when editing an entry
141 141
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		add_action( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
146 146
 		add_action( 'admin_init', array( $this, 'prevent_maybe_process_form' ), 8 );
147 147
 
148
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
148
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
149 149
 
150 150
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ), 10, 4 );
151 151
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
157 157
 
158 158
 		// Add fields expected by GFFormDisplay::validate()
159
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
159
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
160 160
 
161 161
 		// Fix multiselect value for GF 2.2
162 162
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @return void
174 174
 	 */
175 175
 	public function prevent_render_form() {
176
-		if( $this->is_edit_entry() ) {
177
-			if( 'wp_head' === current_filter() ) {
176
+		if ( $this->is_edit_entry() ) {
177
+			if ( 'wp_head' === current_filter() ) {
178 178
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
179 179
 			} else {
180 180
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -189,17 +189,17 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function prevent_maybe_process_form() {
191 191
 
192
-	    if( ! $this->is_edit_entry_submission() ) {
192
+	    if ( ! $this->is_edit_entry_submission() ) {
193 193
 			return;
194 194
 		}
195 195
 
196 196
 		gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] Removing GFForms::maybe_process_form() action.' );
197 197
 
198
-		remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
199
-		remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
198
+		remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
199
+		remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
200 200
 
201
-		remove_action( 'admin_init',  array( 'GFForms', 'maybe_process_form'), 9 );
202
-		remove_action( 'admin_init',  array( 'RGForms', 'maybe_process_form'), 9 );
201
+		remove_action( 'admin_init', array( 'GFForms', 'maybe_process_form' ), 9 );
202
+		remove_action( 'admin_init', array( 'RGForms', 'maybe_process_form' ), 9 );
203 203
 	}
204 204
 
205 205
 	/**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
 		$is_edit_entry =
212 212
 			( GravityView_frontend::is_single_entry() || gravityview()->request->is_entry() )
213
-			&& ( ! empty( $_GET['edit'] ) );
213
+			&& ( ! empty( $_GET[ 'edit' ] ) );
214 214
 
215 215
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
216 216
 	}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @return boolean
222 222
 	 */
223 223
 	public function is_edit_entry_submission() {
224
-		return !empty( $_POST[ self::$nonce_field ] );
224
+		return ! empty( $_POST[ self::$nonce_field ] );
225 225
 	}
226 226
 
227 227
 	/**
@@ -234,16 +234,16 @@  discard block
 block discarded – undo
234 234
 
235 235
 
236 236
 		$entries = $gravityview_view->getEntries();
237
-	    self::$original_entry = $entries[0];
238
-	    $this->entry = $entries[0];
237
+	    self::$original_entry = $entries[ 0 ];
238
+	    $this->entry = $entries[ 0 ];
239 239
 
240
-		self::$original_form = GFAPI::get_form( $this->entry['form_id'] );
240
+		self::$original_form = GFAPI::get_form( $this->entry[ 'form_id' ] );
241 241
 		$this->form = $gravityview_view->getForm();
242
-		$this->form_id = $this->entry['form_id'];
242
+		$this->form_id = $this->entry[ 'form_id' ];
243 243
 		$this->view_id = $gravityview_view->getViewId();
244 244
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
245 245
 
246
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
246
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
247 247
 	}
248 248
 
249 249
 
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 	private function print_scripts() {
303 303
 		$gravityview_view = GravityView_View::getInstance();
304 304
 
305
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
305
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
306 306
 
307
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
307
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
308 308
 
309 309
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
310 310
 
@@ -323,19 +323,19 @@  discard block
 block discarded – undo
323 323
 	 */
324 324
 	private function process_save( $gv_data ) {
325 325
 
326
-		if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
326
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
327 327
 			return;
328 328
 		}
329 329
 
330 330
 		// Make sure the entry, view, and form IDs are all correct
331 331
 		$valid = $this->verify_nonce();
332 332
 
333
-		if ( !$valid ) {
333
+		if ( ! $valid ) {
334 334
 			gravityview()->log->error( 'Nonce validation failed.' );
335 335
 			return;
336 336
 		}
337 337
 
338
-		if ( $this->entry['id'] !== $_POST['lid'] ) {
338
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
339 339
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
340 340
 			return;
341 341
 		}
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
 		$this->validate();
348 348
 
349
-		if( $this->is_valid ) {
349
+		if ( $this->is_valid ) {
350 350
 
351 351
 			gravityview()->log->debug( 'Submission is valid.' );
352 352
 
@@ -358,15 +358,15 @@  discard block
 block discarded – undo
358 358
 			/**
359 359
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
360 360
 			 */
361
-			unset( $_GET['page'] );
361
+			unset( $_GET[ 'page' ] );
362 362
 
363
-			$date_created = $this->entry['date_created'];
363
+			$date_created = $this->entry[ 'date_created' ];
364 364
 
365 365
 			/**
366 366
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
367 367
 			 * @since 1.17.2
368 368
 			 */
369
-			unset( $this->entry['date_created'] );
369
+			unset( $this->entry[ 'date_created' ] );
370 370
 
371 371
 			/**
372 372
 			 * @action `gravityview/edit_entry/before_update` Perform an action before the entry has been updated using Edit Entry
@@ -376,14 +376,14 @@  discard block
 block discarded – undo
376 376
 			 * @param GravityView_Edit_Entry_Render $this This object
377 377
 			 * @param GravityView_View_Data $gv_data The View data
378 378
 			 */
379
-			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry['id'], $this, $gv_data );
379
+			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry[ 'id' ], $this, $gv_data );
380 380
 
381 381
 			GFFormsModel::save_lead( $form, $this->entry );
382 382
 
383 383
 	        // Delete the values for hidden inputs
384 384
 	        $this->unset_hidden_field_values();
385 385
 
386
-			$this->entry['date_created'] = $date_created;
386
+			$this->entry[ 'date_created' ] = $date_created;
387 387
 
388 388
 			// Process calculation fields
389 389
 			$this->update_calculation_fields();
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 			 * @param GravityView_Edit_Entry_Render $this This object
409 409
 			 * @param GravityView_View_Data $gv_data The View data
410 410
 			 */
411
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
411
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
412 412
 
413 413
 		} else {
414 414
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -444,10 +444,10 @@  discard block
 block discarded – undo
444 444
 
445 445
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
446 446
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
447
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
447
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
448 448
 		} else {
449 449
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
450
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
450
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
451 451
 		}
452 452
 
453 453
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 
466 466
 				$empty_value = $field->get_value_save_entry(
467 467
 					is_array( $field->get_entry_inputs() ) ? array() : '',
468
-					$this->form, '', $this->entry['id'], $this->entry
468
+					$this->form, '', $this->entry[ 'id' ], $this->entry
469 469
 				);
470 470
 
471 471
 				if ( $field->has_calculation() ) {
472
-					$this->unset_hidden_calculations[] = $field->id; // Unset
472
+					$this->unset_hidden_calculations[ ] = $field->id; // Unset
473 473
 					$empty_value = '';
474 474
 				}
475 475
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 	private function preset_approval_fields() {
499 499
 		$has_approved_field = false;
500 500
 
501
-		foreach ( self::$original_form['fields'] as $field ) {
501
+		foreach ( self::$original_form[ 'fields' ] as $field ) {
502 502
 			if ( $field->gravityview_approved ) {
503 503
 				$has_approved_field = true;
504 504
 				break;
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 
512 512
 		$is_field_hidden = true;
513 513
 
514
-		foreach ( $this->form['fields'] as $field ) {
514
+		foreach ( $this->form[ 'fields' ] as $field ) {
515 515
 			if ( $field->gravityview_approved ) {
516 516
 				$is_field_hidden = false;
517 517
 				break;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 
537 537
 		remove_filter( 'gravityview/approve_entries/update_unapproved_meta', array( $this, 'prevent_update_unapproved_meta' ), 9 );
538 538
 
539
-		if ( ! $value = gform_get_meta( $entry['id'], 'is_approved' ) ) {
539
+		if ( ! $value = gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
540 540
 
541 541
 			$value = GravityView_Entry_Approval_Status::UNAPPROVED;
542 542
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		}
602 602
 
603 603
 		/** No file is being uploaded. */
604
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
604
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
605 605
 			/** So return the original upload, with $value as backup (it can be empty during edit form rendering) */
606 606
 			return rgar( $entry, $input_id, $value );
607 607
 		}
@@ -619,11 +619,11 @@  discard block
 block discarded – undo
619 619
 	 * @return mixed
620 620
 	 */
621 621
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
622
-		if( ! $this->is_edit_entry() ) {
622
+		if ( ! $this->is_edit_entry() ) {
623 623
 			return $plupload_init;
624 624
 		}
625 625
 
626
-		$plupload_init['gf_vars']['max_files'] = 0;
626
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
627 627
 
628 628
 		return $plupload_init;
629 629
 	}
@@ -638,26 +638,26 @@  discard block
 block discarded – undo
638 638
 		$form = $this->filter_conditional_logic( $this->form );
639 639
 
640 640
 	    /** @type GF_Field $field */
641
-		foreach( $form['fields'] as $k => &$field ) {
641
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
642 642
 
643 643
 			/**
644 644
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
645 645
 			 * @since 1.16.3
646 646
 			 */
647
-			if( $field->has_calculation() ) {
648
-				unset( $form['fields'][ $k ] );
647
+			if ( $field->has_calculation() ) {
648
+				unset( $form[ 'fields' ][ $k ] );
649 649
 			}
650 650
 
651 651
 			$field->adminOnly = false;
652 652
 
653
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
654
-				foreach( $field->inputs as $key => $input ) {
655
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
653
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
654
+				foreach ( $field->inputs as $key => $input ) {
655
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
656 656
 				}
657 657
 			}
658 658
 		}
659 659
 
660
-		$form['fields'] = array_values( $form['fields'] );
660
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
661 661
 
662 662
 		return $form;
663 663
 	}
@@ -669,14 +669,14 @@  discard block
 block discarded – undo
669 669
 		$update = false;
670 670
 
671 671
 		// get the most up to date entry values
672
-		$entry = GFAPI::get_entry( $this->entry['id'] );
672
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
673 673
 
674 674
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
675 675
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
676
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry['id'] ) );
676
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry[ 'id' ] ) );
677 677
 		} else {
678 678
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
679
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry['id'] ) );
679
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry[ 'id' ] ) );
680 680
 		}
681 681
 
682 682
 
@@ -693,24 +693,24 @@  discard block
 block discarded – undo
693 693
 				$inputs = $field->get_entry_inputs();
694 694
 				if ( is_array( $inputs ) ) {
695 695
 				    foreach ( $inputs as $input ) {
696
-						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
696
+						list( $field_id, $input_id ) = rgexplode( '.', $input[ 'id' ], 2 );
697 697
 
698 698
 						if ( 'product' === $field->type ) {
699
-							$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
699
+							$input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
700 700
 
701 701
 							// Only allow quantity to be set if it's allowed to be edited
702 702
 							if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) {
703 703
 							} else { // otherwise set to what it previously was
704
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
704
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
705 705
 							}
706 706
 						} else {
707 707
 							// Set to what it previously was if it's not editable
708 708
 							if ( ! in_array( $field_id, $allowed_fields ) ) {
709
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
709
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
710 710
 							}
711 711
 						}
712 712
 
713
-						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
713
+						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input[ 'id' ] );
714 714
 				    }
715 715
 				} else {
716 716
 					// Set to what it previously was if it's not editable
@@ -750,19 +750,19 @@  discard block
 block discarded – undo
750 750
 
751 751
 		$input_name = 'input_' . $field_id;
752 752
 
753
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
753
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
754 754
 
755 755
 			// We have a new image
756 756
 
757
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
757
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
758 758
 
759 759
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
760 760
 	        $ary = stripslashes_deep( $ary );
761 761
 			$img_url = \GV\Utils::get( $ary, 0 );
762 762
 
763
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
764
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
765
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
763
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
764
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
765
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
766 766
 
767 767
 			$image_meta = array(
768 768
 				'post_excerpt' => $img_caption,
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 
772 772
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
773 773
 			if ( ! empty( $img_title ) ) {
774
-				$image_meta['post_title'] = $img_title;
774
+				$image_meta[ 'post_title' ] = $img_title;
775 775
 			}
776 776
 
777 777
 			/**
@@ -829,15 +829,15 @@  discard block
 block discarded – undo
829 829
 	 */
830 830
 	private function maybe_update_post_fields( $form ) {
831 831
 
832
-		if( empty( $this->entry['post_id'] ) ) {
832
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
833 833
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
834 834
 			return;
835 835
 		}
836 836
 
837
-		$post_id = $this->entry['post_id'];
837
+		$post_id = $this->entry[ 'post_id' ];
838 838
 
839 839
 		// Security check
840
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
840
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
841 841
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
842 842
 			return;
843 843
 		}
@@ -850,25 +850,25 @@  discard block
 block discarded – undo
850 850
 
851 851
 			$field = RGFormsModel::get_field( $form, $field_id );
852 852
 
853
-			if( ! $field ) {
853
+			if ( ! $field ) {
854 854
 				continue;
855 855
 			}
856 856
 
857
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
857
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
858 858
 
859 859
 				// Get the value of the field, including $_POSTed value
860 860
 				$value = RGFormsModel::get_field_value( $field );
861 861
 
862 862
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
863 863
 				$entry_tmp = $this->entry;
864
-				$entry_tmp["{$field_id}"] = $value;
864
+				$entry_tmp[ "{$field_id}" ] = $value;
865 865
 
866
-				switch( $field->type ) {
866
+				switch ( $field->type ) {
867 867
 
868 868
 				    case 'post_title':
869 869
 				        $post_title = $value;
870 870
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
871
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
871
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
872 872
 				        }
873 873
 				        $updated_post->post_title = $post_title;
874 874
 				        $updated_post->post_name  = $post_title;
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 				    case 'post_content':
879 879
 				        $post_content = $value;
880 880
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
881
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
881
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
882 882
 				        }
883 883
 				        $updated_post->post_content = $post_content;
884 884
 				        unset( $post_content );
@@ -896,11 +896,11 @@  discard block
 block discarded – undo
896 896
 							$value = $value[ $field_id ];
897 897
 						}
898 898
 
899
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
899
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
900 900
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
901 901
 				        }
902 902
 
903
-						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
903
+						$value = $field->get_value_save_entry( $value, $form, '', $this->entry[ 'id' ], $this->entry );
904 904
 
905 905
 				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
906 906
 				        break;
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 				}
913 913
 
914 914
 				// update entry after
915
-				$this->entry["{$field_id}"] = $value;
915
+				$this->entry[ "{$field_id}" ] = $value;
916 916
 
917 917
 				$update_entry = true;
918 918
 
@@ -921,11 +921,11 @@  discard block
 block discarded – undo
921 921
 
922 922
 		}
923 923
 
924
-		if( $update_entry ) {
924
+		if ( $update_entry ) {
925 925
 
926 926
 			$return_entry = GFAPI::update_entry( $this->entry );
927 927
 
928
-			if( is_wp_error( $return_entry ) ) {
928
+			if ( is_wp_error( $return_entry ) ) {
929 929
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
930 930
 			} else {
931 931
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 
936 936
 		$return_post = wp_update_post( $updated_post, true );
937 937
 
938
-		if( is_wp_error( $return_post ) ) {
938
+		if ( is_wp_error( $return_post ) ) {
939 939
 			$return_post->add_data( $updated_post, '$updated_post' );
940 940
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
941 941
 		} else {
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
970 970
 
971 971
 		// replace conditional shortcodes
972
-		if( $do_shortcode ) {
972
+		if ( $do_shortcode ) {
973 973
 			$output = do_shortcode( $output );
974 974
 		}
975 975
 
@@ -988,19 +988,19 @@  discard block
 block discarded – undo
988 988
 	 */
989 989
 	private function after_update() {
990 990
 
991
-		do_action( 'gform_after_update_entry', self::$original_form, $this->entry['id'], self::$original_entry );
992
-		do_action( "gform_after_update_entry_{$this->form['id']}", self::$original_form, $this->entry['id'], self::$original_entry );
991
+		do_action( 'gform_after_update_entry', self::$original_form, $this->entry[ 'id' ], self::$original_entry );
992
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", self::$original_form, $this->entry[ 'id' ], self::$original_entry );
993 993
 
994 994
 		// Re-define the entry now that we've updated it.
995
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
995
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
996 996
 
997 997
 		$entry = GFFormsModel::set_entry_meta( $entry, self::$original_form );
998 998
 
999 999
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
1000 1000
 			// We need to clear the cache because Gravity Forms caches the field values, which
1001 1001
 			// we have just updated.
1002
-			foreach ($this->form['fields'] as $key => $field) {
1003
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
1002
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
1003
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
1004 1004
 			}
1005 1005
 		}
1006 1006
 
@@ -1010,11 +1010,11 @@  discard block
 block discarded – undo
1010 1010
 		 * @since develop
1011 1011
 		 */
1012 1012
 		if ( $allowed_feeds = $this->view->settings->get( 'edit_feeds', array() ) ) {
1013
-			$feeds = GFAPI::get_feeds( null, $entry['form_id'] );
1013
+			$feeds = GFAPI::get_feeds( null, $entry[ 'form_id' ] );
1014 1014
 			if ( ! is_wp_error( $feeds ) ) {
1015 1015
 				$registered_feeds = array();
1016 1016
 				foreach ( GFAddOn::get_registered_addons() as $registered_feed ) {
1017
-					if ( is_subclass_of( $registered_feed,  'GFFeedAddOn' ) ) {
1017
+					if ( is_subclass_of( $registered_feed, 'GFFeedAddOn' ) ) {
1018 1018
 						if ( method_exists( $registered_feed, 'get_instance' ) ) {
1019 1019
 							$registered_feed = call_user_func( array( $registered_feed, 'get_instance' ) );
1020 1020
 							$registered_feeds[ $registered_feed->get_slug() ] = $registered_feed;
@@ -1022,8 +1022,8 @@  discard block
 block discarded – undo
1022 1022
 					}
1023 1023
 				}
1024 1024
 				foreach ( $feeds as $feed ) {
1025
-					if ( in_array( $feed['id'], $allowed_feeds ) ) {
1026
-						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed['addon_slug'] ) ) {
1025
+					if ( in_array( $feed[ 'id' ], $allowed_feeds ) ) {
1026
+						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed[ 'addon_slug' ] ) ) {
1027 1027
 							$returned_entry = $feed_object->process_feed( $feed, $entry, self::$original_form );
1028 1028
 							if ( is_array( $returned_entry ) && rgar( $returned_entry, 'id' ) ) {
1029 1029
 								$entry = $returned_entry;
@@ -1051,9 +1051,9 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
 		$view = \GV\View::by_id( $this->view_id );
1053 1053
 
1054
-		if( $view->settings->get( 'edit_locking' ) ) {
1054
+		if ( $view->settings->get( 'edit_locking' ) ) {
1055 1055
 			$locking = new GravityView_Edit_Entry_Locking();
1056
-			$locking->maybe_lock_object( $this->entry['id'] );
1056
+			$locking->maybe_lock_object( $this->entry[ 'id' ] );
1057 1057
 		}
1058 1058
 
1059 1059
 		?>
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 
1067 1067
 		<div class="gv-edit-entry-wrapper"><?php
1068 1068
 
1069
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
1069
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
1070 1070
 
1071 1071
 			/**
1072 1072
 			 * Fixes weird wpautop() issue
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
1083 1083
 				     * @param GravityView_Edit_Entry_Render $this This object
1084 1084
 				     */
1085
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
1085
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
1086 1086
 
1087 1087
 				    echo esc_attr( $edit_entry_title );
1088 1088
 			?></span>
@@ -1148,18 +1148,18 @@  discard block
 block discarded – undo
1148 1148
 				*/
1149 1149
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1150 1150
 
1151
-				$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit'];
1151
+				$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels[ 'submit' ];
1152 1152
 			}
1153 1153
 
1154 1154
 			$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
1155 1155
 
1156
-			if( ! $this->is_valid ){
1156
+			if ( ! $this->is_valid ) {
1157 1157
 
1158 1158
 				// Keeping this compatible with Gravity Forms.
1159
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
1160
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
1159
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
1160
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
1161 1161
 
1162
-				echo GVCommon::generate_notice( $message , 'gv-error' );
1162
+				echo GVCommon::generate_notice( $message, 'gv-error' );
1163 1163
 
1164 1164
 			} elseif ( false === $this->is_paged_submitted ) {
1165 1165
 				// Paged form that hasn't been submitted on the last page yet
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
 				 * @param int $view_id View ID
1173 1173
 				 * @param array $entry Gravity Forms entry array
1174 1174
 				 */
1175
-				$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message , $this->view_id, $this->entry );
1175
+				$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message, $this->view_id, $this->entry );
1176 1176
 
1177 1177
 				echo GVCommon::generate_notice( $message );
1178 1178
 			} else {
@@ -1184,23 +1184,23 @@  discard block
 block discarded – undo
1184 1184
 
1185 1185
                     case '0':
1186 1186
 	                    $redirect_url = $back_link;
1187
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1187
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' );
1188 1188
                         break;
1189 1189
 
1190 1190
                     case '1':
1191 1191
 	                    $redirect_url = $directory_link = GravityView_API::directory_link();
1192
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1192
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to %s%s', 'Replacement 1 is HTML. Replacement 2 is the title of the page where the user will be taken. Replacement 3 is HTML.', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $view->post_title ), '</a>' );
1193 1193
 	                    break;
1194 1194
 
1195 1195
                     case '2':
1196 1196
 	                    $redirect_url = $edit_redirect_url;
1197 1197
 	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1198
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.','gravityview'), '<a href="'. esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1198
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sRedirecting to %s%s', 'Replacement 1 is HTML. Replacement 2 is the URL where the user will be taken. Replacement 3 is HTML.', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', esc_html( $edit_redirect_url ), '</a>' );
1199 1199
                         break;
1200 1200
 
1201 1201
                     case '':
1202 1202
                     default:
1203
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1203
+					    $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' );
1204 1204
                         break;
1205 1205
 				}
1206 1206
 
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 				 * @param array $entry Gravity Forms entry array
1217 1217
 				 * @param string $back_link URL to return to the original entry. @since 1.6
1218 1218
 				 */
1219
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
1219
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
1220 1220
 
1221 1221
 				echo GVCommon::generate_notice( $message );
1222 1222
 			}
@@ -1240,8 +1240,8 @@  discard block
 block discarded – undo
1240 1240
 		 */
1241 1241
 		do_action( 'gravityview/edit-entry/render/before', $this );
1242 1242
 
1243
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1244
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1243
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1244
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1245 1245
 		add_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1246 1246
 		add_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
1247 1247
 		add_filter( 'gform_disable_view_counter', '__return_true' );
@@ -1250,14 +1250,14 @@  discard block
 block discarded – undo
1250 1250
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1251 1251
 
1252 1252
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1253
-		unset( $_GET['page'] );
1253
+		unset( $_GET[ 'page' ] );
1254 1254
 
1255 1255
 		$this->show_next_button = false;
1256 1256
 		$this->show_previous_button = false;
1257 1257
 
1258 1258
 		// TODO: Verify multiple-page forms
1259 1259
 		if ( GFCommon::has_pages( $this->form ) && apply_filters( 'gravityview/features/paged-edit', false ) ) {
1260
-			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form['id'], 0 ) ) ) {
1260
+			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form[ 'id' ], 0 ) ) ) {
1261 1261
 
1262 1262
 				$labels = array(
1263 1263
 					'cancel'   => __( 'Cancel', 'gravityview' ),
@@ -1276,20 +1276,20 @@  discard block
 block discarded – undo
1276 1276
 				*/
1277 1277
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1278 1278
 
1279
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
1280
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'is_valid' ] = true;
1279
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'form' ] = $this->form;
1280
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'is_valid' ] = true;
1281 1281
 
1282
-				if ( \GV\Utils::_POST( 'save' ) === $labels['next'] ) {
1282
+				if ( \GV\Utils::_POST( 'save' ) === $labels[ 'next' ] ) {
1283 1283
 					$last_page = \GFFormDisplay::get_max_page_number( $this->form );
1284 1284
 
1285 1285
 					while ( ++$page_number < $last_page && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1286 1286
 					} // Advance to next visible page
1287
-				} elseif ( \GV\Utils::_POST( 'save' ) === $labels['previous'] ) {
1287
+				} elseif ( \GV\Utils::_POST( 'save' ) === $labels[ 'previous' ] ) {
1288 1288
 					while ( --$page_number > 1 && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1289 1289
 					} // Advance to next visible page
1290 1290
 				}
1291 1291
 
1292
-				GFFormDisplay::$submission[ $this->form['id'] ]['page_number'] = $page_number;
1292
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'page_number' ] = $page_number;
1293 1293
 			}
1294 1294
 
1295 1295
 			if ( ( $page_number = intval( $page_number ) ) < 2 ) {
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
 
1316 1316
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1317 1317
 
1318
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1318
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1319 1319
 
1320 1320
 		ob_get_clean();
1321 1321
 
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
 	 * @return string
1344 1344
 	 */
1345 1345
 	public function render_form_buttons() {
1346
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1346
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1347 1347
 	}
1348 1348
 
1349 1349
 
@@ -1362,15 +1362,15 @@  discard block
 block discarded – undo
1362 1362
 	 */
1363 1363
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1364 1364
 
1365
-		if( $form['id'] != $this->form_id ) {
1365
+		if ( $form[ 'id' ] != $this->form_id ) {
1366 1366
 			return $form;
1367 1367
 		}
1368 1368
 
1369 1369
 		// In case we have validated the form, use it to inject the validation results into the form render
1370
-		if( isset( $this->form_after_validation ) && $this->form_after_validation['id'] === $form['id'] ) {
1370
+		if ( isset( $this->form_after_validation ) && $this->form_after_validation[ 'id' ] === $form[ 'id' ] ) {
1371 1371
 			$form = $this->form_after_validation;
1372 1372
 		} else {
1373
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1373
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1374 1374
 		}
1375 1375
 
1376 1376
 		$form = $this->filter_conditional_logic( $form );
@@ -1378,8 +1378,8 @@  discard block
 block discarded – undo
1378 1378
 		$form = $this->prefill_conditional_logic( $form );
1379 1379
 
1380 1380
 		// for now we don't support Save and Continue feature.
1381
-		if( ! self::$supports_save_and_continue ) {
1382
-	        unset( $form['save'] );
1381
+		if ( ! self::$supports_save_and_continue ) {
1382
+	        unset( $form[ 'save' ] );
1383 1383
 		}
1384 1384
 
1385 1385
 		$form = $this->unselect_default_values( $form );
@@ -1402,31 +1402,31 @@  discard block
 block discarded – undo
1402 1402
 	 */
1403 1403
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1404 1404
 
1405
-		if( ! GFCommon::is_post_field( $field ) ) {
1405
+		if ( ! GFCommon::is_post_field( $field ) ) {
1406 1406
 			return $field_content;
1407 1407
 		}
1408 1408
 
1409 1409
         $message = null;
1410 1410
 
1411 1411
         // First, make sure they have the capability to edit the post.
1412
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1412
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1413 1413
 
1414 1414
             /**
1415 1415
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1416 1416
              * @param string $message The existing "You don't have permission..." text
1417 1417
              */
1418
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1418
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1419 1419
 
1420
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1420
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1421 1421
             /**
1422 1422
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1423 1423
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1424 1424
              */
1425
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1425
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1426 1426
         }
1427 1427
 
1428
-        if( $message ) {
1429
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1428
+        if ( $message ) {
1429
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1430 1430
         }
1431 1431
 
1432 1432
         return $field_content;
@@ -1450,8 +1450,8 @@  discard block
 block discarded – undo
1450 1450
 
1451 1451
 		// If the form has been submitted, then we don't need to pre-fill the values,
1452 1452
 		// Except for fileupload type and when a field input is overridden- run always!!
1453
-		if(
1454
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1453
+		if (
1454
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1455 1455
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1456 1456
 			&& ! GFCommon::is_product_field( $field->type )
1457 1457
 			|| ! empty( $field_content )
@@ -1471,7 +1471,7 @@  discard block
 block discarded – undo
1471 1471
 	    $return = null;
1472 1472
 
1473 1473
 		/** @var GravityView_Field $gv_field */
1474
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1474
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1475 1475
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1476 1476
 		} else {
1477 1477
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
 	    // If there was output, it's an error
1481 1481
 	    $warnings = ob_get_clean();
1482 1482
 
1483
-	    if( !empty( $warnings ) ) {
1483
+	    if ( ! empty( $warnings ) ) {
1484 1484
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1485 1485
 	    }
1486 1486
 
@@ -1505,7 +1505,7 @@  discard block
 block discarded – undo
1505 1505
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1506 1506
 
1507 1507
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1508
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1508
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1509 1509
 
1510 1510
 			$field_value = array();
1511 1511
 
@@ -1514,10 +1514,10 @@  discard block
 block discarded – undo
1514 1514
 
1515 1515
 			foreach ( (array)$field->inputs as $input ) {
1516 1516
 
1517
-				$input_id = strval( $input['id'] );
1517
+				$input_id = strval( $input[ 'id' ] );
1518 1518
 
1519 1519
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1520
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1520
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1521 1521
 				    $allow_pre_populated = false;
1522 1522
 				}
1523 1523
 
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
 
1526 1526
 			$pre_value = $field->get_value_submission( array(), false );
1527 1527
 
1528
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1528
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1529 1529
 
1530 1530
 		} else {
1531 1531
 
@@ -1536,13 +1536,13 @@  discard block
 block discarded – undo
1536 1536
 
1537 1537
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1538 1538
 			// or pre-populated value if not empty and set to override saved value
1539
-			$field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1539
+			$field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1540 1540
 
1541 1541
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1542
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1542
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1543 1543
 				$categories = array();
1544 1544
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1545
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1545
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1546 1546
 				}
1547 1547
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1548 1548
 			}
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
 	     * @param GF_Field $field Gravity Forms field object
1571 1571
 	     * @param GravityView_Edit_Entry_Render $this Current object
1572 1572
 	     */
1573
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1573
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1574 1574
 
1575 1575
 		return $field_value;
1576 1576
 	}
@@ -1587,12 +1587,12 @@  discard block
 block discarded – undo
1587 1587
 	 */
1588 1588
 	public function gform_pre_validation( $form ) {
1589 1589
 
1590
-		if( ! $this->verify_nonce() ) {
1590
+		if ( ! $this->verify_nonce() ) {
1591 1591
 			return $form;
1592 1592
 		}
1593 1593
 
1594 1594
 		// Fix PHP warning regarding undefined index.
1595
-		foreach ( $form['fields'] as &$field) {
1595
+		foreach ( $form[ 'fields' ] as &$field ) {
1596 1596
 
1597 1597
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1598 1598
 			// expects certain field array items to be set.
@@ -1600,7 +1600,7 @@  discard block
 block discarded – undo
1600 1600
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1601 1601
 			}
1602 1602
 
1603
-			switch( RGFormsModel::get_input_type( $field ) ) {
1603
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1604 1604
 
1605 1605
 				/**
1606 1606
 				 * 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.
@@ -1614,26 +1614,26 @@  discard block
 block discarded – undo
1614 1614
 				    // Set the previous value
1615 1615
 				    $entry = $this->get_entry();
1616 1616
 
1617
-				    $input_name = 'input_'.$field->id;
1618
-				    $form_id = $form['id'];
1617
+				    $input_name = 'input_' . $field->id;
1618
+				    $form_id = $form[ 'id' ];
1619 1619
 
1620 1620
 				    $value = NULL;
1621 1621
 
1622 1622
 				    // Use the previous entry value as the default.
1623
-				    if( isset( $entry[ $field->id ] ) ) {
1623
+				    if ( isset( $entry[ $field->id ] ) ) {
1624 1624
 				        $value = $entry[ $field->id ];
1625 1625
 				    }
1626 1626
 
1627 1627
 				    // If this is a single upload file
1628
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1629
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1630
-				        $value = $file_path['url'];
1628
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1629
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1630
+				        $value = $file_path[ 'url' ];
1631 1631
 
1632 1632
 				    } else {
1633 1633
 
1634 1634
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1635 1635
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1636
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1636
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1637 1637
 
1638 1638
 				    }
1639 1639
 
@@ -1643,7 +1643,7 @@  discard block
 block discarded – undo
1643 1643
 						if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1644 1644
 							$value = empty( $value ) ? '[]' : $value;
1645 1645
 							$value = stripslashes_deep( $value );
1646
-							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array() );
1646
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1647 1647
 						} else if ( GFCommon::is_json( $value ) ) {
1648 1648
 							// Existing file; let GF derive the value from the `$_gf_uploaded_files` object (see `\GF_Field_FileUpload::get_multifile_value()`)
1649 1649
 							global $_gf_uploaded_files;
@@ -1663,8 +1663,8 @@  discard block
 block discarded – undo
1663 1663
 
1664 1664
 				case 'number':
1665 1665
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1666
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1667
-				        $_POST['input_'.$field->id ] = NULL;
1666
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1667
+				        $_POST[ 'input_' . $field->id ] = NULL;
1668 1668
 				    }
1669 1669
 				    break;
1670 1670
 			}
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
 		 * You can enter whatever you want!
1702 1702
 		 * We try validating, and customize the results using `self::custom_validation()`
1703 1703
 		 */
1704
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1704
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1705 1705
 
1706 1706
 		// Needed by the validate funtion
1707 1707
 		$failed_validation_page = NULL;
@@ -1709,14 +1709,14 @@  discard block
 block discarded – undo
1709 1709
 
1710 1710
 		// Prevent entry limit from running when editing an entry, also
1711 1711
 		// prevent form scheduling from preventing editing
1712
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1712
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1713 1713
 
1714 1714
 		// Hide fields depending on Edit Entry settings
1715
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1715
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1716 1716
 
1717 1717
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1718 1718
 
1719
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1719
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1720 1720
 	}
1721 1721
 
1722 1722
 
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
 
1745 1745
 		$gv_valid = true;
1746 1746
 
1747
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1747
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1748 1748
 			$value             = RGFormsModel::get_field_value( $field );
1749 1749
 			$field_type        = RGFormsModel::get_input_type( $field );
1750 1750
 			$is_required       = ! empty( $field->isRequired );
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 
1753 1753
 			// Manually validate required fields as they can be skipped be skipped by GF's validation
1754 1754
 			// This can happen when the field is considered "hidden" (see `GFFormDisplay::validate`) due to unmet conditional logic
1755
-			if ( $is_required && !$failed_validation && rgblank( $value ) ) {
1755
+			if ( $is_required && ! $failed_validation && rgblank( $value ) ) {
1756 1756
 				$field->failed_validation  = true;
1757 1757
 				$field->validation_message = esc_html__( 'This field is required.', 'gravityview' );
1758 1758
 
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
 					if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1777 1777
 						$input_name = 'input_' . $field->id;
1778 1778
 						//uploaded
1779
-						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1779
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1780 1780
 
1781 1781
 						//existent
1782 1782
 						$entry = $this->get_entry();
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
 							$gv_valid                  = false;
1796 1796
 
1797 1797
 							// in case of error make sure the newest upload files are removed from the upload input
1798
-							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1798
+							GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1799 1799
 						}
1800 1800
 					}
1801 1801
 
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
 			}
1804 1804
 
1805 1805
 			// This field has failed validation.
1806
-			if( !empty( $field->failed_validation ) ) {
1806
+			if ( ! empty( $field->failed_validation ) ) {
1807 1807
 
1808 1808
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1809 1809
 
@@ -1821,19 +1821,19 @@  discard block
 block discarded – undo
1821 1821
 				}
1822 1822
 
1823 1823
 				// You can't continue inside a switch, so we do it after.
1824
-				if( empty( $field->failed_validation ) ) {
1824
+				if ( empty( $field->failed_validation ) ) {
1825 1825
 				    continue;
1826 1826
 				}
1827 1827
 
1828 1828
 				// checks if the No Duplicates option is not validating entry against itself, since
1829 1829
 				// we're editing a stored entry, it would also assume it's a duplicate.
1830
-				if( !empty( $field->noDuplicates ) ) {
1830
+				if ( ! empty( $field->noDuplicates ) ) {
1831 1831
 
1832 1832
 				    $entry = $this->get_entry();
1833 1833
 
1834 1834
 				    // If the value of the entry is the same as the stored value
1835 1835
 				    // Then we can assume it's not a duplicate, it's the same.
1836
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1836
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1837 1837
 				        //if value submitted was not changed, then don't validate
1838 1838
 				        $field->failed_validation = false;
1839 1839
 
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
 				}
1847 1847
 
1848 1848
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1849
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1849
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1850 1850
 				    unset( $field->validation_message );
1851 1851
 					$field->failed_validation = false;
1852 1852
 				    continue;
@@ -1858,12 +1858,12 @@  discard block
 block discarded – undo
1858 1858
 
1859 1859
 		}
1860 1860
 
1861
-		$validation_results['is_valid'] = $gv_valid;
1861
+		$validation_results[ 'is_valid' ] = $gv_valid;
1862 1862
 
1863 1863
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1864 1864
 
1865 1865
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1866
-		$this->form_after_validation = $validation_results['form'];
1866
+		$this->form_after_validation = $validation_results[ 'form' ];
1867 1867
 
1868 1868
 		return $validation_results;
1869 1869
 	}
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
 	 */
1877 1877
 	public function get_entry() {
1878 1878
 
1879
-		if( empty( $this->entry ) ) {
1879
+		if ( empty( $this->entry ) ) {
1880 1880
 			// Get the database value of the entry that's being edited
1881 1881
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1882 1882
 		}
@@ -1908,10 +1908,10 @@  discard block
 block discarded – undo
1908 1908
 		}
1909 1909
 
1910 1910
 		// If edit tab not yet configured, show all fields
1911
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1911
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1912 1912
 
1913 1913
 		// Hide fields depending on admin settings
1914
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1914
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1915 1915
 
1916 1916
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1917 1917
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1944,7 +1944,7 @@  discard block
 block discarded – undo
1944 1944
 	 */
1945 1945
 	private function filter_fields( $fields, $configured_fields ) {
1946 1946
 
1947
-		if( empty( $fields ) || !is_array( $fields ) ) {
1947
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1948 1948
 			return $fields;
1949 1949
 		}
1950 1950
 
@@ -1961,12 +1961,12 @@  discard block
 block discarded – undo
1961 1961
 
1962 1962
 			// Remove the fields that have calculation properties and keep them to be used later
1963 1963
 			// @since 1.16.2
1964
-			if( $field->has_calculation() ) {
1965
-				$this->fields_with_calculation[] = $field;
1964
+			if ( $field->has_calculation() ) {
1965
+				$this->fields_with_calculation[ ] = $field;
1966 1966
 				// don't remove the calculation fields on form render.
1967 1967
 			}
1968 1968
 
1969
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1969
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1970 1970
 				unset( $fields[ $key ] );
1971 1971
 			}
1972 1972
 		}
@@ -1996,7 +1996,7 @@  discard block
 block discarded – undo
1996 1996
 					continue; // Never include when no fields are configured
1997 1997
 				}
1998 1998
 
1999
-				$out_fields[] = $field;
1999
+				$out_fields[ ] = $field;
2000 2000
 			}
2001 2001
 
2002 2002
 			return array_values( $out_fields );
@@ -2007,8 +2007,8 @@  discard block
 block discarded – undo
2007 2007
 
2008 2008
 	        /** @var GF_Field $field */
2009 2009
 	        foreach ( $fields as $field ) {
2010
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2011
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2010
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2011
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
2012 2012
 				    break;
2013 2013
 				}
2014 2014
 
@@ -2031,14 +2031,14 @@  discard block
 block discarded – undo
2031 2031
 
2032 2032
 		$return_field = $field;
2033 2033
 
2034
-		if( empty( $field_setting['show_label'] ) ) {
2034
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
2035 2035
 			$return_field->label = '';
2036
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
2037
-			$return_field->label = $field_setting['custom_label'];
2036
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
2037
+			$return_field->label = $field_setting[ 'custom_label' ];
2038 2038
 		}
2039 2039
 
2040
-		if( !empty( $field_setting['custom_class'] ) ) {
2041
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
2040
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
2041
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
2042 2042
 		}
2043 2043
 
2044 2044
 		/**
@@ -2076,16 +2076,16 @@  discard block
 block discarded – undo
2076 2076
 	     */
2077 2077
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2078 2078
 
2079
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2080
-			foreach( $fields as $k => $field ) {
2081
-				if( $field->adminOnly ) {
2079
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
2080
+			foreach ( $fields as $k => $field ) {
2081
+				if ( $field->adminOnly ) {
2082 2082
 				    unset( $fields[ $k ] );
2083 2083
 				}
2084 2084
 			}
2085 2085
 			return array_values( $fields );
2086 2086
 		}
2087 2087
 
2088
-	    foreach( $fields as &$field ) {
2088
+	    foreach ( $fields as &$field ) {
2089 2089
 		    $field->adminOnly = false;
2090 2090
 		}
2091 2091
 
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 	 */
2107 2107
 	private function unselect_default_values( $form ) {
2108 2108
 
2109
-	    foreach ( $form['fields'] as &$field ) {
2109
+	    foreach ( $form[ 'fields' ] as &$field ) {
2110 2110
 
2111 2111
 			if ( empty( $field->choices ) ) {
2112 2112
                 continue;
@@ -2114,7 +2114,7 @@  discard block
 block discarded – undo
2114 2114
 
2115 2115
             foreach ( $field->choices as &$choice ) {
2116 2116
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
2117
-					$choice['isSelected'] = false;
2117
+					$choice[ 'isSelected' ] = false;
2118 2118
 				}
2119 2119
 			}
2120 2120
 		}
@@ -2139,22 +2139,22 @@  discard block
 block discarded – undo
2139 2139
 	 */
2140 2140
 	function prefill_conditional_logic( $form ) {
2141 2141
 
2142
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2142
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2143 2143
 			return $form;
2144 2144
 		}
2145 2145
 
2146 2146
 		// Have Conditional Logic pre-fill fields as if the data were default values
2147 2147
 		/** @var GF_Field $field */
2148
-		foreach ( $form['fields'] as &$field ) {
2148
+		foreach ( $form[ 'fields' ] as &$field ) {
2149 2149
 
2150
-			if( 'checkbox' === $field->type ) {
2150
+			if ( 'checkbox' === $field->type ) {
2151 2151
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
2152
-				    $input_id = $input['id'];
2152
+				    $input_id = $input[ 'id' ];
2153 2153
 				    $choice = $field->choices[ $key ];
2154 2154
 				    $value = \GV\Utils::get( $this->entry, $input_id );
2155 2155
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
2156
-				    if( $match ) {
2157
-				        $field->choices[ $key ]['isSelected'] = true;
2156
+				    if ( $match ) {
2157
+				        $field->choices[ $key ][ 'isSelected' ] = true;
2158 2158
 				    }
2159 2159
 				}
2160 2160
 			} else {
@@ -2162,15 +2162,15 @@  discard block
 block discarded – undo
2162 2162
 				// We need to run through each field to set the default values
2163 2163
 				foreach ( $this->entry as $field_id => $field_value ) {
2164 2164
 
2165
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
2165
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
2166 2166
 
2167
-				        if( 'list' === $field->type ) {
2167
+				        if ( 'list' === $field->type ) {
2168 2168
 				            $list_rows = maybe_unserialize( $field_value );
2169 2169
 
2170 2170
 				            $list_field_value = array();
2171
-				            foreach ( (array) $list_rows as $row ) {
2172
-				                foreach ( (array) $row as $column ) {
2173
-				                    $list_field_value[] = $column;
2171
+				            foreach ( (array)$list_rows as $row ) {
2172
+				                foreach ( (array)$row as $column ) {
2173
+				                    $list_field_value[ ] = $column;
2174 2174
 				                }
2175 2175
 				            }
2176 2176
 
@@ -2203,32 +2203,32 @@  discard block
 block discarded – undo
2203 2203
 		 * @see https://github.com/gravityview/GravityView/issues/840
2204 2204
 		 * @since develop
2205 2205
 		 */
2206
-		$the_form = GFAPI::get_form( $form['id'] );
2206
+		$the_form = GFAPI::get_form( $form[ 'id' ] );
2207 2207
 		$editable_ids = array();
2208
-		foreach ( $form['fields'] as $field ) {
2209
-			$editable_ids[] = $field['id']; // wp_list_pluck is destructive in this context
2208
+		foreach ( $form[ 'fields' ] as $field ) {
2209
+			$editable_ids[ ] = $field[ 'id' ]; // wp_list_pluck is destructive in this context
2210 2210
 		}
2211 2211
 		$remove_conditions_rule = array();
2212
-		foreach ( $the_form['fields'] as $field ) {
2213
-			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic['rules'] ) ) {
2214
-				foreach ( $field->conditionalLogic['rules'] as $i => $rule ) {
2215
-					if ( ! in_array( $rule['fieldId'], $editable_ids ) ) {
2212
+		foreach ( $the_form[ 'fields' ] as $field ) {
2213
+			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic[ 'rules' ] ) ) {
2214
+				foreach ( $field->conditionalLogic[ 'rules' ] as $i => $rule ) {
2215
+					if ( ! in_array( $rule[ 'fieldId' ], $editable_ids ) ) {
2216 2216
 						/**
2217 2217
 						 * This conditional field is not editable in this View.
2218 2218
 						 * We need to remove the rule, but only if it matches.
2219 2219
 						 */
2220
-						if ( $_field = GFAPI::get_field( $the_form, $rule['fieldId'] ) ) {
2220
+						if ( $_field = GFAPI::get_field( $the_form, $rule[ 'fieldId' ] ) ) {
2221 2221
 							$value = $_field->get_value_export( $this->entry );
2222
-						} elseif ( isset( $this->entry[ $rule['fieldId'] ] ) ) {
2223
-							$value = $this->entry[ $rule['fieldId'] ];
2222
+						} elseif ( isset( $this->entry[ $rule[ 'fieldId' ] ] ) ) {
2223
+							$value = $this->entry[ $rule[ 'fieldId' ] ];
2224 2224
 						} else {
2225
-							$value = gform_get_meta( $this->entry['id'], $rule['fieldId'] );
2225
+							$value = gform_get_meta( $this->entry[ 'id' ], $rule[ 'fieldId' ] );
2226 2226
 						}
2227 2227
 
2228
-						$match = GFFormsModel::matches_operation( $value, $rule['value'], $rule['operator'] );
2228
+						$match = GFFormsModel::matches_operation( $value, $rule[ 'value' ], $rule[ 'operator' ] );
2229 2229
 
2230 2230
 						if ( $match ) {
2231
-							$remove_conditions_rule[] = array( $field['id'], $i );
2231
+							$remove_conditions_rule[ ] = array( $field[ 'id' ], $i );
2232 2232
 						}
2233 2233
 					}
2234 2234
 				}
@@ -2236,21 +2236,21 @@  discard block
 block discarded – undo
2236 2236
 		}
2237 2237
 
2238 2238
 		if ( $remove_conditions_rule ) {
2239
-			foreach ( $form['fields'] as &$field ) {
2239
+			foreach ( $form[ 'fields' ] as &$field ) {
2240 2240
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2241 2241
 
2242 2242
 				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2243 2243
 
2244
-					if ( $field['id'] == $rule_field_id ) {
2245
-						unset( $field->conditionalLogic['rules'][ $rule_i ] );
2246
-						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field['id'] ) );
2244
+					if ( $field[ 'id' ] == $rule_field_id ) {
2245
+						unset( $field->conditionalLogic[ 'rules' ][ $rule_i ] );
2246
+						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field[ 'id' ] ) );
2247 2247
 					}
2248 2248
 				}
2249 2249
 			}
2250 2250
 		}
2251 2251
 
2252 2252
 		/** Normalize the indices... */
2253
-		$form['fields'] = array_values( $form['fields'] );
2253
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
2254 2254
 
2255 2255
 		/**
2256 2256
 		 * @filter `gravityview/edit_entry/conditional_logic` Should the Edit Entry form use Gravity Forms conditional logic showing/hiding of fields?
@@ -2260,16 +2260,16 @@  discard block
 block discarded – undo
2260 2260
 		 */
2261 2261
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
2262 2262
 
2263
-		if( $use_conditional_logic ) {
2263
+		if ( $use_conditional_logic ) {
2264 2264
 			return $form;
2265 2265
 		}
2266 2266
 
2267
-		foreach( $form['fields'] as &$field ) {
2267
+		foreach ( $form[ 'fields' ] as &$field ) {
2268 2268
 			/* @var GF_Field $field */
2269 2269
 			$field->conditionalLogic = null;
2270 2270
 		}
2271 2271
 
2272
-		unset( $form['button']['conditionalLogic'] );
2272
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
2273 2273
 
2274 2274
 		return $form;
2275 2275
 
@@ -2286,7 +2286,7 @@  discard block
 block discarded – undo
2286 2286
 	 */
2287 2287
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
2288 2288
 
2289
-		if( ! $this->is_edit_entry() ) {
2289
+		if ( ! $this->is_edit_entry() ) {
2290 2290
 			return $has_conditional_logic;
2291 2291
 		}
2292 2292
 
@@ -2318,44 +2318,44 @@  discard block
 block discarded – undo
2318 2318
 		 *  2. There are two entries embedded using oEmbed
2319 2319
 		 *  3. One of the entries has just been saved
2320 2320
 		 */
2321
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
2321
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
2322 2322
 
2323 2323
 			$error = true;
2324 2324
 
2325 2325
 		}
2326 2326
 
2327
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
2327
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
2328 2328
 
2329 2329
 			$error = true;
2330 2330
 
2331
-		} elseif( ! $this->verify_nonce() ) {
2331
+		} elseif ( ! $this->verify_nonce() ) {
2332 2332
 
2333 2333
 			/**
2334 2334
 			 * If the Entry is embedded, there may be two entries on the same page.
2335 2335
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
2336 2336
 			 */
2337
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2337
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2338 2338
 				$error = true;
2339 2339
 			} else {
2340
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
2340
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
2341 2341
 			}
2342 2342
 
2343 2343
 		}
2344 2344
 
2345
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2346
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
2345
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2346
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
2347 2347
 		}
2348 2348
 
2349
-		if( $this->entry['status'] === 'trash' ) {
2350
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
2349
+		if ( $this->entry[ 'status' ] === 'trash' ) {
2350
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
2351 2351
 		}
2352 2352
 
2353 2353
 		// No errors; everything's fine here!
2354
-		if( empty( $error ) ) {
2354
+		if ( empty( $error ) ) {
2355 2355
 			return true;
2356 2356
 		}
2357 2357
 
2358
-		if( $echo && $error !== true ) {
2358
+		if ( $echo && $error !== true ) {
2359 2359
 
2360 2360
 	        $error = esc_html( $error );
2361 2361
 
@@ -2363,10 +2363,10 @@  discard block
 block discarded – undo
2363 2363
 	         * @since 1.9
2364 2364
 	         */
2365 2365
 	        if ( ! empty( $this->entry ) ) {
2366
-		        $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;" ) );
2366
+		        $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;" ) );
2367 2367
 	        }
2368 2368
 
2369
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2369
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
2370 2370
 		}
2371 2371
 
2372 2372
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2386,17 +2386,17 @@  discard block
 block discarded – undo
2386 2386
 
2387 2387
 		$error = NULL;
2388 2388
 
2389
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2390
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
2389
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2390
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
2391 2391
 		}
2392 2392
 
2393 2393
 		// No errors; everything's fine here!
2394
-		if( empty( $error ) ) {
2394
+		if ( empty( $error ) ) {
2395 2395
 			return true;
2396 2396
 		}
2397 2397
 
2398
-		if( $echo ) {
2399
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2398
+		if ( $echo ) {
2399
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2400 2400
 		}
2401 2401
 
2402 2402
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2417,14 +2417,14 @@  discard block
 block discarded – undo
2417 2417
 	private function check_user_cap_edit_field( $field ) {
2418 2418
 
2419 2419
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2420
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2420
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2421 2421
 			return true;
2422 2422
 		}
2423 2423
 
2424
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2424
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2425 2425
 
2426
-		if( $field_cap ) {
2427
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2426
+		if ( $field_cap ) {
2427
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2428 2428
 		}
2429 2429
 
2430 2430
 		return false;
@@ -2438,17 +2438,17 @@  discard block
 block discarded – undo
2438 2438
 	public function verify_nonce() {
2439 2439
 
2440 2440
 		// Verify form submitted for editing single
2441
-		if( $this->is_edit_entry_submission() ) {
2441
+		if ( $this->is_edit_entry_submission() ) {
2442 2442
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2443 2443
 		}
2444 2444
 
2445 2445
 		// Verify
2446
-		else if( ! $this->is_edit_entry() ) {
2446
+		else if ( ! $this->is_edit_entry() ) {
2447 2447
 			$valid = false;
2448 2448
 		}
2449 2449
 
2450 2450
 		else {
2451
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2451
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2452 2452
 		}
2453 2453
 
2454 2454
 		/**
@@ -2508,7 +2508,7 @@  discard block
 block discarded – undo
2508 2508
 		 */
2509 2509
 		$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
2510 2510
 
2511
-		return (array) $labels;
2511
+		return (array)$labels;
2512 2512
 	}
2513 2513
 
2514 2514
 } //end class
Please login to merge, or discard this patch.
includes/admin/class-gravityview-support-port.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 	/**
15 15
 	 * @var string The hash key used to generate secure message history
16
-     * @since 2.2.5
16
+	 * @since 2.2.5
17 17
 	 */
18 18
 	const beacon_key = 'lCXlwbQR707kipR+J0MCqcxrhGOHjGF0ldD6yNbGM0w=';
19 19
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			'payment_id'       => '',
111 111
 			'customer_name'    => '',
112 112
 			'customer_email'   => '',
113
-            'price_id'         => '0',
113
+			'price_id'         => '0',
114 114
 		) );
115 115
 
116 116
 		// This is just HTML we don't need.
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 			case 3:
128 128
 				$package = 'All Access';
129 129
 				break;
130
-            case 4:
131
-                $package = 'Lifetime';
132
-                break;
130
+			case 4:
131
+				$package = 'Lifetime';
132
+				break;
133 133
 		}
134 134
 
135 135
 		$current_user = wp_get_current_user();
@@ -159,27 +159,27 @@  discard block
 block discarded – undo
159 159
 		// Help Scout length limit is 200 characters
160 160
 		foreach( $data as $key => $value ) {
161 161
 			if ( ! is_string( $value ) ) {
162
-                continue;
162
+				continue;
163 163
 			}
164
-		    $data[ $key ] = mb_substr( $value, 0, 200 );
165
-        }
164
+			$data[ $key ] = mb_substr( $value, 0, 200 );
165
+		}
166 166
 
167 167
 		$localization_data = array(
168 168
 			'contactEnabled' => (int)GVCommon::has_cap( 'gravityview_contact_support' ),
169 169
 			'data' => $data,
170 170
 			'translation' => $translation,
171
-            'suggest' => array(),
171
+			'suggest' => array(),
172 172
 		);
173 173
 
174 174
 		/**
175
-         * @filter `gravityview/support_port/localization_data` Filter data passed to the Support Port, before localize_script is run
175
+		 * @filter `gravityview/support_port/localization_data` Filter data passed to the Support Port, before localize_script is run
176 176
 		 * @since 2.0
177
-         * @param array $localization_data {
178
-         *   @type int $contactEnabled Can the user contact support?
179
-         *   @type array $data Support/license info
180
-         *   @type array $translation i18n strings
181
-         *   @type array $suggest Article IDs to recommend to the user (per page in the admin
182
-         * }
177
+		 * @param array $localization_data {
178
+		 *   @type int $contactEnabled Can the user contact support?
179
+		 *   @type array $data Support/license info
180
+		 *   @type array $translation i18n strings
181
+		 *   @type array $suggest Article IDs to recommend to the user (per page in the admin
182
+		 * }
183 183
 		 */
184 184
 		$localization_data = apply_filters( 'gravityview/support_port/localization_data', $localization_data );
185 185
 
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * If the user doesn't have the `gravityview_support_port` capability, returns false; then
195 195
 	 * If global setting is "hide", returns false; then
196
-     * If user preference is not set, return global setting; then
197
-     * If user preference is set, return that setting.
196
+	 * If user preference is not set, return global setting; then
197
+	 * If user preference is set, return that setting.
198 198
 	 *
199 199
 	 * @since 1.15
200
-     * @since 1.17.5 Changed behavior to respect global setting
200
+	 * @since 1.17.5 Changed behavior to respect global setting
201 201
 	 *
202 202
 	 * @param int $user Optional. ID of the user to check, defaults to 0 for current user.
203 203
 	 *
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		$global_setting = gravityview()->plugin->settings->get( 'support_port' );
213 213
 
214 214
 		if ( empty( $global_setting ) ) {
215
-            return false;
215
+			return false;
216 216
 		}
217 217
 
218 218
 		// Get the per-user Support Port setting
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 * Modifies the output of profile.php to add GravityView Support preference
249 249
 	 *
250 250
 	 * @since 1.15
251
-     * @since 1.17.5 Only show if global setting is active
251
+	 * @since 1.17.5 Only show if global setting is active
252 252
 	 *
253 253
 	 * @param WP_User $user Current user info
254 254
 	 *
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		$global_setting = gravityview()->plugin->settings->get( 'support_port' );
260 260
 
261 261
 		if ( empty( $global_setting ) ) {
262
-            return;
262
+			return;
263 263
 		}
264 264
 
265 265
 		/**
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function maybe_add_article_to_tooltip( $tooltip = '', $article = array(), $url = '', $atts = '', $css_class = '', $anchor_text = '' ) {
55 55
 
56
-		if ( empty( $article['id'] ) ) {
56
+		if ( empty( $article[ 'id' ] ) ) {
57 57
 			return $tooltip;
58 58
 		}
59 59
 
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 
70 70
 		$css_class .= ' gv_tooltip';
71 71
 
72
-		if ( ! empty( $article['type'] ) ) {
73
-			$atts = sprintf( 'data-beacon-article-%s="%s"', $article['type'], $article['id'] );
72
+		if ( ! empty( $article[ 'type' ] ) ) {
73
+			$atts = sprintf( 'data-beacon-article-%s="%s"', $article[ 'type' ], $article[ 'id' ] );
74 74
 		} else {
75
-			$atts = sprintf( 'data-beacon-article="%s"', $article['id'] );
75
+			$atts = sprintf( 'data-beacon-article="%s"', $article[ 'id' ] );
76 76
 		}
77 77
 
78 78
 		$url = \GV\Utils::get( $article, 'url', '#' );
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 		) );
173 173
 
174 174
 		// This is just HTML we don't need.
175
-		unset( $response['message'] );
175
+		unset( $response[ 'message' ] );
176 176
 
177
-		switch ( intval( $response['price_id'] ) ) {
177
+		switch ( intval( $response[ 'price_id' ] ) ) {
178 178
 			default:
179 179
 			case 1:
180 180
 				$package = 'Core';
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 			'signature'             => hash_hmac( 'sha256', $current_user->user_email, self::beacon_key ),
203 203
 			'affiliate_id'          => gravityview()->plugin->settings->get( 'affiliate_id' ),
204 204
 			'is_super_admin'        => is_super_admin(),
205
-			'license_key'           => $response['license_key'] . ' (' . ucwords( $response['license'] ) . ')',
205
+			'license_key'           => $response[ 'license_key' ] . ' (' . ucwords( $response[ 'license' ] ) . ')',
206 206
 			'license_level'         => $package,
207 207
 			'alt_emails'            => sprintf( 'Admin: %s, GV Support: %s', get_bloginfo( 'admin_email' ), gravityview()->plugin->settings->get( 'support-email' ) ),
208
-			'payment_details'       => $response['customer_name'] . ' ' . $response['customer_email'],
208
+			'payment_details'       => $response[ 'customer_name' ] . ' ' . $response[ 'customer_email' ],
209 209
 			'wordpress_version'     => get_bloginfo( 'version', 'display' ),
210
-			'php_version'           => phpversion() . ' on ' . esc_html( $_SERVER['SERVER_SOFTWARE'] ),
210
+			'php_version'           => phpversion() . ' on ' . esc_html( $_SERVER[ 'SERVER_SOFTWARE' ] ),
211 211
 			'no_conflict_mode'      => empty( $no_conflict_mode ) ? 'Disabled' : 'Enabled',
212 212
 			'gravityview_version'   => \GV\Plugin::$version,
213 213
 			'gravity_forms_version' => GFForms::$version,
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		ob_get_clean();
218 218
 
219 219
 		// Help Scout length limit is 200 characters
220
-		foreach( $data as $key => $value ) {
220
+		foreach ( $data as $key => $value ) {
221 221
 			if ( ! is_string( $value ) ) {
222 222
                 continue;
223 223
 			}
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/sort-filter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,18 +28,18 @@
 block discarded – undo
28 28
 
29 29
 	$sort_fields_input = '<select name="template_settings[sort_field][]" class="gravityview_sort_field" id="gravityview_sort_field_%d">%s</select>';
30 30
 
31
-	if ( is_array( $current_settings['sort_field'] ) ) {
32
-		$primary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'][0] );
33
-		$secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'][1] );
31
+	if ( is_array( $current_settings[ 'sort_field' ] ) ) {
32
+		$primary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ][ 0 ] );
33
+		$secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ][ 1 ] );
34 34
 	} else {
35
-		$primary_sort_fields = $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'] );
35
+		$primary_sort_fields = $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ] );
36 36
 	}
37 37
 
38 38
 	// Splice the sort direction
39 39
 	$_directions = array();
40 40
 	foreach ( (array)\GV\Utils::get( $current_settings, 'sort_direction', array() ) as $i => $direction ) {
41 41
 		if ( ! $i ) {
42
-			$_directions['sort_direction'] = $direction;
42
+			$_directions[ 'sort_direction' ] = $direction;
43 43
 		} else {
44 44
 			$_directions[ sprintf( 'sort_direction_%d', $i + 1 ) ] = $direction;
45 45
 		}
Please login to merge, or discard this patch.
future/includes/class-gv-template-view-table.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 
20 20
 
21 21
 	/**
22
-     * Constructor. Add filters to modify output.
23
-     *
22
+	 * Constructor. Add filters to modify output.
23
+	 *
24 24
 	 * @since 2.0.4
25 25
 	 *
26 26
 	 * @param View $view
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function __construct( View $view, Entry_Collection $entries, Request $request ) {
31 31
 
32
-	    add_filter( 'gravityview/template/field/label', array( __CLASS__, 'add_columns_sort_links' ), 100, 2 );
32
+		add_filter( 'gravityview/template/field/label', array( __CLASS__, 'add_columns_sort_links' ), 100, 2 );
33 33
 
34 34
 		parent::__construct( $view, $entries, $request );
35 35
 	}
36 36
 
37 37
 	/**
38
-     * Add sorting links to HTML columns that support sorting
39
-     *
40
-     * @since 2.0.4
41
-     * @since 2.0.5 Made static
42
-     *
43
-     * @static
44
-     *
38
+	 * Add sorting links to HTML columns that support sorting
39
+	 *
40
+	 * @since 2.0.4
41
+	 * @since 2.0.5 Made static
42
+	 *
43
+	 * @static
44
+	 *
45 45
 	 * @param string $column_label Label for the table column
46 46
 	 * @param \GV\Template_Context $context
47 47
 	 *
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		$sort_columns = $context->view->settings->get( 'sort_columns' );
53 53
 
54 54
 		if ( empty( $sort_columns ) ) {
55
-            return $column_label;
55
+			return $column_label;
56 56
 		}
57 57
 
58 58
 		if ( ! \GravityView_frontend::getInstance()->is_field_sortable( $context->field->ID, $context->view->form->form ) ) {
@@ -102,22 +102,22 @@  discard block
 block discarded – undo
102 102
 		// If we are already sorting by the current field...
103 103
 		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
104 104
 
105
-		    switch( $sorting['direction'] ) {
106
-		        // No sort
107
-                case '':
108
-	                $sort_args[1] = 'asc';
109
-	                $class .= ' gv-icon-caret-up-down';
110
-                    break;
111
-                case 'desc':
112
-	                $sort_args[1] = '';
113
-	                $class .= ' gv-icon-sort-asc';
114
-	                break;
115
-                case 'asc':
116
-                default:
117
-                    $sort_args[1] = 'desc';
118
-                    $class .= ' gv-icon-sort-desc';
119
-                    break;
120
-            }
105
+			switch( $sorting['direction'] ) {
106
+				// No sort
107
+				case '':
108
+					$sort_args[1] = 'asc';
109
+					$class .= ' gv-icon-caret-up-down';
110
+					break;
111
+				case 'desc':
112
+					$sort_args[1] = '';
113
+					$class .= ' gv-icon-sort-asc';
114
+					break;
115
+				case 'asc':
116
+				default:
117
+					$sort_args[1] = 'desc';
118
+					$class .= ' gv-icon-sort-desc';
119
+					break;
120
+			}
121 121
 
122 122
 		} else {
123 123
 			$class .= ' gv-icon-caret-up-down';
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		$url = remove_query_arg( 'sort', $url );
128 128
 		$multisort_url = self::_get_multisort_url( $url, $sort_args, $context->field->ID );
129 129
 
130
-    	$url = add_query_arg( $sort_args[0], $sort_args[1], $url );
130
+		$url = add_query_arg( $sort_args[0], $sort_args[1], $url );
131 131
 
132 132
 		$return = '<a href="'. esc_url_raw( $url ) .'"';
133 133
 
@@ -141,50 +141,50 @@  discard block
 block discarded – undo
141 141
 	}
142 142
 
143 143
 	/**
144
-     * Get the multi-sort URL used in the sorting links
145
-     *
146
-     * @todo Consider moving to Utils?
147
-     *
148
-     * @since 2.3
149
-     *
150
-     * @see add_columns_sort_links
144
+	 * Get the multi-sort URL used in the sorting links
145
+	 *
146
+	 * @todo Consider moving to Utils?
147
+	 *
148
+	 * @since 2.3
149
+	 *
150
+	 * @see add_columns_sort_links
151 151
 	 * @param string $url Single-sort URL
152 152
 	 * @param array $sort_args Single sorting for rules, in [ field_id, dir ] format
153
-     * @param string|int $field_id ID of the current field being displayed
154
-     *
155
-     * @return string Multisort URL, if there are multiple sorts. Otherwise, existing $url
153
+	 * @param string|int $field_id ID of the current field being displayed
154
+	 *
155
+	 * @return string Multisort URL, if there are multiple sorts. Otherwise, existing $url
156 156
 	 */
157 157
 	static public function _get_multisort_url( $url, $sort_args, $field_id ) {
158 158
 
159 159
 		$sorts = Utils::_GET( 'sort' );
160 160
 
161 161
 		if ( ! is_array( $sorts ) ) {
162
-            return $url;
162
+			return $url;
163 163
 		}
164 164
 
165
-        $multisort_url = $url;
165
+		$multisort_url = $url;
166 166
 
167 167
 		// If the field has already been sorted by, add the field to the URL
168
-        if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) {
169
-            if ( count( $keys ) ) {
170
-                $multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url );
171
-                $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url );
172
-            } else {
173
-                $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url );
174
-            }
175
-        }
176
-        // Otherwise, we are just updating the sort order
177
-        else {
178
-
179
-            // Pass empty value to unset
180
-            if( '' === $sort_args[1] ) {
181
-	            unset( $sorts[ $field_id ] );
182
-            } else {
183
-	            $sorts[ $field_id ] = $sort_args[1];
184
-            }
185
-
186
-            $multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url );
187
-        }
168
+		if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) {
169
+			if ( count( $keys ) ) {
170
+				$multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url );
171
+				$multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url );
172
+			} else {
173
+				$multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url );
174
+			}
175
+		}
176
+		// Otherwise, we are just updating the sort order
177
+		else {
178
+
179
+			// Pass empty value to unset
180
+			if( '' === $sort_args[1] ) {
181
+				unset( $sorts[ $field_id ] );
182
+			} else {
183
+				$sorts[ $field_id ] = $sort_args[1];
184
+			}
185
+
186
+			$multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url );
187
+		}
188 188
 
189 189
 		return $multisort_url;
190 190
 	}
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 	}
215 215
 
216 216
 	/**
217
-     * Returns the label for a column, with support for all deprecated filters
218
-     *
219
-     * @since 2.1
220
-     *
217
+	 * Returns the label for a column, with support for all deprecated filters
218
+	 *
219
+	 * @since 2.1
220
+	 *
221 221
 	 * @param \GV\Field $field
222 222
 	 * @param \GV\Template_Context $context
223 223
 	 */
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		$column_label = apply_filters( 'gravityview/template/field/label', $column_label, $context );
241 241
 
242 242
 		return $column_label;
243
-    }
243
+	}
244 244
 
245 245
 	/**
246 246
 	 * Output the entry row.
@@ -309,15 +309,15 @@  discard block
 block discarded – undo
309 309
 				 */
310 310
 				do_action( 'gravityview/template/table/cells/before', $context );
311 311
 
312
-                /**
313
-                 * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells.
314
-                 * @since 1.0.7
312
+				/**
313
+				 * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells.
314
+				 * @since 1.0.7
315 315
 				 * @param \GravityView_View $this Current GravityView_View object
316 316
 				 * @deprecated Use `gravityview/template/table/cells/before`
317
-                 */
318
-                do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() );
317
+				 */
318
+				do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() );
319 319
 
320
-                foreach ( $fields->all() as $field ) {
320
+				foreach ( $fields->all() as $field ) {
321 321
 					if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) {
322 322
 						if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) {
323 323
 							$field = $this->view->unions[ $entry['form_id'] ][ $field->ID ];
@@ -337,13 +337,13 @@  discard block
 block discarded – undo
337 337
 				 */
338 338
 				do_action( 'gravityview/template/table/cells/after', $context );
339 339
 
340
-                /**
341
-                 * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells.
342
-                 * @since 1.0.7
340
+				/**
341
+				 * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells.
342
+				 * @since 1.0.7
343 343
 				 * @param \GravityView_View $this Current GravityView_View object
344 344
 				 * @deprecated Use `gravityview/template/table/cells/after`
345
-                 */
346
-                do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() );
345
+				 */
346
+				do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() );
347 347
 
348 348
 				?>
349 349
 			</tr>
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
 			'value' => $value,
385 385
 			'hide_empty' => false,
386 386
 			'zone_id' => 'directory_table-columns',
387
-            'label' => self::get_field_column_label( $field, $context ),
387
+			'label' => self::get_field_column_label( $field, $context ),
388 388
 			'markup' => '<td id="{{ field_id }}" class="{{ class }}" data-label="{{label_value:data-label}}">{{ value }}</td>',
389
-            'form' => $form,
389
+			'form' => $form,
390 390
 		);
391 391
 
392 392
 		/** Output. */
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
 		do_action( 'gravityview/template/table/body/before', $context );
412 412
 
413 413
 		/**
414
-		* @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows.
415
-		* @deprecated Use `gravityview/template/table/body/before`
416
-		* @since 1.0.7
417
-		* @param \GravityView_View $gravityview_view Current GravityView_View object.
418
-		*/
414
+		 * @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows.
415
+		 * @deprecated Use `gravityview/template/table/body/before`
416
+		 * @since 1.0.7
417
+		 * @param \GravityView_View $gravityview_view Current GravityView_View object.
418
+		 */
419 419
 		do_action( 'gravityview_table_body_before', \GravityView_View::getInstance() /** ugh! */ );
420 420
 	}
421 421
 
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
 		do_action( 'gravityview/template/table/body/after', $context );
438 438
 
439 439
 		/**
440
-		* @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows.
441
-		* @deprecated Use `gravityview/template/table/body/after`
442
-		* @since 1.0.7
443
-		* @param \GravityView_View $gravityview_view Current GravityView_View object.
444
-		*/
440
+		 * @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows.
441
+		 * @deprecated Use `gravityview/template/table/body/after`
442
+		 * @since 1.0.7
443
+		 * @param \GravityView_View $gravityview_view Current GravityView_View object.
444
+		 */
445 445
 		do_action( 'gravityview_table_body_after', \GravityView_View::getInstance() /** ugh! */ );
446 446
 	}
447 447
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -69,22 +69,22 @@  discard block
 block discarded – undo
69 69
 			if ( is_array( $sorts ) ) {
70 70
 				foreach ( (array)$sorts as $key => $direction ) {
71 71
 					if ( $key == $context->field->ID ) {
72
-						$sorting['key'] = $context->field->ID;
73
-						$sorting['direction'] = strtolower( $direction );
72
+						$sorting[ 'key' ] = $context->field->ID;
73
+						$sorting[ 'direction' ] = strtolower( $direction );
74 74
 						break;
75 75
 					}
76 76
 				}
77 77
 			} else {
78 78
 				if ( $sorts == $context->field->ID ) {
79
-					$sorting['key'] = $context->field->ID;
80
-					$sorting['direction'] = strtolower( Utils::_GET( 'dir', '' ) );
79
+					$sorting[ 'key' ] = $context->field->ID;
80
+					$sorting[ 'direction' ] = strtolower( Utils::_GET( 'dir', '' ) );
81 81
 				}
82 82
 			}
83 83
 		} else {
84 84
 			foreach ( (array)$context->view->settings->get( 'sort_field', array() ) as $i => $sort_field ) {
85 85
 				if ( $sort_field == $context->field->ID ) {
86
-					$sorting['key'] = $sort_field;
87
-					$sorting['direction'] = strtolower( Utils::get( $directions, $i, '' ) );
86
+					$sorting[ 'key' ] = $sort_field;
87
+					$sorting[ 'direction' ] = strtolower( Utils::get( $directions, $i, '' ) );
88 88
 					break; // Only get the first sort
89 89
 				}
90 90
 			}
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
 		);
101 101
 
102 102
 		// If we are already sorting by the current field...
103
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
103
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
104 104
 
105
-		    switch( $sorting['direction'] ) {
105
+		    switch ( $sorting[ 'direction' ] ) {
106 106
 		        // No sort
107 107
                 case '':
108
-	                $sort_args[1] = 'asc';
108
+	                $sort_args[ 1 ] = 'asc';
109 109
 	                $class .= ' gv-icon-caret-up-down';
110 110
                     break;
111 111
                 case 'desc':
112
-	                $sort_args[1] = '';
112
+	                $sort_args[ 1 ] = '';
113 113
 	                $class .= ' gv-icon-sort-asc';
114 114
 	                break;
115 115
                 case 'asc':
116 116
                 default:
117
-                    $sort_args[1] = 'desc';
117
+                    $sort_args[ 1 ] = 'desc';
118 118
                     $class .= ' gv-icon-sort-desc';
119 119
                     break;
120 120
             }
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
 		$url = remove_query_arg( 'sort', $url );
128 128
 		$multisort_url = self::_get_multisort_url( $url, $sort_args, $context->field->ID );
129 129
 
130
-    	$url = add_query_arg( $sort_args[0], $sort_args[1], $url );
130
+    	$url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $url );
131 131
 
132
-		$return = '<a href="'. esc_url_raw( $url ) .'"';
132
+		$return = '<a href="' . esc_url_raw( $url ) . '"';
133 133
 
134 134
 		if ( ! empty( $multisort_url ) ) {
135
-			$return .= ' data-multisort-href="'. esc_url_raw( $multisort_url ) . '"';
135
+			$return .= ' data-multisort-href="' . esc_url_raw( $multisort_url ) . '"';
136 136
 		}
137 137
 
138
-		$return .= ' class="'. $class .'" ></a>&nbsp;'. $column_label;
138
+		$return .= ' class="' . $class . '" ></a>&nbsp;' . $column_label;
139 139
 
140 140
 		return $return;
141 141
 	}
@@ -168,19 +168,19 @@  discard block
 block discarded – undo
168 168
         if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) {
169 169
             if ( count( $keys ) ) {
170 170
                 $multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url );
171
-                $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url );
171
+                $multisort_url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $multisort_url );
172 172
             } else {
173
-                $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url );
173
+                $multisort_url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $multisort_url );
174 174
             }
175 175
         }
176 176
         // Otherwise, we are just updating the sort order
177 177
         else {
178 178
 
179 179
             // Pass empty value to unset
180
-            if( '' === $sort_args[1] ) {
180
+            if ( '' === $sort_args[ 1 ] ) {
181 181
 	            unset( $sorts[ $field_id ] );
182 182
             } else {
183
-	            $sorts[ $field_id ] = $sort_args[1];
183
+	            $sorts[ $field_id ] = $sort_args[ 1 ];
184 184
             }
185 185
 
186 186
             $multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url );
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
                 do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() );
319 319
 
320 320
                 foreach ( $fields->all() as $field ) {
321
-					if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) {
322
-						if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) {
323
-							$field = $this->view->unions[ $entry['form_id'] ][ $field->ID ];
321
+					if ( isset( $this->view->unions[ $entry[ 'form_id' ] ] ) ) {
322
+						if ( isset( $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ] ) ) {
323
+							$field = $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ];
324 324
 						} else {
325 325
 							if ( ! $field instanceof Internal_Field ) {
326 326
 								$field = Internal_Field::from_configuration( array( 'id' => 'custom' ) );
Please login to merge, or discard this patch.