Completed
Push — develop ( 44f410...383617 )
by Gennady
17:13
created
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Indentation   +289 added lines, -289 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
-     * 
108
-     * @var int
105
+	 *
106
+	 * @since 2.0.13
107
+	 * 
108
+	 * @var int
109 109
 	 */
110 110
 	public $post_id;
111 111
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function prevent_maybe_process_form() {
178 178
 
179
-	    if( ! $this->is_edit_entry_submission() ) {
179
+		if( ! $this->is_edit_entry_submission() ) {
180 180
 			return;
181 181
 		}
182 182
 
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
 	 * When Edit entry view is requested setup the vars
211 211
 	 */
212 212
 	private function setup_vars() {
213
-        global $post;
213
+		global $post;
214 214
 
215 215
 		$gravityview_view = GravityView_View::getInstance();
216 216
 
217 217
 
218 218
 		$entries = $gravityview_view->getEntries();
219
-	    self::$original_entry = $entries[0];
220
-	    $this->entry = $entries[0];
219
+		self::$original_entry = $entries[0];
220
+		$this->entry = $entries[0];
221 221
 
222 222
 		self::$original_form = $gravityview_view->getForm();
223 223
 		$this->form = $gravityview_view->getForm();
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
 
360 360
 			GFFormsModel::save_lead( $form, $this->entry );
361 361
 
362
-	        // Delete the values for hidden inputs
363
-	        $this->unset_hidden_field_values();
362
+			// Delete the values for hidden inputs
363
+			$this->unset_hidden_field_values();
364 364
 			
365 365
 			$this->entry['date_created'] = $date_created;
366 366
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			// Perform actions normally performed after updating a lead
371 371
 			$this->after_update();
372 372
 
373
-	        /**
373
+			/**
374 374
 			 * Must be AFTER after_update()!
375 375
 			 * @see https://github.com/gravityview/GravityView/issues/764
376 376
 			 */
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 
379 379
 			/**
380 380
 			 * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry
381
-             * @since 2.1 Added $gv_data parameter
381
+			 * @since 2.1 Added $gv_data parameter
382 382
 			 * @param array $form Gravity Forms form array
383 383
 			 * @param string $entry_id Numeric ID of the entry that was updated
384 384
 			 * @param GravityView_Edit_Entry_Render $this This object
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	 * @return void
403 403
 	 */
404 404
 	private function unset_hidden_field_values() {
405
-	    global $wpdb;
405
+		global $wpdb;
406 406
 
407 407
 		/**
408 408
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -426,17 +426,17 @@  discard block
 block discarded – undo
426 426
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
427 427
 		}
428 428
 
429
-	    foreach ( $this->entry as $input_id => $field_value ) {
429
+		foreach ( $this->entry as $input_id => $field_value ) {
430 430
 
431 431
 			if ( ! is_numeric( $input_id ) ) {
432 432
 				continue;
433 433
 			}
434 434
 
435
-		    $field = RGFormsModel::get_field( $this->form, $input_id );
435
+			$field = RGFormsModel::get_field( $this->form, $input_id );
436 436
 
437
-		    // Reset fields that are hidden
438
-		    // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
439
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
437
+			// Reset fields that are hidden
438
+			// Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
439
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
440 440
 
441 441
 				$empty_value = $field->get_value_save_entry(
442 442
 					is_array( $field->get_entry_inputs() ) ? array() : '',
@@ -448,16 +448,16 @@  discard block
 block discarded – undo
448 448
 					$empty_value = '';
449 449
 				}
450 450
 
451
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
451
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
452 452
 
453
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
453
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
454 454
 
455
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
455
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
456 456
 				// after submission
457
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
458
-			    $_POST[ $post_input_id ] = '';
459
-		    }
460
-	    }
457
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
458
+				$_POST[ $post_input_id ] = '';
459
+			}
460
+		}
461 461
 	}
462 462
 
463 463
 	/**
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 
552 552
 		$form = $this->filter_conditional_logic( $this->form );
553 553
 
554
-	    /** @var GF_Field $field */
554
+		/** @var GF_Field $field */
555 555
 		foreach( $form['fields'] as $k => &$field ) {
556 556
 
557 557
 			/**
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 
568 568
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
569 569
 				foreach( $field->inputs as $key => $input ) {
570
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
570
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
571 571
 				}
572 572
 			}
573 573
 		}
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 
608 608
 				$inputs = $field->get_entry_inputs();
609 609
 				if ( is_array( $inputs ) ) {
610
-				    foreach ( $inputs as $input ) {
610
+					foreach ( $inputs as $input ) {
611 611
 						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
612 612
 
613 613
 						if ( 'product' === $field->type ) {
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 						}
627 627
 
628 628
 						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
629
-				    }
629
+					}
630 630
 				} else {
631 631
 					// Set to what it previously was if it's not editable
632 632
 					if ( ! in_array( $field->id, $allowed_fields ) ) {
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
673 673
 
674 674
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
675
-	        $ary = stripslashes_deep( $ary );
675
+			$ary = stripslashes_deep( $ary );
676 676
 			$img_url = \GV\Utils::get( $ary, 0 );
677 677
 
678 678
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	private function maybe_update_post_fields( $form ) {
746 746
 
747 747
 		if( empty( $this->entry['post_id'] ) ) {
748
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
748
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
749 749
 			return;
750 750
 		}
751 751
 
@@ -780,49 +780,49 @@  discard block
 block discarded – undo
780 780
 
781 781
 				switch( $field->type ) {
782 782
 
783
-				    case 'post_title':
784
-				        $post_title = $value;
785
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
786
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
787
-				        }
788
-				        $updated_post->post_title = $post_title;
789
-				        $updated_post->post_name  = $post_title;
790
-				        unset( $post_title );
791
-				        break;
792
-
793
-				    case 'post_content':
794
-				        $post_content = $value;
795
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
796
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
797
-				        }
798
-				        $updated_post->post_content = $post_content;
799
-				        unset( $post_content );
800
-				        break;
801
-				    case 'post_excerpt':
802
-				        $updated_post->post_excerpt = $value;
803
-				        break;
804
-				    case 'post_tags':
805
-				        wp_set_post_tags( $post_id, $value, false );
806
-				        break;
807
-				    case 'post_category':
808
-				        break;
809
-				    case 'post_custom_field':
783
+					case 'post_title':
784
+						$post_title = $value;
785
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
786
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
787
+						}
788
+						$updated_post->post_title = $post_title;
789
+						$updated_post->post_name  = $post_title;
790
+						unset( $post_title );
791
+						break;
792
+
793
+					case 'post_content':
794
+						$post_content = $value;
795
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
796
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
797
+						}
798
+						$updated_post->post_content = $post_content;
799
+						unset( $post_content );
800
+						break;
801
+					case 'post_excerpt':
802
+						$updated_post->post_excerpt = $value;
803
+						break;
804
+					case 'post_tags':
805
+						wp_set_post_tags( $post_id, $value, false );
806
+						break;
807
+					case 'post_category':
808
+						break;
809
+					case 'post_custom_field':
810 810
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
811 811
 							$value = $value[ $field_id ];
812 812
 						}
813 813
 
814
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
815
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
816
-				        }
814
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
815
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
816
+						}
817 817
 
818 818
 						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
819 819
 
820
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
821
-				        break;
820
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
821
+						break;
822 822
 
823
-				    case 'post_image':
824
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
825
-				        break;
823
+					case 'post_image':
824
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
825
+						break;
826 826
 
827 827
 				}
828 828
 
@@ -979,14 +979,14 @@  discard block
 block discarded – undo
979 979
 			?><h2 class="gv-edit-entry-title">
980 980
 				<span><?php
981 981
 
982
-				    /**
983
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
984
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
985
-				     * @param GravityView_Edit_Entry_Render $this This object
986
-				     */
987
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
982
+					/**
983
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
984
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
985
+					 * @param GravityView_Edit_Entry_Render $this This object
986
+					 */
987
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
988 988
 
989
-				    echo esc_attr( $edit_entry_title );
989
+					echo esc_attr( $edit_entry_title );
990 990
 			?></span>
991 991
 			</h2>
992 992
 
@@ -1049,26 +1049,26 @@  discard block
 block discarded – undo
1049 1049
 
1050 1050
 				switch ( $edit_redirect ) {
1051 1051
 
1052
-                    case '0':
1053
-	                    $redirect_url = $back_link;
1054
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1055
-                        break;
1056
-
1057
-                    case '1':
1058
-	                    $redirect_url = $directory_link = GravityView_API::directory_link();
1059
-	                    $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>' );
1060
-	                    break;
1061
-
1062
-                    case '2':
1063
-	                    $redirect_url = $edit_redirect_url;
1064
-	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1065
-	                    $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>' );
1066
-                        break;
1067
-
1068
-                    case '':
1069
-                    default:
1070
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1071
-                        break;
1052
+					case '0':
1053
+						$redirect_url = $back_link;
1054
+						$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1055
+						break;
1056
+
1057
+					case '1':
1058
+						$redirect_url = $directory_link = GravityView_API::directory_link();
1059
+						$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>' );
1060
+						break;
1061
+
1062
+					case '2':
1063
+						$redirect_url = $edit_redirect_url;
1064
+						$redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1065
+						$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>' );
1066
+						break;
1067
+
1068
+					case '':
1069
+					default:
1070
+						$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1071
+						break;
1072 1072
 				}
1073 1073
 
1074 1074
 				if ( isset( $redirect_url ) ) {
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 
1126 1126
 		ob_get_clean();
1127 1127
 
1128
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1128
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1129 1129
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1130 1130
 		remove_filter( 'gform_disable_view_counter', '__return_true' );
1131 1131
 		remove_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5 );
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
 
1180 1180
 		// for now we don't support Save and Continue feature.
1181 1181
 		if( ! self::$supports_save_and_continue ) {
1182
-	        unset( $form['save'] );
1182
+			unset( $form['save'] );
1183 1183
 		}
1184 1184
 
1185 1185
 		$form = $this->unselect_default_values( $form );
@@ -1206,30 +1206,30 @@  discard block
 block discarded – undo
1206 1206
 			return $field_content;
1207 1207
 		}
1208 1208
 
1209
-        $message = null;
1209
+		$message = null;
1210 1210
 
1211
-        // First, make sure they have the capability to edit the post.
1212
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1211
+		// First, make sure they have the capability to edit the post.
1212
+		if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1213 1213
 
1214
-            /**
1215
-             * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1216
-             * @param string $message The existing "You don't have permission..." text
1217
-             */
1218
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1214
+			/**
1215
+			 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1216
+			 * @param string $message The existing "You don't have permission..." text
1217
+			 */
1218
+			$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1219 1219
 
1220
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1221
-            /**
1222
-             * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1223
-             * @param string $message The existing "This field is not editable; the post no longer exists." text
1224
-             */
1225
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1226
-        }
1220
+		} elseif( null === get_post( $this->entry['post_id'] ) ) {
1221
+			/**
1222
+			 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1223
+			 * @param string $message The existing "This field is not editable; the post no longer exists." text
1224
+			 */
1225
+			$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1226
+		}
1227 1227
 
1228
-        if( $message ) {
1229
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1230
-        }
1228
+		if( $message ) {
1229
+			$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1230
+		}
1231 1231
 
1232
-        return $field_content;
1232
+		return $field_content;
1233 1233
 	}
1234 1234
 
1235 1235
 	/**
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 			|| ! empty( $field_content )
1258 1258
 			|| in_array( $field->type, array( 'honeypot' ) )
1259 1259
 		) {
1260
-	        return $field_content;
1260
+			return $field_content;
1261 1261
 		}
1262 1262
 
1263 1263
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1265,24 +1265,24 @@  discard block
 block discarded – undo
1265 1265
 
1266 1266
 		$field_value = $this->get_field_value( $field );
1267 1267
 
1268
-	    // Prevent any PHP warnings, like undefined index
1269
-	    ob_start();
1268
+		// Prevent any PHP warnings, like undefined index
1269
+		ob_start();
1270 1270
 
1271
-	    $return = null;
1271
+		$return = null;
1272 1272
 
1273 1273
 		/** @var GravityView_Field $gv_field */
1274 1274
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1275 1275
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1276 1276
 		} else {
1277
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1278
-	    }
1277
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1278
+		}
1279 1279
 
1280
-	    // If there was output, it's an error
1281
-	    $warnings = ob_get_clean();
1280
+		// If there was output, it's an error
1281
+		$warnings = ob_get_clean();
1282 1282
 
1283
-	    if( !empty( $warnings ) ) {
1284
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1285
-	    }
1283
+		if( !empty( $warnings ) ) {
1284
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1285
+		}
1286 1286
 
1287 1287
 		return $return;
1288 1288
 	}
@@ -1317,8 +1317,8 @@  discard block
 block discarded – undo
1317 1317
 				$input_id = strval( $input['id'] );
1318 1318
 
1319 1319
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1320
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1321
-				    $allow_pre_populated = false;
1320
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1321
+					$allow_pre_populated = false;
1322 1322
 				}
1323 1323
 
1324 1324
 			}
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1343 1343
 				$categories = array();
1344 1344
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1345
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1345
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1346 1346
 				}
1347 1347
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1348 1348
 			}
@@ -1352,25 +1352,25 @@  discard block
 block discarded – undo
1352 1352
 		// if value is empty get the default value if defined
1353 1353
 		$field_value = $field->get_value_default_if_empty( $field_value );
1354 1354
 
1355
-	    /**
1356
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1357
-	     * @since 1.11
1358
-	     * @since 1.20 Added third param
1359
-	     * @param mixed $field_value field value used to populate the input
1360
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1361
-	     * @param GravityView_Edit_Entry_Render $this Current object
1362
-	     */
1363
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1364
-
1365
-	    /**
1366
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1367
-	     * @since 1.17
1368
-	     * @since 1.20 Added third param
1369
-	     * @param mixed $field_value field value used to populate the input
1370
-	     * @param GF_Field $field Gravity Forms field object
1371
-	     * @param GravityView_Edit_Entry_Render $this Current object
1372
-	     */
1373
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1355
+		/**
1356
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1357
+		 * @since 1.11
1358
+		 * @since 1.20 Added third param
1359
+		 * @param mixed $field_value field value used to populate the input
1360
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1361
+		 * @param GravityView_Edit_Entry_Render $this Current object
1362
+		 */
1363
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1364
+
1365
+		/**
1366
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1367
+		 * @since 1.17
1368
+		 * @since 1.20 Added third param
1369
+		 * @param mixed $field_value field value used to populate the input
1370
+		 * @param GF_Field $field Gravity Forms field object
1371
+		 * @param GravityView_Edit_Entry_Render $this Current object
1372
+		 */
1373
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1374 1374
 
1375 1375
 		return $field_value;
1376 1376
 	}
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1398 1398
 			// expects certain field array items to be set.
1399 1399
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1400
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1400
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1401 1401
 			}
1402 1402
 
1403 1403
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1411,61 +1411,61 @@  discard block
 block discarded – undo
1411 1411
 				 */
1412 1412
 				case 'fileupload':
1413 1413
 
1414
-				    // Set the previous value
1415
-				    $entry = $this->get_entry();
1414
+					// Set the previous value
1415
+					$entry = $this->get_entry();
1416 1416
 
1417
-				    $input_name = 'input_'.$field->id;
1418
-				    $form_id = $form['id'];
1417
+					$input_name = 'input_'.$field->id;
1418
+					$form_id = $form['id'];
1419 1419
 
1420
-				    $value = NULL;
1420
+					$value = NULL;
1421 1421
 
1422
-				    // Use the previous entry value as the default.
1423
-				    if( isset( $entry[ $field->id ] ) ) {
1424
-				        $value = $entry[ $field->id ];
1425
-				    }
1422
+					// Use the previous entry value as the default.
1423
+					if( isset( $entry[ $field->id ] ) ) {
1424
+						$value = $entry[ $field->id ];
1425
+					}
1426 1426
 
1427
-				    // If this is a single upload file
1428
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1429
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1430
-				        $value = $file_path['url'];
1427
+					// If this is a single upload file
1428
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1429
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1430
+						$value = $file_path['url'];
1431 1431
 
1432
-				    } else {
1432
+					} else {
1433 1433
 
1434
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1435
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1436
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1434
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1435
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1436
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1437 1437
 
1438
-				    }
1438
+					}
1439 1439
 
1440
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1440
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1441 1441
 
1442
-				        // If there are fresh uploads, process and merge them.
1443
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1444
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1445
-				            $value = empty( $value ) ? '[]' : $value;
1446
-				            $value = stripslashes_deep( $value );
1447
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1448
-				        }
1442
+						// If there are fresh uploads, process and merge them.
1443
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1444
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1445
+							$value = empty( $value ) ? '[]' : $value;
1446
+							$value = stripslashes_deep( $value );
1447
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1448
+						}
1449 1449
 
1450
-				    } else {
1450
+					} else {
1451 1451
 
1452
-				        // A file already exists when editing an entry
1453
-				        // We set this to solve issue when file upload fields are required.
1454
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1452
+						// A file already exists when editing an entry
1453
+						// We set this to solve issue when file upload fields are required.
1454
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1455 1455
 
1456
-				    }
1456
+					}
1457 1457
 
1458
-				    $this->entry[ $input_name ] = $value;
1459
-				    $_POST[ $input_name ] = $value;
1458
+					$this->entry[ $input_name ] = $value;
1459
+					$_POST[ $input_name ] = $value;
1460 1460
 
1461
-				    break;
1461
+					break;
1462 1462
 
1463 1463
 				case 'number':
1464
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1465
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1466
-				        $_POST['input_'.$field->id ] = NULL;
1467
-				    }
1468
-				    break;
1464
+					// Fix "undefined index" issue at line 1286 in form_display.php
1465
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1466
+						$_POST['input_'.$field->id ] = NULL;
1467
+					}
1468
+					break;
1469 1469
 			}
1470 1470
 
1471 1471
 		}
@@ -1550,43 +1550,43 @@  discard block
 block discarded – undo
1550 1550
 				case 'fileupload' :
1551 1551
 				case 'post_image':
1552 1552
 
1553
-				    // in case nothing is uploaded but there are already files saved
1554
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1555
-				        $field->failed_validation = false;
1556
-				        unset( $field->validation_message );
1557
-				    }
1553
+					// in case nothing is uploaded but there are already files saved
1554
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1555
+						$field->failed_validation = false;
1556
+						unset( $field->validation_message );
1557
+					}
1558 1558
 
1559
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1560
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1559
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1560
+					if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1561 1561
 
1562
-				        $input_name = 'input_' . $field->id;
1563
-				        //uploaded
1564
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1562
+						$input_name = 'input_' . $field->id;
1563
+						//uploaded
1564
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1565 1565
 
1566
-				        //existent
1567
-				        $entry = $this->get_entry();
1568
-				        $value = NULL;
1569
-				        if( isset( $entry[ $field->id ] ) ) {
1570
-				            $value = json_decode( $entry[ $field->id ], true );
1571
-				        }
1566
+						//existent
1567
+						$entry = $this->get_entry();
1568
+						$value = NULL;
1569
+						if( isset( $entry[ $field->id ] ) ) {
1570
+							$value = json_decode( $entry[ $field->id ], true );
1571
+						}
1572 1572
 
1573
-				        // count uploaded files and existent entry files
1574
-				        $count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1575
-						               ( is_array( $value ) ? count( $value ) : 0 );
1573
+						// count uploaded files and existent entry files
1574
+						$count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1575
+									   ( is_array( $value ) ? count( $value ) : 0 );
1576 1576
 
1577
-				        if( $count_files > $field->maxFiles ) {
1578
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1579
-				            $field->failed_validation = 1;
1580
-				            $gv_valid = false;
1577
+						if( $count_files > $field->maxFiles ) {
1578
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1579
+							$field->failed_validation = 1;
1580
+							$gv_valid = false;
1581 1581
 
1582
-				            // in case of error make sure the newest upload files are removed from the upload input
1583
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1584
-				        }
1582
+							// in case of error make sure the newest upload files are removed from the upload input
1583
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1584
+						}
1585 1585
 
1586
-				    }
1586
+					}
1587 1587
 
1588 1588
 
1589
-				    break;
1589
+					break;
1590 1590
 
1591 1591
 			}
1592 1592
 
@@ -1597,47 +1597,47 @@  discard block
 block discarded – undo
1597 1597
 
1598 1598
 				switch ( $field_type ) {
1599 1599
 
1600
-				    // Captchas don't need to be re-entered.
1601
-				    case 'captcha':
1600
+					// Captchas don't need to be re-entered.
1601
+					case 'captcha':
1602 1602
 
1603
-				        // Post Image fields aren't editable, so we un-fail them.
1604
-				    case 'post_image':
1605
-				        $field->failed_validation = false;
1606
-				        unset( $field->validation_message );
1607
-				        break;
1603
+						// Post Image fields aren't editable, so we un-fail them.
1604
+					case 'post_image':
1605
+						$field->failed_validation = false;
1606
+						unset( $field->validation_message );
1607
+						break;
1608 1608
 
1609 1609
 				}
1610 1610
 
1611 1611
 				// You can't continue inside a switch, so we do it after.
1612 1612
 				if( empty( $field->failed_validation ) ) {
1613
-				    continue;
1613
+					continue;
1614 1614
 				}
1615 1615
 
1616 1616
 				// checks if the No Duplicates option is not validating entry against itself, since
1617 1617
 				// we're editing a stored entry, it would also assume it's a duplicate.
1618 1618
 				if( !empty( $field->noDuplicates ) ) {
1619 1619
 
1620
-				    $entry = $this->get_entry();
1620
+					$entry = $this->get_entry();
1621 1621
 
1622
-				    // If the value of the entry is the same as the stored value
1623
-				    // Then we can assume it's not a duplicate, it's the same.
1624
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1625
-				        //if value submitted was not changed, then don't validate
1626
-				        $field->failed_validation = false;
1622
+					// If the value of the entry is the same as the stored value
1623
+					// Then we can assume it's not a duplicate, it's the same.
1624
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1625
+						//if value submitted was not changed, then don't validate
1626
+						$field->failed_validation = false;
1627 1627
 
1628
-				        unset( $field->validation_message );
1628
+						unset( $field->validation_message );
1629 1629
 
1630
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1630
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1631 1631
 
1632
-				        continue;
1633
-				    }
1632
+						continue;
1633
+					}
1634 1634
 				}
1635 1635
 
1636 1636
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1637 1637
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1638
-				    unset( $field->validation_message );
1639
-	                $field->validation_message = false;
1640
-				    continue;
1638
+					unset( $field->validation_message );
1639
+					$field->validation_message = false;
1640
+					continue;
1641 1641
 				}
1642 1642
 
1643 1643
 				$gv_valid = false;
@@ -1701,8 +1701,8 @@  discard block
 block discarded – undo
1701 1701
 		// Hide fields depending on admin settings
1702 1702
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1703 1703
 
1704
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1705
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1704
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1705
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1706 1706
 
1707 1707
 		/**
1708 1708
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1777,11 +1777,11 @@  discard block
 block discarded – undo
1777 1777
 		// The edit tab has been configured, so we loop through to configured settings
1778 1778
 		foreach ( $configured_fields as $configured_field ) {
1779 1779
 
1780
-	        /** @var GF_Field $field */
1781
-	        foreach ( $fields as $field ) {
1780
+			/** @var GF_Field $field */
1781
+			foreach ( $fields as $field ) {
1782 1782
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1783
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1784
-				    break;
1783
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1784
+					break;
1785 1785
 				}
1786 1786
 
1787 1787
 			}
@@ -1837,28 +1837,28 @@  discard block
 block discarded – undo
1837 1837
 	 */
1838 1838
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
1839 1839
 
1840
-	    /**
1840
+		/**
1841 1841
 		 * @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
1842
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1843
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1844
-	     * @since 1.9.1
1845
-	     * @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.
1846
-	     * @param array $form GF Form array
1847
-	     * @param int $view_id View ID
1848
-	     */
1849
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1850
-
1851
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1842
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1843
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1844
+		 * @since 1.9.1
1845
+		 * @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.
1846
+		 * @param array $form GF Form array
1847
+		 * @param int $view_id View ID
1848
+		 */
1849
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1850
+
1851
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1852 1852
 			foreach( $fields as $k => $field ) {
1853 1853
 				if( $field->adminOnly ) {
1854
-				    unset( $fields[ $k ] );
1854
+					unset( $fields[ $k ] );
1855 1855
 				}
1856 1856
 			}
1857 1857
 			return array_values( $fields );
1858 1858
 		}
1859 1859
 
1860
-	    foreach( $fields as &$field ) {
1861
-		    $field->adminOnly = false;
1860
+		foreach( $fields as &$field ) {
1861
+			$field->adminOnly = false;
1862 1862
 		}
1863 1863
 
1864 1864
 		return $fields;
@@ -1878,13 +1878,13 @@  discard block
 block discarded – undo
1878 1878
 	 */
1879 1879
 	private function unselect_default_values( $form ) {
1880 1880
 
1881
-	    foreach ( $form['fields'] as &$field ) {
1881
+		foreach ( $form['fields'] as &$field ) {
1882 1882
 
1883 1883
 			if ( empty( $field->choices ) ) {
1884
-                continue;
1884
+				continue;
1885 1885
 			}
1886 1886
 
1887
-            foreach ( $field->choices as &$choice ) {
1887
+			foreach ( $field->choices as &$choice ) {
1888 1888
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1889 1889
 					$choice['isSelected'] = false;
1890 1890
 				}
@@ -1921,36 +1921,36 @@  discard block
 block discarded – undo
1921 1921
 
1922 1922
 			if( 'checkbox' === $field->type ) {
1923 1923
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1924
-				    $input_id = $input['id'];
1925
-				    $choice = $field->choices[ $key ];
1926
-				    $value = \GV\Utils::get( $this->entry, $input_id );
1927
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1928
-				    if( $match ) {
1929
-				        $field->choices[ $key ]['isSelected'] = true;
1930
-				    }
1924
+					$input_id = $input['id'];
1925
+					$choice = $field->choices[ $key ];
1926
+					$value = \GV\Utils::get( $this->entry, $input_id );
1927
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1928
+					if( $match ) {
1929
+						$field->choices[ $key ]['isSelected'] = true;
1930
+					}
1931 1931
 				}
1932 1932
 			} else {
1933 1933
 
1934 1934
 				// We need to run through each field to set the default values
1935 1935
 				foreach ( $this->entry as $field_id => $field_value ) {
1936 1936
 
1937
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1937
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
1938 1938
 
1939
-				        if( 'list' === $field->type ) {
1940
-				            $list_rows = maybe_unserialize( $field_value );
1939
+						if( 'list' === $field->type ) {
1940
+							$list_rows = maybe_unserialize( $field_value );
1941 1941
 
1942
-				            $list_field_value = array();
1943
-				            foreach ( (array) $list_rows as $row ) {
1944
-				                foreach ( (array) $row as $column ) {
1945
-				                    $list_field_value[] = $column;
1946
-				                }
1947
-				            }
1942
+							$list_field_value = array();
1943
+							foreach ( (array) $list_rows as $row ) {
1944
+								foreach ( (array) $row as $column ) {
1945
+									$list_field_value[] = $column;
1946
+								}
1947
+							}
1948 1948
 
1949
-				            $field->defaultValue = serialize( $list_field_value );
1950
-				        } else {
1951
-				            $field->defaultValue = $field_value;
1952
-				        }
1953
-				    }
1949
+							$field->defaultValue = serialize( $list_field_value );
1950
+						} else {
1951
+							$field->defaultValue = $field_value;
1952
+						}
1953
+					}
1954 1954
 				}
1955 1955
 			}
1956 1956
 		}
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
 			foreach ( $form['fields'] as &$field ) {
2012 2012
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2013 2013
 
2014
-				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2014
+					list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2015 2015
 
2016 2016
 					if ( $field['id'] == $rule_field_id ) {
2017 2017
 						unset( $field->conditionalLogic['rules'][ $rule_i ] );
@@ -2062,7 +2062,7 @@  discard block
 block discarded – undo
2062 2062
 			return $has_conditional_logic;
2063 2063
 		}
2064 2064
 
2065
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2065
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2066 2066
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
2067 2067
 	}
2068 2068
 
@@ -2129,14 +2129,14 @@  discard block
 block discarded – undo
2129 2129
 
2130 2130
 		if( $echo && $error !== true ) {
2131 2131
 
2132
-	        $error = esc_html( $error );
2132
+			$error = esc_html( $error );
2133 2133
 
2134
-	        /**
2135
-	         * @since 1.9
2136
-	         */
2137
-	        if ( ! empty( $this->entry ) ) {
2138
-		        $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;" ) );
2139
-	        }
2134
+			/**
2135
+			 * @since 1.9
2136
+			 */
2137
+			if ( ! empty( $this->entry ) ) {
2138
+				$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;" ) );
2139
+			}
2140 2140
 
2141 2141
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2142 2142
 		}
Please login to merge, or discard this patch.