Completed
Push — develop ( d59912...bac1d6 )
by Zack
19:26
created
includes/fields/class-gravityview-field-total.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return array Blocklist, with "total" added. If not edit context, original field blocklist. Otherwise, blocklist including total.
54 54
 	 */
55
-	public function add_to_blocklist( $blocklist = array(), $context = NULL  ){
55
+	public function add_to_blocklist( $blocklist = array(), $context = NULL ) {
56 56
 
57
-		if( empty( $context ) || $context !== 'edit' ) {
57
+		if ( empty( $context ) || $context !== 'edit' ) {
58 58
 			return $blocklist;
59 59
 		}
60 60
 
61
-		$blocklist[] = 'total';
61
+		$blocklist[ ] = 'total';
62 62
 
63 63
 		return $blocklist;
64 64
 	}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	function edit_entry_recalculate_totals( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) {
78 78
 
79
-		$original_form = GFAPI::get_form( $form['id'] );
79
+		$original_form = GFAPI::get_form( $form[ 'id' ] );
80 80
 
81 81
 		$total_fields = GFCommon::get_fields_by_type( $original_form, 'total' );
82 82
 
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 
88 88
 			/** @type GF_Field_Total $total_field */
89 89
 			foreach ( $total_fields as $total_field ) {
90
-				$entry["{$total_field->id}"] = GFCommon::get_order_total( $original_form, $entry );
90
+				$entry[ "{$total_field->id}" ] = GFCommon::get_order_total( $original_form, $entry );
91 91
 			}
92 92
 
93 93
 			$return_entry = GFAPI::update_entry( $entry );
94 94
 
95
-			if( is_wp_error( $return_entry ) ) {
95
+			if ( is_wp_error( $return_entry ) ) {
96 96
 				gravityview()->log->error( 'Updating the entry total fields failed', array( 'data' => $return_entry ) );
97 97
 			} else {
98 98
 				gravityview()->log->debug( 'Updating the entry total fields succeeded' );
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 	 *
53 53
 	 * @return array Blocklist, with "total" added. If not edit context, original field blocklist. Otherwise, blocklist including total.
54 54
 	 */
55
-	public function add_to_blocklist( $blocklist = array(), $context = NULL  ){
55
+	public function add_to_blocklist( $blocklist = array(), $context = NULL  ) {
56 56
 
57 57
 		if( empty( $context ) || $context !== 'edit' ) {
58 58
 			return $blocklist;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-calculation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@
 block discarded – undo
49 49
 	public function blocklist_field_types( $field_types = array(), $context = '' ) {
50 50
 
51 51
 		// Allow Calculation field in Edit Entry
52
-		if( 'edit' !== $context ) {
53
-			$field_types[] = $this->name;
52
+		if ( 'edit' !== $context ) {
53
+			$field_types[ ] = $this->name;
54 54
 		}
55 55
 
56 56
 		return $field_types;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -143,17 +143,17 @@  discard block
 block discarded – undo
143 143
 
144 144
 		add_filter( 'gravityview/sortable/field_blocklist', array( $this, '_filter_sortable_fields' ), 1 );
145 145
 
146
-		if( $this->entry_meta_key ) {
146
+		if ( $this->entry_meta_key ) {
147 147
 			add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) );
148 148
 			add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 );
149 149
 		}
150 150
 
151
-		if( $this->_custom_merge_tag ) {
151
+		if ( $this->_custom_merge_tag ) {
152 152
 			add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 );
153 153
 			add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 );
154 154
 		}
155 155
 
156
-		if( 'meta' === $this->group || '' !== $this->default_search_label ) {
156
+		if ( 'meta' === $this->group || '' !== $this->default_search_label ) {
157 157
 			add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 );
158 158
 		}
159 159
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		 * Auto-assign label from Gravity Forms label, if exists
162 162
 		 * @since 1.20
163 163
 		 */
164
-		if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
164
+		if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
165 165
 			$this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() );
166 166
 		}
167 167
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 			'type'  => $this->name
208 208
 		);
209 209
 
210
-		$fields["{$this->entry_meta_key}"] = $added_field;
210
+		$fields[ "{$this->entry_meta_key}" ] = $added_field;
211 211
 
212 212
 		return $fields;
213 213
 	}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 */
228 228
 	function set_default_search_label( $label = '', $gf_field = null, $field = array() ) {
229 229
 
230
-		if( $this->name === $field['field'] && '' === $label ) {
230
+		if ( $this->name === $field[ 'field' ] && '' === $label ) {
231 231
 			$label = esc_html( $this->default_search_label );
232 232
 		}
233 233
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
250 250
 	 */
251
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
251
+	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
252 252
 
253 253
 		// Is there is field merge tag? Strip whitespace off the ned, too.
254 254
 		preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER );
@@ -281,19 +281,19 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
283 283
 
284
-		foreach( $matches as $match ) {
284
+		foreach ( $matches as $match ) {
285 285
 
286
-			$full_tag = $match[0];
286
+			$full_tag = $match[ 0 ];
287 287
 
288 288
 			// Strip the Merge Tags
289
-			$tag = str_replace( array( '{', '}'), '', $full_tag );
289
+			$tag = str_replace( array( '{', '}' ), '', $full_tag );
290 290
 
291 291
 			// Replace the value from the entry, if exists
292
-			if( isset( $entry[ $tag ] ) ) {
292
+			if ( isset( $entry[ $tag ] ) ) {
293 293
 
294 294
 				$value = $entry[ $tag ];
295 295
 
296
-				if( is_callable( array( $this, 'get_content') ) ) {
296
+				if ( is_callable( array( $this, 'get_content' ) ) ) {
297 297
 					$value = $this->get_content( $value );
298 298
 				}
299 299
 
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	public function _filter_sortable_fields( $not_sortable ) {
368 368
 
369
-		if( ! $this->is_sortable ) {
370
-			$not_sortable[] = $this->name;
369
+		if ( ! $this->is_sortable ) {
370
+			$not_sortable[ ] = $this->name;
371 371
 		}
372 372
 
373 373
 		return $not_sortable;
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	 */
385 385
 	function add_entry_meta( $entry_meta ) {
386 386
 
387
-		if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) {
387
+		if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) {
388 388
 
389 389
 			$added_meta = array(
390 390
 				'label'             => $this->label,
@@ -393,13 +393,13 @@  discard block
 block discarded – undo
393 393
 			);
394 394
 
395 395
 			if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) {
396
-				$added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback;
396
+				$added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback;
397 397
 			}
398 398
 
399
-			$entry_meta["{$this->entry_meta_key}"] = $added_meta;
399
+			$entry_meta[ "{$this->entry_meta_key}" ] = $added_meta;
400 400
 
401 401
 		} else {
402
-			gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' =>  $entry_meta["{$this->entry_meta_key}"] ) );
402
+			gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' =>  $entry_meta[ "{$this->entry_meta_key}" ] ) );
403 403
 		}
404 404
 
405 405
 		return $entry_meta;
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 			'date_display' => array(
435 435
 				'type' => 'text',
436 436
 				'label' => __( 'Override Date Format', 'gravityview' ),
437
-				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ),
437
+				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://wordpress.org/support/article/formatting-date-and-time/" rel="external">', '</a>' ),
438 438
 				/**
439 439
 				 * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time)
440 440
 				 * @param[in,out] null|string $date_format Date Format (default: null)
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
 		$options = $this->field_support_options();
466 466
 
467
-		if( isset( $options[ $key ] ) ) {
467
+		if ( isset( $options[ $key ] ) ) {
468 468
 			$field_options[ $key ] = $options[ $key ];
469 469
 		}
470 470
 
@@ -528,11 +528,11 @@  discard block
 block discarded – undo
528 528
 		$connected_form = \GV\Utils::_POST( 'form_id' );
529 529
 
530 530
 		// Otherwise, get the Form ID from the Post page
531
-		if( empty( $connected_form ) ) {
531
+		if ( empty( $connected_form ) ) {
532 532
 			$connected_form = gravityview_get_form_id( get_the_ID() );
533 533
 		}
534 534
 
535
-		if( empty( $connected_form ) ) {
535
+		if ( empty( $connected_form ) ) {
536 536
 			gravityview()->log->error( 'Form not found for form ID "{form_id}"', array( 'form_id' => $connected_form ) );
537 537
 			return false;
538 538
 		}
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravity-forms-coupon.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		 */
54 54
 		$hide_coupon_fields = apply_filters( 'gravityview/edit_entry/hide-coupon-fields', $has_transaction_data );
55 55
 
56
-		return (bool) $hide_coupon_fields;
56
+		return (bool)$hide_coupon_fields;
57 57
 	}
58 58
 
59 59
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	public function edit_entry_field_blocklist( $blocklist = array(), $entry = array() ) {
79 79
 
80 80
 		if ( $this->should_hide_coupon_fields( $entry ) ) {
81
-			$blocklist[] = 'coupon';
81
+			$blocklist[ ] = 'coupon';
82 82
 		}
83 83
 
84 84
 		return $blocklist;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		// No coupons match the codes provided
117 117
 		$discounts = gf_coupons()->get_coupons_by_codes( $coupon_codes, $form );
118 118
 
119
-		if( ! $discounts ) {
119
+		if ( ! $discounts ) {
120 120
 			return $value;
121 121
 		}
122 122
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		 * @see GF_Field_Coupon::get_field_input
126 126
 		 */
127 127
 		$_POST = ! isset( $_POST ) ? array() : $_POST;
128
-		$_POST[ 'gf_coupons_' . $form['id'] ] = json_encode( (array) $discounts );
128
+		$_POST[ 'gf_coupons_' . $form[ 'id' ] ] = json_encode( (array)$discounts );
129 129
 		$_POST[ 'input_' . $field->id ] = implode( ',', $coupon_codes );
130 130
 
131 131
 		return $value;
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-elegant-themes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 		}
80 80
 
81 81
 		$sidebars_widgets = wp_get_sidebars_widgets();
82
-		if ( empty( $sidebars_widgets[ $matches[1] ] ) ) {
82
+		if ( empty( $sidebars_widgets[ $matches[ 1 ] ] ) ) {
83 83
 			return $shortcodes;
84 84
 		}
85 85
 
86
-		foreach ( $sidebars_widgets[ $matches[1] ] as $widgets ) {
86
+		foreach ( $sidebars_widgets[ $matches[ 1 ] ] as $widgets ) {
87 87
 			if (
88 88
 				/**
89 89
 				 * Blocklisted widgets.
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				strpos( $widgets, 'gv_recent_entries' ) === 0
93 93
 			) {
94 94
 
95
-					$shortcodes []= 'et_pb_sidebar';
95
+					$shortcodes [ ] = 'et_pb_sidebar';
96 96
 					break;
97 97
 			}
98 98
 		}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry.php 2 patches
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -18,84 +18,84 @@  discard block
 block discarded – undo
18 18
 
19 19
 class GravityView_Edit_Entry {
20 20
 
21
-    /**
22
-     * @var string
23
-     */
21
+	/**
22
+	 * @var string
23
+	 */
24 24
 	static $file;
25 25
 
26 26
 	static $instance;
27 27
 
28
-    /**
29
-     * Component instances.
30
-     * @var array
31
-     */
32
-    public $instances = array();
28
+	/**
29
+	 * Component instances.
30
+	 * @var array
31
+	 */
32
+	public $instances = array();
33 33
 
34 34
 
35 35
 	function __construct() {
36 36
 
37
-        self::$file = plugin_dir_path( __FILE__ );
37
+		self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
40
-            $this->load_components( 'admin' );
41
-        }
39
+		if( is_admin() ) {
40
+			$this->load_components( 'admin' );
41
+		}
42 42
 
43 43
 		$this->load_components( 'locking' );
44 44
 
45
-        $this->load_components( 'render' );
45
+		$this->load_components( 'render' );
46 46
 
47
-        // If GF User Registration Add-on exists
48
-        $this->load_components( 'user-registration' );
47
+		// If GF User Registration Add-on exists
48
+		$this->load_components( 'user-registration' );
49 49
 
50
-        $this->add_hooks();
50
+		$this->add_hooks();
51 51
 
52 52
 		// Process hooks for addons that may or may not be present
53 53
 		$this->addon_specific_hooks();
54 54
 	}
55 55
 
56 56
 
57
-    static function getInstance() {
57
+	static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
60
-            self::$instance = new GravityView_Edit_Entry;
61
-        }
59
+		if( empty( self::$instance ) ) {
60
+			self::$instance = new GravityView_Edit_Entry;
61
+		}
62 62
 
63
-        return self::$instance;
64
-    }
63
+		return self::$instance;
64
+	}
65 65
 
66 66
 
67
-    private function load_components( $component ) {
67
+	private function load_components( $component ) {
68 68
 
69
-        $dir = trailingslashit( self::$file );
69
+		$dir = trailingslashit( self::$file );
70 70
 
71
-        $filename  = $dir . 'class-edit-entry-' . $component . '.php';
72
-        $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
71
+		$filename  = $dir . 'class-edit-entry-' . $component . '.php';
72
+		$classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
73 73
 
74
-        // Loads component and pass extension's instance so that component can
75
-        // talk each other.
76
-        require_once $filename;
77
-        $this->instances[ $component ] = new $classname( $this );
78
-        $this->instances[ $component ]->load();
74
+		// Loads component and pass extension's instance so that component can
75
+		// talk each other.
76
+		require_once $filename;
77
+		$this->instances[ $component ] = new $classname( $this );
78
+		$this->instances[ $component ]->load();
79 79
 
80
-    }
80
+	}
81 81
 
82
-    private function add_hooks() {
82
+	private function add_hooks() {
83 83
 
84
-        // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
84
+		// Add front-end access to Gravity Forms delete file action
85
+		add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
86 86
 
87
-        // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
87
+		// Make sure this hook is run for non-admins
88
+		add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
89 89
 
90
-        add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 );
90
+		add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 );
91 91
 
92
-        // add template path to check for field
93
-        add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
92
+		// add template path to check for field
93
+		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
94 94
 
95 95
 		add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 );
96 96
 
97 97
 		add_filter( 'gravityview/api/reserved_query_args', array( $this, 'add_reserved_arg' ) );
98
-    }
98
+	}
99 99
 
100 100
 	/**
101 101
 	 * Adds "edit" to the list of internal reserved query args
@@ -166,74 +166,74 @@  discard block
 block discarded – undo
166 166
 		return false;
167 167
 	}
168 168
 
169
-    /**
170
-     * Include this extension templates path
171
-     * @param array $file_paths List of template paths ordered
172
-     */
173
-    public function add_template_path( $file_paths ) {
174
-
175
-        // Index 100 is the default GravityView template path.
176
-        $file_paths[ 110 ] = self::$file;
177
-
178
-        return $file_paths;
179
-    }
180
-
181
-    /**
182
-     *
183
-     * Return a well formatted nonce key according to GravityView Edit Entry protocol
184
-     *
185
-     * @param $view_id int GravityView view id
186
-     * @param $form_id int Gravity Forms form id
187
-     * @param $entry_id int Gravity Forms entry id
188
-     * @return string
189
-     */
190
-    public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
191
-        return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
192
-    }
193
-
194
-
195
-    /**
196
-     * The edit entry link creates a secure link with a nonce
197
-     *
198
-     * It also mimics the URL structure Gravity Forms expects to have so that
199
-     * it formats the display of the edit form like it does in the backend, like
200
-     * "You can edit this post from the post page" fields, for example.
201
-     *
202
-     * @param $entry array Gravity Forms entry object
203
-     * @param $view_id int GravityView view id
204
-     * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205
-     * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206
-     * @return string
207
-     */
208
-    public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209
-
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
211
-
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
213
-
214
-        $url = add_query_arg( array(
215
-            'edit' => wp_create_nonce( $nonce_key )
216
-        ), $base );
217
-
218
-        if( $post_id ) {
219
-	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220
-        }
221
-
222
-	    /**
223
-	     * Allow passing params to dynamically populate entry with values
224
-	     * @since 1.9.2
225
-	     */
226
-	    if( !empty( $field_values ) ) {
227
-
228
-		    if( is_array( $field_values ) ) {
229
-			    // If already an array, no parse_str() needed
230
-			    $params = $field_values;
231
-		    } else {
232
-			    parse_str( $field_values, $params );
233
-		    }
234
-
235
-		    $url = add_query_arg( $params, $url );
236
-	    }
169
+	/**
170
+	 * Include this extension templates path
171
+	 * @param array $file_paths List of template paths ordered
172
+	 */
173
+	public function add_template_path( $file_paths ) {
174
+
175
+		// Index 100 is the default GravityView template path.
176
+		$file_paths[ 110 ] = self::$file;
177
+
178
+		return $file_paths;
179
+	}
180
+
181
+	/**
182
+	 *
183
+	 * Return a well formatted nonce key according to GravityView Edit Entry protocol
184
+	 *
185
+	 * @param $view_id int GravityView view id
186
+	 * @param $form_id int Gravity Forms form id
187
+	 * @param $entry_id int Gravity Forms entry id
188
+	 * @return string
189
+	 */
190
+	public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
191
+		return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
192
+	}
193
+
194
+
195
+	/**
196
+	 * The edit entry link creates a secure link with a nonce
197
+	 *
198
+	 * It also mimics the URL structure Gravity Forms expects to have so that
199
+	 * it formats the display of the edit form like it does in the backend, like
200
+	 * "You can edit this post from the post page" fields, for example.
201
+	 *
202
+	 * @param $entry array Gravity Forms entry object
203
+	 * @param $view_id int GravityView view id
204
+	 * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205
+	 * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206
+	 * @return string
207
+	 */
208
+	public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209
+
210
+		$nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
211
+
212
+		$base = gv_entry_link( $entry, $post_id ? : $view_id  );
213
+
214
+		$url = add_query_arg( array(
215
+			'edit' => wp_create_nonce( $nonce_key )
216
+		), $base );
217
+
218
+		if( $post_id ) {
219
+			$url = add_query_arg( array( 'gvid' => $view_id ), $url );
220
+		}
221
+
222
+		/**
223
+		 * Allow passing params to dynamically populate entry with values
224
+		 * @since 1.9.2
225
+		 */
226
+		if( !empty( $field_values ) ) {
227
+
228
+			if( is_array( $field_values ) ) {
229
+				// If already an array, no parse_str() needed
230
+				$params = $field_values;
231
+			} else {
232
+				parse_str( $field_values, $params );
233
+			}
234
+
235
+			$url = add_query_arg( $params, $url );
236
+		}
237 237
 
238 238
 		/**
239 239
 		 * @filter `gravityview/edit/link` Filter the edit URL link.
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244 244
 		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
245
-    }
245
+	}
246 246
 
247 247
 	/**
248 248
 	 * @depecated 2.14 Use {@see GravityView_Edit_Entry::modify_field_blocklist()}
@@ -333,19 +333,19 @@  discard block
 block discarded – undo
333 333
 	}
334 334
 
335 335
 
336
-    /**
337
-     * checks if user has permissions to edit a specific entry
338
-     *
339
-     * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
340
-     *
341
-     * @param  array $entry Gravity Forms entry array
342
-     * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
343
-     * @return bool
344
-     */
345
-    public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
336
+	/**
337
+	 * checks if user has permissions to edit a specific entry
338
+	 *
339
+	 * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
340
+	 *
341
+	 * @param  array $entry Gravity Forms entry array
342
+	 * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
343
+	 * @return bool
344
+	 */
345
+	public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
346 346
 
347
-        // No permission by default
348
-        $user_can_edit = false;
347
+		// No permission by default
348
+		$user_can_edit = false;
349 349
 
350 350
 		// get user_edit setting
351 351
 		if ( empty( $view ) ) {
@@ -363,60 +363,60 @@  discard block
 block discarded – undo
363 363
 			$user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
364 364
 		}
365 365
 
366
-        // If they can edit any entries (as defined in Gravity Forms)
367
-        // Or if they can edit other people's entries
368
-        // Then we're good.
369
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
366
+		// If they can edit any entries (as defined in Gravity Forms)
367
+		// Or if they can edit other people's entries
368
+		// Then we're good.
369
+		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
370 370
 
371
-            gravityview()->log->debug( 'User has ability to edit all entries.' );
371
+			gravityview()->log->debug( 'User has ability to edit all entries.' );
372 372
 
373
-            $user_can_edit = true;
373
+			$user_can_edit = true;
374 374
 
375
-        } else if( !isset( $entry['created_by'] ) ) {
375
+		} else if( !isset( $entry['created_by'] ) ) {
376 376
 
377
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
377
+			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
378 378
 
379
-            $user_can_edit = false;
379
+			$user_can_edit = false;
380 380
 
381
-        } else {
381
+		} else {
382 382
 
383
-            $current_user = wp_get_current_user();
383
+			$current_user = wp_get_current_user();
384 384
 
385
-            // User edit is disabled
386
-            if( empty( $user_edit ) ) {
385
+			// User edit is disabled
386
+			if( empty( $user_edit ) ) {
387 387
 
388
-                gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
388
+				gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
389 389
 
390
-                $user_can_edit = false;
391
-            }
390
+				$user_can_edit = false;
391
+			}
392 392
 
393
-            // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
394
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
393
+			// User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
394
+			else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
395 395
 
396
-                gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
396
+				gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
397 397
 
398
-                $user_can_edit = true;
398
+				$user_can_edit = true;
399 399
 
400
-            } else if( ! is_user_logged_in() ) {
400
+			} else if( ! is_user_logged_in() ) {
401 401
 
402
-                gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
402
+				gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
403 403
 
404
-	            $user_can_edit = false; // Here just for clarity
405
-            }
404
+				$user_can_edit = false; // Here just for clarity
405
+			}
406 406
 
407
-        }
407
+		}
408 408
 
409
-        /**
410
-         * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
411
-         * @since 1.15 Added `$entry` and `$view_id` parameters
412
-         * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
413
-         * @param[in] array $entry Gravity Forms entry array {@since 1.15}
414
-         * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
415
-         */
416
-        $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
409
+		/**
410
+		 * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
411
+		 * @since 1.15 Added `$entry` and `$view_id` parameters
412
+		 * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
413
+		 * @param[in] array $entry Gravity Forms entry array {@since 1.15}
414
+		 * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
415
+		 */
416
+		$user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
417 417
 
418
-        return (bool) $user_can_edit;
419
-    }
418
+		return (bool) $user_can_edit;
419
+	}
420 420
 
421 421
 
422 422
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
39
+        if ( is_admin() ) {
40 40
             $this->load_components( 'admin' );
41 41
         }
42 42
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
     static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
59
+        if ( empty( self::$instance ) ) {
60 60
             self::$instance = new GravityView_Edit_Entry;
61 61
         }
62 62
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
     private function add_hooks() {
83 83
 
84 84
         // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
85
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) );
86 86
 
87 87
         // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
88
+        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) );
89 89
 
90 90
         add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 );
91 91
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function add_reserved_arg( $args ) {
110 110
 
111
-		$args[] = 'edit';
111
+		$args[ ] = 'edit';
112 112
 
113 113
 		return $args;
114 114
 	}
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	private function addon_specific_hooks() {
121 121
 
122
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
122
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
124 124
 		}
125 125
 
126 126
 	}
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209 209
 
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
210
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
211 211
 
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
212
+        $base = gv_entry_link( $entry, $post_id ?: $view_id );
213 213
 
214 214
         $url = add_query_arg( array(
215 215
             'edit' => wp_create_nonce( $nonce_key )
216 216
         ), $base );
217 217
 
218
-        if( $post_id ) {
218
+        if ( $post_id ) {
219 219
 	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220 220
         }
221 221
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 	     * Allow passing params to dynamically populate entry with values
224 224
 	     * @since 1.9.2
225 225
 	     */
226
-	    if( !empty( $field_values ) ) {
226
+	    if ( ! empty( $field_values ) ) {
227 227
 
228
-		    if( is_array( $field_values ) ) {
228
+		    if ( is_array( $field_values ) ) {
229 229
 			    // If already an array, no parse_str() needed
230 230
 			    $params = $field_values;
231 231
 		    } else {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		 * @param array $entry The entry.
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244
-		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
244
+		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) );
245 245
     }
246 246
 
247 247
 	/**
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	public function modify_field_blocklist( $fields = array(), $context = NULL ) {
271 271
 
272
-		if( empty( $context ) || $context !== 'edit' ) {
272
+		if ( empty( $context ) || $context !== 'edit' ) {
273 273
 			return $fields;
274 274
 		}
275 275
 
@@ -366,15 +366,15 @@  discard block
 block discarded – undo
366 366
         // If they can edit any entries (as defined in Gravity Forms)
367 367
         // Or if they can edit other people's entries
368 368
         // Then we're good.
369
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
369
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
370 370
 
371 371
             gravityview()->log->debug( 'User has ability to edit all entries.' );
372 372
 
373 373
             $user_can_edit = true;
374 374
 
375
-        } else if( !isset( $entry['created_by'] ) ) {
375
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
376 376
 
377
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
377
+            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
378 378
 
379 379
             $user_can_edit = false;
380 380
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             $current_user = wp_get_current_user();
384 384
 
385 385
             // User edit is disabled
386
-            if( empty( $user_edit ) ) {
386
+            if ( empty( $user_edit ) ) {
387 387
 
388 388
                 gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
389 389
 
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
             }
392 392
 
393 393
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
394
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
394
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
395 395
 
396 396
                 gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
397 397
 
398 398
                 $user_can_edit = true;
399 399
 
400
-            } else if( ! is_user_logged_in() ) {
400
+            } else if ( ! is_user_logged_in() ) {
401 401
 
402 402
                 gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
403 403
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
          */
416 416
         $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
417 417
 
418
-        return (bool) $user_can_edit;
418
+        return (bool)$user_can_edit;
419 419
     }
420 420
 
421 421
 
Please login to merge, or discard this patch.
includes/class-cache.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		/**
85 85
 		 * @see RGFormsModel::update_lead_property() Trigger when any entry property changes
86 86
 		 */
87
-		foreach( $this->lead_db_columns as $column ) {
87
+		foreach ( $this->lead_db_columns as $column ) {
88 88
 			add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 );
89 89
 		}
90 90
 
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 			return;
116 116
 		}
117 117
 
118
-		gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{lead_id} was deleted', array( 'form_id' => $entry['form_id'], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) );
118
+		gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{lead_id} was deleted', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) );
119 119
 
120
-		$this->blocklist_add( $entry['form_id'] );
120
+		$this->blocklist_add( $entry[ 'form_id' ] );
121 121
 	}
122 122
 
123 123
 	/**
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public function entry_updated( $form, $lead_id ) {
132 132
 
133
-		gravityview()->log->debug(' adding form {form_id} to blocklist because entry #{entry_id} was updated', array( 'form_id' => $form['id'], 'entry_id' => $lead_id ) );
133
+		gravityview()->log->debug( ' adding form {form_id} to blocklist because entry #{entry_id} was updated', array( 'form_id' => $form[ 'id' ], 'entry_id' => $lead_id ) );
134 134
 
135
-		$this->blocklist_add( $form['id'] );
135
+		$this->blocklist_add( $form[ 'id' ] );
136 136
 	}
137 137
 
138 138
 	/**
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	public function entry_created( $entry, $form ) {
149 149
 
150
-		gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was created', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) );
150
+		gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was created', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) );
151 151
 
152
-		$this->blocklist_add( $form['id'] );
152
+		$this->blocklist_add( $form[ 'id' ] );
153 153
 	}
154 154
 
155 155
 	/**
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 			return;
166 166
 		}
167 167
 
168
-		gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was added', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) );
168
+		gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was added', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) );
169 169
 
170
-		$this->blocklist_add( $form['id'] );
170
+		$this->blocklist_add( $form[ 'id' ] );
171 171
 	}
172 172
 
173 173
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		// Normally just one form, but supports multiple forms
187 187
 		//
188 188
 		// Array of IDs 12, 5, 14 would result in `f:12-f:5-f:14`
189
-		$forms = 'f:' . implode( '-f:', (array) $form_ids );
189
+		$forms = 'f:' . implode( '-f:', (array)$form_ids );
190 190
 
191 191
 		// Prefix for transient keys
192 192
 		// Now the prefix would be: `gv-cache-f:12-f:5-f:14-`
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		$form_ids = is_array( $form_ids ) ? $form_ids : array( $form_ids );
237 237
 
238 238
 		// Add the passed form IDs
239
-		$blocklist = array_merge( (array) $blocklist, $form_ids );
239
+		$blocklist = array_merge( (array)$blocklist, $form_ids );
240 240
 
241 241
 		// Don't duplicate
242 242
 		$blocklist = array_unique( $blocklist );
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
 		$blocklist = get_option( self::BLOCKLIST_OPTION_NAME, array() );
281 281
 
282
-		$updated_list = array_diff( $blocklist, (array) $form_ids );
282
+		$updated_list = array_diff( $blocklist, (array)$form_ids );
283 283
 
284 284
 		gravityview()->log->debug( 'Removing form IDs from cache blocklist', array( 'data' => array(
285 285
 			'$form_ids'     => $form_ids,
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			return false;
338 338
 		}
339 339
 
340
-		foreach ( (array) $form_ids as $form_id ) {
340
+		foreach ( (array)$form_ids as $form_id ) {
341 341
 
342 342
 			if ( in_array( $form_id, $blocklist ) ) {
343 343
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			 * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache
412 412
 			 * @param int $time_in_seconds Default: `DAY_IN_SECONDS`
413 413
 			 */
414
-			$cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
414
+			$cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
415 415
 
416 416
 			gravityview()->log->debug( 'Setting cache with transient key {key} for {cache_time} seconds', array( 'key' => $this->key, 'cache_time' => $cache_time ) );
417 417
 
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			return;
448 448
 		}
449 449
 
450
-		foreach ( (array) $form_ids as $form_id ) {
450
+		foreach ( (array)$form_ids as $form_id ) {
451 451
 
452 452
 			$key = '_transient_gv-cache-';
453 453
 
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	public function use_cache() {
559 559
 
560 560
 		// Exit early if debugging (unless running PHPUnit)
561
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! ( defined('DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) {
561
+		if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) {
562 562
 			return apply_filters( 'gravityview_use_cache', false, $this );
563 563
 		}
564 564
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 
567 567
 		if ( GVCommon::has_cap( 'edit_gravityviews' ) ) {
568 568
 
569
-			if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) {
569
+			if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) {
570 570
 
571 571
 				gravityview()->log->debug( 'Not using cache: ?cache or ?nocache is in the URL' );
572 572
 
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 		 */
594 594
 		$use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this );
595 595
 
596
-		return (boolean) $use_cache;
596
+		return (boolean)$use_cache;
597 597
 	}
598 598
 
599 599
 }
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 3 patches
Indentation   +239 added lines, -239 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 = self::$original_form;
@@ -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
 
@@ -1150,13 +1150,13 @@  discard block
 block discarded – undo
1150 1150
 			);
1151 1151
 
1152 1152
 			/**
1153
-			* @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1154
-			* @since 1.16.3
1155
-			* @param array $labels Default button labels associative array
1156
-			* @param array $form The Gravity Forms form
1157
-			* @param array $entry The Gravity Forms entry
1158
-			* @param int $view_id The current View ID
1159
-			*/
1153
+			 * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1154
+			 * @since 1.16.3
1155
+			 * @param array $labels Default button labels associative array
1156
+			 * @param array $form The Gravity Forms form
1157
+			 * @param array $entry The Gravity Forms entry
1158
+			 * @param int $view_id The current View ID
1159
+			 */
1160 1160
 			$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1161 1161
 
1162 1162
 			$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit'];
@@ -1276,13 +1276,13 @@  discard block
 block discarded – undo
1276 1276
 				);
1277 1277
 
1278 1278
 				/**
1279
-				* @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1280
-				* @since 1.16.3
1281
-				* @param array $labels Default button labels associative array
1282
-				* @param array $form The Gravity Forms form
1283
-				* @param array $entry The Gravity Forms entry
1284
-				* @param int $view_id The current View ID
1285
-				*/
1279
+				 * @filter `gravityview/edit_entry/button_labels` Modify the cancel/submit buttons' labels
1280
+				 * @since 1.16.3
1281
+				 * @param array $labels Default button labels associative array
1282
+				 * @param array $form The Gravity Forms form
1283
+				 * @param array $entry The Gravity Forms entry
1284
+				 * @param int $view_id The current View ID
1285
+				 */
1286 1286
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1287 1287
 
1288 1288
 				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
 
1329 1329
 		ob_get_clean();
1330 1330
 
1331
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1331
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1332 1332
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1333 1333
 		remove_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1334 1334
 		remove_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 
1389 1389
 		// for now we don't support Save and Continue feature.
1390 1390
 		if( ! self::$supports_save_and_continue ) {
1391
-	        unset( $form['save'] );
1391
+			unset( $form['save'] );
1392 1392
 		}
1393 1393
 
1394 1394
 		$form = $this->unselect_default_values( $form );
@@ -1415,30 +1415,30 @@  discard block
 block discarded – undo
1415 1415
 			return $field_content;
1416 1416
 		}
1417 1417
 
1418
-        $message = null;
1418
+		$message = null;
1419 1419
 
1420
-        // First, make sure they have the capability to edit the post.
1421
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1420
+		// First, make sure they have the capability to edit the post.
1421
+		if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1422 1422
 
1423
-            /**
1424
-             * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1425
-             * @param string $message The existing "You don't have permission..." text
1426
-             */
1427
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1423
+			/**
1424
+			 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1425
+			 * @param string $message The existing "You don't have permission..." text
1426
+			 */
1427
+			$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1428 1428
 
1429
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1430
-            /**
1431
-             * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1432
-             * @param string $message The existing "This field is not editable; the post no longer exists." text
1433
-             */
1434
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1435
-        }
1429
+		} elseif( null === get_post( $this->entry['post_id'] ) ) {
1430
+			/**
1431
+			 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1432
+			 * @param string $message The existing "This field is not editable; the post no longer exists." text
1433
+			 */
1434
+			$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1435
+		}
1436 1436
 
1437
-        if( $message ) {
1438
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1439
-        }
1437
+		if( $message ) {
1438
+			$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1439
+		}
1440 1440
 
1441
-        return $field_content;
1441
+		return $field_content;
1442 1442
 	}
1443 1443
 
1444 1444
 	/**
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
 			|| ! empty( $field_content )
1467 1467
 			|| in_array( $field->type, array( 'honeypot' ) )
1468 1468
 		) {
1469
-	        return $field_content;
1469
+			return $field_content;
1470 1470
 		}
1471 1471
 
1472 1472
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1474,24 +1474,24 @@  discard block
 block discarded – undo
1474 1474
 
1475 1475
 		$field_value = $this->get_field_value( $field );
1476 1476
 
1477
-	    // Prevent any PHP warnings, like undefined index
1478
-	    ob_start();
1477
+		// Prevent any PHP warnings, like undefined index
1478
+		ob_start();
1479 1479
 
1480
-	    $return = null;
1480
+		$return = null;
1481 1481
 
1482 1482
 		/** @var GravityView_Field $gv_field */
1483 1483
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1484 1484
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1485 1485
 		} else {
1486
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1487
-	    }
1486
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1487
+		}
1488 1488
 
1489
-	    // If there was output, it's an error
1490
-	    $warnings = ob_get_clean();
1489
+		// If there was output, it's an error
1490
+		$warnings = ob_get_clean();
1491 1491
 
1492
-	    if( !empty( $warnings ) ) {
1493
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1494
-	    }
1492
+		if( !empty( $warnings ) ) {
1493
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1494
+		}
1495 1495
 
1496 1496
 		return $return;
1497 1497
 	}
@@ -1526,8 +1526,8 @@  discard block
 block discarded – undo
1526 1526
 				$input_id = strval( $input['id'] );
1527 1527
 
1528 1528
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1529
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1530
-				    $allow_pre_populated = false;
1529
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1530
+					$allow_pre_populated = false;
1531 1531
 				}
1532 1532
 
1533 1533
 			}
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1552 1552
 				$categories = array();
1553 1553
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1554
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1554
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1555 1555
 				}
1556 1556
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1557 1557
 			}
@@ -1561,25 +1561,25 @@  discard block
 block discarded – undo
1561 1561
 		// if value is empty get the default value if defined
1562 1562
 		$field_value = $field->get_value_default_if_empty( $field_value );
1563 1563
 
1564
-	    /**
1565
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1566
-	     * @since 1.11
1567
-	     * @since 1.20 Added third param
1568
-	     * @param mixed $field_value field value used to populate the input
1569
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1570
-	     * @param GravityView_Edit_Entry_Render $this Current object
1571
-	     */
1572
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1573
-
1574
-	    /**
1575
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1576
-	     * @since 1.17
1577
-	     * @since 1.20 Added third param
1578
-	     * @param mixed $field_value field value used to populate the input
1579
-	     * @param GF_Field $field Gravity Forms field object
1580
-	     * @param GravityView_Edit_Entry_Render $this Current object
1581
-	     */
1582
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1564
+		/**
1565
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1566
+		 * @since 1.11
1567
+		 * @since 1.20 Added third param
1568
+		 * @param mixed $field_value field value used to populate the input
1569
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1570
+		 * @param GravityView_Edit_Entry_Render $this Current object
1571
+		 */
1572
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1573
+
1574
+		/**
1575
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1576
+		 * @since 1.17
1577
+		 * @since 1.20 Added third param
1578
+		 * @param mixed $field_value field value used to populate the input
1579
+		 * @param GF_Field $field Gravity Forms field object
1580
+		 * @param GravityView_Edit_Entry_Render $this Current object
1581
+		 */
1582
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1583 1583
 
1584 1584
 		return $field_value;
1585 1585
 	}
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1607 1607
 			// expects certain field array items to be set.
1608 1608
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1609
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1609
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1610 1610
 			}
1611 1611
 
1612 1612
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1620,31 +1620,31 @@  discard block
 block discarded – undo
1620 1620
 				 */
1621 1621
 				case 'fileupload':
1622 1622
 
1623
-				    // Set the previous value
1624
-				    $entry = $this->get_entry();
1623
+					// Set the previous value
1624
+					$entry = $this->get_entry();
1625 1625
 
1626
-				    $input_name = 'input_'.$field->id;
1627
-				    $form_id = $form['id'];
1626
+					$input_name = 'input_'.$field->id;
1627
+					$form_id = $form['id'];
1628 1628
 
1629
-				    $value = NULL;
1629
+					$value = NULL;
1630 1630
 
1631
-				    // Use the previous entry value as the default.
1632
-				    if( isset( $entry[ $field->id ] ) ) {
1633
-				        $value = $entry[ $field->id ];
1634
-				    }
1631
+					// Use the previous entry value as the default.
1632
+					if( isset( $entry[ $field->id ] ) ) {
1633
+						$value = $entry[ $field->id ];
1634
+					}
1635 1635
 
1636
-				    // If this is a single upload file
1637
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1638
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1639
-				        $value = $file_path['url'];
1636
+					// If this is a single upload file
1637
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1638
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1639
+						$value = $file_path['url'];
1640 1640
 
1641
-				    } else {
1641
+					} else {
1642 1642
 
1643
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1644
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1645
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1643
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1644
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1645
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1646 1646
 
1647
-				    }
1647
+					}
1648 1648
 
1649 1649
 					if ( \GV\Utils::get( $field, 'multipleFiles' ) ) {
1650 1650
 						// If there are fresh uploads, process and merge them.
@@ -1665,17 +1665,17 @@  discard block
 block discarded – undo
1665 1665
 						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1666 1666
 					}
1667 1667
 
1668
-				    $this->entry[ $input_name ] = $value;
1669
-				    $_POST[ $input_name ] = $value;
1668
+					$this->entry[ $input_name ] = $value;
1669
+					$_POST[ $input_name ] = $value;
1670 1670
 
1671
-				    break;
1671
+					break;
1672 1672
 
1673 1673
 				case 'number':
1674
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1675
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1676
-				        $_POST['input_'.$field->id ] = NULL;
1677
-				    }
1678
-				    break;
1674
+					// Fix "undefined index" issue at line 1286 in form_display.php
1675
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1676
+						$_POST['input_'.$field->id ] = NULL;
1677
+					}
1678
+					break;
1679 1679
 			}
1680 1680
 
1681 1681
 		}
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
 
1797 1797
 						// count uploaded files and existent entry files
1798 1798
 						$count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1799
-						               ( is_array( $value ) ? count( $value ) : 0 );
1799
+									   ( is_array( $value ) ? count( $value ) : 0 );
1800 1800
 
1801 1801
 						if ( $count_files > $field->maxFiles ) {
1802 1802
 							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
@@ -1818,47 +1818,47 @@  discard block
 block discarded – undo
1818 1818
 
1819 1819
 				switch ( $field_type ) {
1820 1820
 
1821
-				    // Captchas don't need to be re-entered.
1822
-				    case 'captcha':
1821
+					// Captchas don't need to be re-entered.
1822
+					case 'captcha':
1823 1823
 
1824
-				        // Post Image fields aren't editable, so we un-fail them.
1825
-				    case 'post_image':
1826
-				        $field->failed_validation = false;
1827
-				        unset( $field->validation_message );
1828
-				        break;
1824
+						// Post Image fields aren't editable, so we un-fail them.
1825
+					case 'post_image':
1826
+						$field->failed_validation = false;
1827
+						unset( $field->validation_message );
1828
+						break;
1829 1829
 
1830 1830
 				}
1831 1831
 
1832 1832
 				// You can't continue inside a switch, so we do it after.
1833 1833
 				if( empty( $field->failed_validation ) ) {
1834
-				    continue;
1834
+					continue;
1835 1835
 				}
1836 1836
 
1837 1837
 				// checks if the No Duplicates option is not validating entry against itself, since
1838 1838
 				// we're editing a stored entry, it would also assume it's a duplicate.
1839 1839
 				if( !empty( $field->noDuplicates ) ) {
1840 1840
 
1841
-				    $entry = $this->get_entry();
1841
+					$entry = $this->get_entry();
1842 1842
 
1843
-				    // If the value of the entry is the same as the stored value
1844
-				    // Then we can assume it's not a duplicate, it's the same.
1845
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1846
-				        //if value submitted was not changed, then don't validate
1847
-				        $field->failed_validation = false;
1843
+					// If the value of the entry is the same as the stored value
1844
+					// Then we can assume it's not a duplicate, it's the same.
1845
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1846
+						//if value submitted was not changed, then don't validate
1847
+						$field->failed_validation = false;
1848 1848
 
1849
-				        unset( $field->validation_message );
1849
+						unset( $field->validation_message );
1850 1850
 
1851
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1851
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1852 1852
 
1853
-				        continue;
1854
-				    }
1853
+						continue;
1854
+					}
1855 1855
 				}
1856 1856
 
1857 1857
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1858 1858
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1859
-				    unset( $field->validation_message );
1859
+					unset( $field->validation_message );
1860 1860
 					$field->failed_validation = false;
1861
-				    continue;
1861
+					continue;
1862 1862
 				}
1863 1863
 
1864 1864
 				$gv_valid = false;
@@ -1922,8 +1922,8 @@  discard block
 block discarded – undo
1922 1922
 		// Hide fields depending on admin settings
1923 1923
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1924 1924
 
1925
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1926
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1925
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1926
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1927 1927
 
1928 1928
 		/**
1929 1929
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -2014,11 +2014,11 @@  discard block
 block discarded – undo
2014 2014
 		// The edit tab has been configured, so we loop through to configured settings
2015 2015
 		foreach ( $configured_fields as $configured_field ) {
2016 2016
 
2017
-	        /** @var GF_Field $field */
2018
-	        foreach ( $fields as $field ) {
2017
+			/** @var GF_Field $field */
2018
+			foreach ( $fields as $field ) {
2019 2019
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2020
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2021
-				    break;
2020
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2021
+					break;
2022 2022
 				}
2023 2023
 
2024 2024
 			}
@@ -2074,28 +2074,28 @@  discard block
 block discarded – undo
2074 2074
 	 */
2075 2075
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
2076 2076
 
2077
-	    /**
2077
+		/**
2078 2078
 		 * @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
2079
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
2080
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
2081
-	     * @since 1.9.1
2082
-	     * @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.
2083
-	     * @param array $form GF Form array
2084
-	     * @param int $view_id View ID
2085
-	     */
2086
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2087
-
2088
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2079
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
2080
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
2081
+		 * @since 1.9.1
2082
+		 * @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.
2083
+		 * @param array $form GF Form array
2084
+		 * @param int $view_id View ID
2085
+		 */
2086
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2087
+
2088
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2089 2089
 			foreach( $fields as $k => $field ) {
2090 2090
 				if( $field->adminOnly ) {
2091
-				    unset( $fields[ $k ] );
2091
+					unset( $fields[ $k ] );
2092 2092
 				}
2093 2093
 			}
2094 2094
 			return array_values( $fields );
2095 2095
 		}
2096 2096
 
2097
-	    foreach( $fields as &$field ) {
2098
-		    $field->adminOnly = false;
2097
+		foreach( $fields as &$field ) {
2098
+			$field->adminOnly = false;
2099 2099
 		}
2100 2100
 
2101 2101
 		return $fields;
@@ -2115,13 +2115,13 @@  discard block
 block discarded – undo
2115 2115
 	 */
2116 2116
 	private function unselect_default_values( $form ) {
2117 2117
 
2118
-	    foreach ( $form['fields'] as &$field ) {
2118
+		foreach ( $form['fields'] as &$field ) {
2119 2119
 
2120 2120
 			if ( empty( $field->choices ) ) {
2121
-                continue;
2121
+				continue;
2122 2122
 			}
2123 2123
 
2124
-            foreach ( $field->choices as &$choice ) {
2124
+			foreach ( $field->choices as &$choice ) {
2125 2125
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
2126 2126
 					$choice['isSelected'] = false;
2127 2127
 				}
@@ -2158,36 +2158,36 @@  discard block
 block discarded – undo
2158 2158
 
2159 2159
 			if( 'checkbox' === $field->type ) {
2160 2160
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
2161
-				    $input_id = $input['id'];
2162
-				    $choice = $field->choices[ $key ];
2163
-				    $value = \GV\Utils::get( $this->entry, $input_id );
2164
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
2165
-				    if( $match ) {
2166
-				        $field->choices[ $key ]['isSelected'] = true;
2167
-				    }
2161
+					$input_id = $input['id'];
2162
+					$choice = $field->choices[ $key ];
2163
+					$value = \GV\Utils::get( $this->entry, $input_id );
2164
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
2165
+					if( $match ) {
2166
+						$field->choices[ $key ]['isSelected'] = true;
2167
+					}
2168 2168
 				}
2169 2169
 			} else {
2170 2170
 
2171 2171
 				// We need to run through each field to set the default values
2172 2172
 				foreach ( $this->entry as $field_id => $field_value ) {
2173 2173
 
2174
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
2174
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
2175 2175
 
2176
-				        if( 'list' === $field->type ) {
2177
-				            $list_rows = maybe_unserialize( $field_value );
2176
+						if( 'list' === $field->type ) {
2177
+							$list_rows = maybe_unserialize( $field_value );
2178 2178
 
2179
-				            $list_field_value = array();
2180
-				            foreach ( (array) $list_rows as $row ) {
2181
-				                foreach ( (array) $row as $column ) {
2182
-				                    $list_field_value[] = $column;
2183
-				                }
2184
-				            }
2179
+							$list_field_value = array();
2180
+							foreach ( (array) $list_rows as $row ) {
2181
+								foreach ( (array) $row as $column ) {
2182
+									$list_field_value[] = $column;
2183
+								}
2184
+							}
2185 2185
 
2186
-				            $field->defaultValue = serialize( $list_field_value );
2187
-				        } else {
2188
-				            $field->defaultValue = $field_value;
2189
-				        }
2190
-				    }
2186
+							$field->defaultValue = serialize( $list_field_value );
2187
+						} else {
2188
+							$field->defaultValue = $field_value;
2189
+						}
2190
+					}
2191 2191
 				}
2192 2192
 			}
2193 2193
 		}
@@ -2248,7 +2248,7 @@  discard block
 block discarded – undo
2248 2248
 			foreach ( $form['fields'] as &$field ) {
2249 2249
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2250 2250
 
2251
-				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2251
+					list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2252 2252
 
2253 2253
 					if ( $field['id'] == $rule_field_id ) {
2254 2254
 						unset( $field->conditionalLogic['rules'][ $rule_i ] );
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
 			return $has_conditional_logic;
2300 2300
 		}
2301 2301
 
2302
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2302
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2303 2303
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
2304 2304
 	}
2305 2305
 
@@ -2366,14 +2366,14 @@  discard block
 block discarded – undo
2366 2366
 
2367 2367
 		if( $echo && $error !== true ) {
2368 2368
 
2369
-	        $error = esc_html( $error );
2369
+			$error = esc_html( $error );
2370 2370
 
2371
-	        /**
2372
-	         * @since 1.9
2373
-	         */
2374
-	        if ( ! empty( $this->entry ) ) {
2375
-		        $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;" ) );
2376
-	        }
2371
+			/**
2372
+			 * @since 1.9
2373
+			 */
2374
+			if ( ! empty( $this->entry ) ) {
2375
+				$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;" ) );
2376
+			}
2377 2377
 
2378 2378
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2379 2379
 		}
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 = self::$original_form;
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>
@@ -1159,18 +1159,18 @@  discard block
 block discarded – undo
1159 1159
 			*/
1160 1160
 			$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1161 1161
 
1162
-			$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels['submit'];
1162
+			$this->is_paged_submitted = \GV\Utils::_POST( 'save' ) === $labels[ 'submit' ];
1163 1163
 		}
1164 1164
 
1165 1165
 		$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
1166 1166
 
1167
-		if( ! $this->is_valid ){
1167
+		if ( ! $this->is_valid ) {
1168 1168
 
1169 1169
 			// Keeping this compatible with Gravity Forms.
1170
-			$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
1171
-			$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
1170
+			$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
1171
+			$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
1172 1172
 
1173
-			echo GVCommon::generate_notice( $message , 'gv-error' );
1173
+			echo GVCommon::generate_notice( $message, 'gv-error' );
1174 1174
 
1175 1175
 		} elseif ( false === $this->is_paged_submitted ) {
1176 1176
 			// Paged form that hasn't been submitted on the last page yet
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 			 * @param int $view_id View ID
1184 1184
 			 * @param array $entry Gravity Forms entry array
1185 1185
 			 */
1186
-			$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message , $this->view_id, $this->entry );
1186
+			$message = apply_filters( 'gravityview/edit_entry/page/success', $entry_updated_message, $this->view_id, $this->entry );
1187 1187
 
1188 1188
 			echo GVCommon::generate_notice( $message );
1189 1189
 		} else {
@@ -1195,23 +1195,23 @@  discard block
 block discarded – undo
1195 1195
 
1196 1196
 				case '0':
1197 1197
 					$redirect_url = $back_link;
1198
-					$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1198
+					$entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' );
1199 1199
 					break;
1200 1200
 
1201 1201
 				case '1':
1202 1202
 					$redirect_url = $directory_link = GravityView_API::directory_link();
1203
-					$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>' );
1203
+					$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>' );
1204 1204
 					break;
1205 1205
 
1206 1206
 				case '2':
1207 1207
 					$redirect_url = $edit_redirect_url;
1208 1208
 					$redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1209
-					$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>' );
1209
+					$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>' );
1210 1210
 					break;
1211 1211
 
1212 1212
 				case '':
1213 1213
 				default:
1214
-					$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1214
+					$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' );
1215 1215
 					break;
1216 1216
 			}
1217 1217
 
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			 * @param array $entry Gravity Forms entry array
1228 1228
 			 * @param string $back_link URL to return to the original entry. @since 1.6
1229 1229
 			 */
1230
-			$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
1230
+			$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
1231 1231
 
1232 1232
 			echo GVCommon::generate_notice( $message );
1233 1233
 		}
@@ -1249,8 +1249,8 @@  discard block
 block discarded – undo
1249 1249
 		 */
1250 1250
 		do_action( 'gravityview/edit-entry/render/before', $this );
1251 1251
 
1252
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1253
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1252
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1253
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1254 1254
 		add_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1255 1255
 		add_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
1256 1256
 		add_filter( 'gform_disable_view_counter', '__return_true' );
@@ -1259,14 +1259,14 @@  discard block
 block discarded – undo
1259 1259
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1260 1260
 
1261 1261
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1262
-		unset( $_GET['page'] );
1262
+		unset( $_GET[ 'page' ] );
1263 1263
 
1264 1264
 		$this->show_next_button = false;
1265 1265
 		$this->show_previous_button = false;
1266 1266
 
1267 1267
 		// TODO: Verify multiple-page forms
1268 1268
 		if ( GFCommon::has_pages( $this->form ) && apply_filters( 'gravityview/features/paged-edit', false ) ) {
1269
-			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form['id'], 0 ) ) ) {
1269
+			if ( intval( $page_number = \GV\Utils::_POST( 'gform_source_page_number_' . $this->form[ 'id' ], 0 ) ) ) {
1270 1270
 
1271 1271
 				$labels = array(
1272 1272
 					'cancel'   => __( 'Cancel', 'gravityview' ),
@@ -1285,20 +1285,20 @@  discard block
 block discarded – undo
1285 1285
 				*/
1286 1286
 				$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
1287 1287
 
1288
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
1289
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'is_valid' ] = true;
1288
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'form' ] = $this->form;
1289
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'is_valid' ] = true;
1290 1290
 
1291
-				if ( \GV\Utils::_POST( 'save' ) === $labels['next'] ) {
1291
+				if ( \GV\Utils::_POST( 'save' ) === $labels[ 'next' ] ) {
1292 1292
 					$last_page = \GFFormDisplay::get_max_page_number( $this->form );
1293 1293
 
1294 1294
 					while ( ++$page_number < $last_page && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1295 1295
 					} // Advance to next visible page
1296
-				} elseif ( \GV\Utils::_POST( 'save' ) === $labels['previous'] ) {
1296
+				} elseif ( \GV\Utils::_POST( 'save' ) === $labels[ 'previous' ] ) {
1297 1297
 					while ( --$page_number > 1 && RGFormsModel::is_page_hidden( $this->form, $page_number, \GV\Utils::_POST( 'gform_field_values' ) ) ) {
1298 1298
 					} // Advance to next visible page
1299 1299
 				}
1300 1300
 
1301
-				GFFormDisplay::$submission[ $this->form['id'] ]['page_number'] = $page_number;
1301
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'page_number' ] = $page_number;
1302 1302
 			}
1303 1303
 
1304 1304
 			if ( ( $page_number = intval( $page_number ) ) < 2 ) {
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
 
1325 1325
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1326 1326
 
1327
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1327
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1328 1328
 
1329 1329
 		ob_get_clean();
1330 1330
 
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 	 * @return string
1353 1353
 	 */
1354 1354
 	public function render_form_buttons() {
1355
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1355
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1356 1356
 	}
1357 1357
 
1358 1358
 
@@ -1371,15 +1371,15 @@  discard block
 block discarded – undo
1371 1371
 	 */
1372 1372
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1373 1373
 
1374
-		if( $form['id'] != $this->form_id ) {
1374
+		if ( $form[ 'id' ] != $this->form_id ) {
1375 1375
 			return $form;
1376 1376
 		}
1377 1377
 
1378 1378
 		// In case we have validated the form, use it to inject the validation results into the form render
1379
-		if( isset( $this->form_after_validation ) && $this->form_after_validation['id'] === $form['id'] ) {
1379
+		if ( isset( $this->form_after_validation ) && $this->form_after_validation[ 'id' ] === $form[ 'id' ] ) {
1380 1380
 			$form = $this->form_after_validation;
1381 1381
 		} else {
1382
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1382
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1383 1383
 		}
1384 1384
 
1385 1385
 		$form = $this->filter_conditional_logic( $form );
@@ -1387,8 +1387,8 @@  discard block
 block discarded – undo
1387 1387
 		$form = $this->prefill_conditional_logic( $form );
1388 1388
 
1389 1389
 		// for now we don't support Save and Continue feature.
1390
-		if( ! self::$supports_save_and_continue ) {
1391
-	        unset( $form['save'] );
1390
+		if ( ! self::$supports_save_and_continue ) {
1391
+	        unset( $form[ 'save' ] );
1392 1392
 		}
1393 1393
 
1394 1394
 		$form = $this->unselect_default_values( $form );
@@ -1411,31 +1411,31 @@  discard block
 block discarded – undo
1411 1411
 	 */
1412 1412
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1413 1413
 
1414
-		if( ! GFCommon::is_post_field( $field ) ) {
1414
+		if ( ! GFCommon::is_post_field( $field ) ) {
1415 1415
 			return $field_content;
1416 1416
 		}
1417 1417
 
1418 1418
         $message = null;
1419 1419
 
1420 1420
         // First, make sure they have the capability to edit the post.
1421
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1421
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1422 1422
 
1423 1423
             /**
1424 1424
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1425 1425
              * @param string $message The existing "You don't have permission..." text
1426 1426
              */
1427
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1427
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1428 1428
 
1429
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1429
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1430 1430
             /**
1431 1431
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1432 1432
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1433 1433
              */
1434
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1434
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1435 1435
         }
1436 1436
 
1437
-        if( $message ) {
1438
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1437
+        if ( $message ) {
1438
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1439 1439
         }
1440 1440
 
1441 1441
         return $field_content;
@@ -1459,8 +1459,8 @@  discard block
 block discarded – undo
1459 1459
 
1460 1460
 		// If the form has been submitted, then we don't need to pre-fill the values,
1461 1461
 		// Except for fileupload type and when a field input is overridden- run always!!
1462
-		if(
1463
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1462
+		if (
1463
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1464 1464
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1465 1465
 			&& ! GFCommon::is_product_field( $field->type )
1466 1466
 			|| ! empty( $field_content )
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
 	    $return = null;
1481 1481
 
1482 1482
 		/** @var GravityView_Field $gv_field */
1483
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1483
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1484 1484
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1485 1485
 		} else {
1486 1486
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 	    // If there was output, it's an error
1490 1490
 	    $warnings = ob_get_clean();
1491 1491
 
1492
-	    if( !empty( $warnings ) ) {
1492
+	    if ( ! empty( $warnings ) ) {
1493 1493
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1494 1494
 	    }
1495 1495
 
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1515 1515
 
1516 1516
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1517
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1517
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1518 1518
 
1519 1519
 			$field_value = array();
1520 1520
 
@@ -1523,10 +1523,10 @@  discard block
 block discarded – undo
1523 1523
 
1524 1524
 			foreach ( (array)$field->inputs as $input ) {
1525 1525
 
1526
-				$input_id = strval( $input['id'] );
1526
+				$input_id = strval( $input[ 'id' ] );
1527 1527
 
1528 1528
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1529
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1529
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1530 1530
 				    $allow_pre_populated = false;
1531 1531
 				}
1532 1532
 
@@ -1534,7 +1534,7 @@  discard block
 block discarded – undo
1534 1534
 
1535 1535
 			$pre_value = $field->get_value_submission( array(), false );
1536 1536
 
1537
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1537
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1538 1538
 
1539 1539
 		} else {
1540 1540
 
@@ -1545,13 +1545,13 @@  discard block
 block discarded – undo
1545 1545
 
1546 1546
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1547 1547
 			// or pre-populated value if not empty and set to override saved value
1548
-			$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;
1548
+			$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;
1549 1549
 
1550 1550
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1551
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1551
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1552 1552
 				$categories = array();
1553 1553
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1554
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1554
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1555 1555
 				}
1556 1556
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1557 1557
 			}
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
 	     * @param GF_Field $field Gravity Forms field object
1580 1580
 	     * @param GravityView_Edit_Entry_Render $this Current object
1581 1581
 	     */
1582
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1582
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1583 1583
 
1584 1584
 		return $field_value;
1585 1585
 	}
@@ -1596,12 +1596,12 @@  discard block
 block discarded – undo
1596 1596
 	 */
1597 1597
 	public function gform_pre_validation( $form ) {
1598 1598
 
1599
-		if( ! $this->verify_nonce() ) {
1599
+		if ( ! $this->verify_nonce() ) {
1600 1600
 			return $form;
1601 1601
 		}
1602 1602
 
1603 1603
 		// Fix PHP warning regarding undefined index.
1604
-		foreach ( $form['fields'] as &$field) {
1604
+		foreach ( $form[ 'fields' ] as &$field ) {
1605 1605
 
1606 1606
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1607 1607
 			// expects certain field array items to be set.
@@ -1609,7 +1609,7 @@  discard block
 block discarded – undo
1609 1609
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1610 1610
 			}
1611 1611
 
1612
-			switch( RGFormsModel::get_input_type( $field ) ) {
1612
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1613 1613
 
1614 1614
 				/**
1615 1615
 				 * 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.
@@ -1623,26 +1623,26 @@  discard block
 block discarded – undo
1623 1623
 				    // Set the previous value
1624 1624
 				    $entry = $this->get_entry();
1625 1625
 
1626
-				    $input_name = 'input_'.$field->id;
1627
-				    $form_id = $form['id'];
1626
+				    $input_name = 'input_' . $field->id;
1627
+				    $form_id = $form[ 'id' ];
1628 1628
 
1629 1629
 				    $value = NULL;
1630 1630
 
1631 1631
 				    // Use the previous entry value as the default.
1632
-				    if( isset( $entry[ $field->id ] ) ) {
1632
+				    if ( isset( $entry[ $field->id ] ) ) {
1633 1633
 				        $value = $entry[ $field->id ];
1634 1634
 				    }
1635 1635
 
1636 1636
 				    // If this is a single upload file
1637
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1638
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1639
-				        $value = $file_path['url'];
1637
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1638
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1639
+				        $value = $file_path[ 'url' ];
1640 1640
 
1641 1641
 				    } else {
1642 1642
 
1643 1643
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1644 1644
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1645
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1645
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1646 1646
 
1647 1647
 				    }
1648 1648
 
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 						if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1653 1653
 							$value = empty( $value ) ? '[]' : $value;
1654 1654
 							$value = stripslashes_deep( $value );
1655
-							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array() );
1655
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1656 1656
 						} else if ( GFCommon::is_json( $value ) ) {
1657 1657
 							// Existing file; let GF derive the value from the `$_gf_uploaded_files` object (see `\GF_Field_FileUpload::get_multifile_value()`)
1658 1658
 							global $_gf_uploaded_files;
@@ -1672,8 +1672,8 @@  discard block
 block discarded – undo
1672 1672
 
1673 1673
 				case 'number':
1674 1674
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1675
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1676
-				        $_POST['input_'.$field->id ] = NULL;
1675
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1676
+				        $_POST[ 'input_' . $field->id ] = NULL;
1677 1677
 				    }
1678 1678
 				    break;
1679 1679
 			}
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 		 * You can enter whatever you want!
1711 1711
 		 * We try validating, and customize the results using `self::custom_validation()`
1712 1712
 		 */
1713
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1713
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1714 1714
 
1715 1715
 		// Needed by the validate funtion
1716 1716
 		$failed_validation_page = NULL;
@@ -1718,14 +1718,14 @@  discard block
 block discarded – undo
1718 1718
 
1719 1719
 		// Prevent entry limit from running when editing an entry, also
1720 1720
 		// prevent form scheduling from preventing editing
1721
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1721
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1722 1722
 
1723 1723
 		// Hide fields depending on Edit Entry settings
1724
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1724
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1725 1725
 
1726 1726
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1727 1727
 
1728
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1728
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1729 1729
 	}
1730 1730
 
1731 1731
 
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
 
1754 1754
 		$gv_valid = true;
1755 1755
 
1756
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1756
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1757 1757
 			$value             = RGFormsModel::get_field_value( $field );
1758 1758
 			$field_type        = RGFormsModel::get_input_type( $field );
1759 1759
 			$is_required       = ! empty( $field->isRequired );
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
 
1762 1762
 			// Manually validate required fields as they can be skipped be skipped by GF's validation
1763 1763
 			// This can happen when the field is considered "hidden" (see `GFFormDisplay::validate`) due to unmet conditional logic
1764
-			if ( $is_required && !$failed_validation && rgblank( $value ) ) {
1764
+			if ( $is_required && ! $failed_validation && rgblank( $value ) ) {
1765 1765
 				$field->failed_validation  = true;
1766 1766
 				$field->validation_message = esc_html__( 'This field is required.', 'gravityview' );
1767 1767
 
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
 					if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1786 1786
 						$input_name = 'input_' . $field->id;
1787 1787
 						//uploaded
1788
-						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1788
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1789 1789
 
1790 1790
 						//existent
1791 1791
 						$entry = $this->get_entry();
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
 							$gv_valid                  = false;
1805 1805
 
1806 1806
 							// in case of error make sure the newest upload files are removed from the upload input
1807
-							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1807
+							GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1808 1808
 						}
1809 1809
 					}
1810 1810
 
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
 			}
1813 1813
 
1814 1814
 			// This field has failed validation.
1815
-			if( !empty( $field->failed_validation ) ) {
1815
+			if ( ! empty( $field->failed_validation ) ) {
1816 1816
 
1817 1817
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1818 1818
 
@@ -1830,19 +1830,19 @@  discard block
 block discarded – undo
1830 1830
 				}
1831 1831
 
1832 1832
 				// You can't continue inside a switch, so we do it after.
1833
-				if( empty( $field->failed_validation ) ) {
1833
+				if ( empty( $field->failed_validation ) ) {
1834 1834
 				    continue;
1835 1835
 				}
1836 1836
 
1837 1837
 				// checks if the No Duplicates option is not validating entry against itself, since
1838 1838
 				// we're editing a stored entry, it would also assume it's a duplicate.
1839
-				if( !empty( $field->noDuplicates ) ) {
1839
+				if ( ! empty( $field->noDuplicates ) ) {
1840 1840
 
1841 1841
 				    $entry = $this->get_entry();
1842 1842
 
1843 1843
 				    // If the value of the entry is the same as the stored value
1844 1844
 				    // Then we can assume it's not a duplicate, it's the same.
1845
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1845
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1846 1846
 				        //if value submitted was not changed, then don't validate
1847 1847
 				        $field->failed_validation = false;
1848 1848
 
@@ -1855,7 +1855,7 @@  discard block
 block discarded – undo
1855 1855
 				}
1856 1856
 
1857 1857
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1858
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1858
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1859 1859
 				    unset( $field->validation_message );
1860 1860
 					$field->failed_validation = false;
1861 1861
 				    continue;
@@ -1867,12 +1867,12 @@  discard block
 block discarded – undo
1867 1867
 
1868 1868
 		}
1869 1869
 
1870
-		$validation_results['is_valid'] = $gv_valid;
1870
+		$validation_results[ 'is_valid' ] = $gv_valid;
1871 1871
 
1872 1872
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1873 1873
 
1874 1874
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1875
-		$this->form_after_validation = $validation_results['form'];
1875
+		$this->form_after_validation = $validation_results[ 'form' ];
1876 1876
 
1877 1877
 		return $validation_results;
1878 1878
 	}
@@ -1885,7 +1885,7 @@  discard block
 block discarded – undo
1885 1885
 	 */
1886 1886
 	public function get_entry() {
1887 1887
 
1888
-		if( empty( $this->entry ) ) {
1888
+		if ( empty( $this->entry ) ) {
1889 1889
 			// Get the database value of the entry that's being edited
1890 1890
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1891 1891
 		}
@@ -1917,10 +1917,10 @@  discard block
 block discarded – undo
1917 1917
 		}
1918 1918
 
1919 1919
 		// If edit tab not yet configured, show all fields
1920
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1920
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1921 1921
 
1922 1922
 		// Hide fields depending on admin settings
1923
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1923
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1924 1924
 
1925 1925
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1926 1926
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 	 */
1954 1954
 	private function filter_fields( $fields, $configured_fields ) {
1955 1955
 
1956
-		if( empty( $fields ) || !is_array( $fields ) ) {
1956
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1957 1957
 			return $fields;
1958 1958
 		}
1959 1959
 
@@ -1970,12 +1970,12 @@  discard block
 block discarded – undo
1970 1970
 
1971 1971
 			// Remove the fields that have calculation properties and keep them to be used later
1972 1972
 			// @since 1.16.2
1973
-			if( $field->has_calculation() ) {
1974
-				$this->fields_with_calculation[] = $field;
1973
+			if ( $field->has_calculation() ) {
1974
+				$this->fields_with_calculation[ ] = $field;
1975 1975
 				// don't remove the calculation fields on form render.
1976 1976
 			}
1977 1977
 
1978
-			if( in_array( $field->type, $field_type_blocklist ) ) {
1978
+			if ( in_array( $field->type, $field_type_blocklist ) ) {
1979 1979
 				unset( $fields[ $key ] );
1980 1980
 			}
1981 1981
 		}
@@ -2005,7 +2005,7 @@  discard block
 block discarded – undo
2005 2005
 					continue; // Never include when no fields are configured
2006 2006
 				}
2007 2007
 
2008
-				$out_fields[] = $field;
2008
+				$out_fields[ ] = $field;
2009 2009
 			}
2010 2010
 
2011 2011
 			return array_values( $out_fields );
@@ -2016,8 +2016,8 @@  discard block
 block discarded – undo
2016 2016
 
2017 2017
 	        /** @var GF_Field $field */
2018 2018
 	        foreach ( $fields as $field ) {
2019
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2020
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
2019
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
2020
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
2021 2021
 				    break;
2022 2022
 				}
2023 2023
 
@@ -2040,14 +2040,14 @@  discard block
 block discarded – undo
2040 2040
 
2041 2041
 		$return_field = $field;
2042 2042
 
2043
-		if( empty( $field_setting['show_label'] ) ) {
2043
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
2044 2044
 			$return_field->label = '';
2045
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
2046
-			$return_field->label = $field_setting['custom_label'];
2045
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
2046
+			$return_field->label = $field_setting[ 'custom_label' ];
2047 2047
 		}
2048 2048
 
2049
-		if( !empty( $field_setting['custom_class'] ) ) {
2050
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
2049
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
2050
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
2051 2051
 		}
2052 2052
 
2053 2053
 		/**
@@ -2085,16 +2085,16 @@  discard block
 block discarded – undo
2085 2085
 	     */
2086 2086
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
2087 2087
 
2088
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
2089
-			foreach( $fields as $k => $field ) {
2090
-				if( $field->adminOnly ) {
2088
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
2089
+			foreach ( $fields as $k => $field ) {
2090
+				if ( $field->adminOnly ) {
2091 2091
 				    unset( $fields[ $k ] );
2092 2092
 				}
2093 2093
 			}
2094 2094
 			return array_values( $fields );
2095 2095
 		}
2096 2096
 
2097
-	    foreach( $fields as &$field ) {
2097
+	    foreach ( $fields as &$field ) {
2098 2098
 		    $field->adminOnly = false;
2099 2099
 		}
2100 2100
 
@@ -2115,7 +2115,7 @@  discard block
 block discarded – undo
2115 2115
 	 */
2116 2116
 	private function unselect_default_values( $form ) {
2117 2117
 
2118
-	    foreach ( $form['fields'] as &$field ) {
2118
+	    foreach ( $form[ 'fields' ] as &$field ) {
2119 2119
 
2120 2120
 			if ( empty( $field->choices ) ) {
2121 2121
                 continue;
@@ -2123,7 +2123,7 @@  discard block
 block discarded – undo
2123 2123
 
2124 2124
             foreach ( $field->choices as &$choice ) {
2125 2125
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
2126
-					$choice['isSelected'] = false;
2126
+					$choice[ 'isSelected' ] = false;
2127 2127
 				}
2128 2128
 			}
2129 2129
 		}
@@ -2148,22 +2148,22 @@  discard block
 block discarded – undo
2148 2148
 	 */
2149 2149
 	function prefill_conditional_logic( $form ) {
2150 2150
 
2151
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2151
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
2152 2152
 			return $form;
2153 2153
 		}
2154 2154
 
2155 2155
 		// Have Conditional Logic pre-fill fields as if the data were default values
2156 2156
 		/** @var GF_Field $field */
2157
-		foreach ( $form['fields'] as &$field ) {
2157
+		foreach ( $form[ 'fields' ] as &$field ) {
2158 2158
 
2159
-			if( 'checkbox' === $field->type ) {
2159
+			if ( 'checkbox' === $field->type ) {
2160 2160
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
2161
-				    $input_id = $input['id'];
2161
+				    $input_id = $input[ 'id' ];
2162 2162
 				    $choice = $field->choices[ $key ];
2163 2163
 				    $value = \GV\Utils::get( $this->entry, $input_id );
2164 2164
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
2165
-				    if( $match ) {
2166
-				        $field->choices[ $key ]['isSelected'] = true;
2165
+				    if ( $match ) {
2166
+				        $field->choices[ $key ][ 'isSelected' ] = true;
2167 2167
 				    }
2168 2168
 				}
2169 2169
 			} else {
@@ -2171,15 +2171,15 @@  discard block
 block discarded – undo
2171 2171
 				// We need to run through each field to set the default values
2172 2172
 				foreach ( $this->entry as $field_id => $field_value ) {
2173 2173
 
2174
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
2174
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
2175 2175
 
2176
-				        if( 'list' === $field->type ) {
2176
+				        if ( 'list' === $field->type ) {
2177 2177
 				            $list_rows = maybe_unserialize( $field_value );
2178 2178
 
2179 2179
 				            $list_field_value = array();
2180
-				            foreach ( (array) $list_rows as $row ) {
2181
-				                foreach ( (array) $row as $column ) {
2182
-				                    $list_field_value[] = $column;
2180
+				            foreach ( (array)$list_rows as $row ) {
2181
+				                foreach ( (array)$row as $column ) {
2182
+				                    $list_field_value[ ] = $column;
2183 2183
 				                }
2184 2184
 				            }
2185 2185
 
@@ -2212,32 +2212,32 @@  discard block
 block discarded – undo
2212 2212
 		 * @see https://github.com/gravityview/GravityView/issues/840
2213 2213
 		 * @since develop
2214 2214
 		 */
2215
-		$the_form = GFAPI::get_form( $form['id'] );
2215
+		$the_form = GFAPI::get_form( $form[ 'id' ] );
2216 2216
 		$editable_ids = array();
2217
-		foreach ( $form['fields'] as $field ) {
2218
-			$editable_ids[] = $field['id']; // wp_list_pluck is destructive in this context
2217
+		foreach ( $form[ 'fields' ] as $field ) {
2218
+			$editable_ids[ ] = $field[ 'id' ]; // wp_list_pluck is destructive in this context
2219 2219
 		}
2220 2220
 		$remove_conditions_rule = array();
2221
-		foreach ( $the_form['fields'] as $field ) {
2222
-			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic['rules'] ) ) {
2223
-				foreach ( $field->conditionalLogic['rules'] as $i => $rule ) {
2224
-					if ( ! in_array( $rule['fieldId'], $editable_ids ) ) {
2221
+		foreach ( $the_form[ 'fields' ] as $field ) {
2222
+			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic[ 'rules' ] ) ) {
2223
+				foreach ( $field->conditionalLogic[ 'rules' ] as $i => $rule ) {
2224
+					if ( ! in_array( $rule[ 'fieldId' ], $editable_ids ) ) {
2225 2225
 						/**
2226 2226
 						 * This conditional field is not editable in this View.
2227 2227
 						 * We need to remove the rule, but only if it matches.
2228 2228
 						 */
2229
-						if ( $_field = GFAPI::get_field( $the_form, $rule['fieldId'] ) ) {
2229
+						if ( $_field = GFAPI::get_field( $the_form, $rule[ 'fieldId' ] ) ) {
2230 2230
 							$value = $_field->get_value_export( $this->entry );
2231
-						} elseif ( isset( $this->entry[ $rule['fieldId'] ] ) ) {
2232
-							$value = $this->entry[ $rule['fieldId'] ];
2231
+						} elseif ( isset( $this->entry[ $rule[ 'fieldId' ] ] ) ) {
2232
+							$value = $this->entry[ $rule[ 'fieldId' ] ];
2233 2233
 						} else {
2234
-							$value = gform_get_meta( $this->entry['id'], $rule['fieldId'] );
2234
+							$value = gform_get_meta( $this->entry[ 'id' ], $rule[ 'fieldId' ] );
2235 2235
 						}
2236 2236
 
2237
-						$match = GFFormsModel::matches_operation( $value, $rule['value'], $rule['operator'] );
2237
+						$match = GFFormsModel::matches_operation( $value, $rule[ 'value' ], $rule[ 'operator' ] );
2238 2238
 
2239 2239
 						if ( $match ) {
2240
-							$remove_conditions_rule[] = array( $field['id'], $i );
2240
+							$remove_conditions_rule[ ] = array( $field[ 'id' ], $i );
2241 2241
 						}
2242 2242
 					}
2243 2243
 				}
@@ -2245,21 +2245,21 @@  discard block
 block discarded – undo
2245 2245
 		}
2246 2246
 
2247 2247
 		if ( $remove_conditions_rule ) {
2248
-			foreach ( $form['fields'] as &$field ) {
2248
+			foreach ( $form[ 'fields' ] as &$field ) {
2249 2249
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2250 2250
 
2251 2251
 				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2252 2252
 
2253
-					if ( $field['id'] == $rule_field_id ) {
2254
-						unset( $field->conditionalLogic['rules'][ $rule_i ] );
2255
-						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field['id'] ) );
2253
+					if ( $field[ 'id' ] == $rule_field_id ) {
2254
+						unset( $field->conditionalLogic[ 'rules' ][ $rule_i ] );
2255
+						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field[ 'id' ] ) );
2256 2256
 					}
2257 2257
 				}
2258 2258
 			}
2259 2259
 		}
2260 2260
 
2261 2261
 		/** Normalize the indices... */
2262
-		$form['fields'] = array_values( $form['fields'] );
2262
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
2263 2263
 
2264 2264
 		/**
2265 2265
 		 * @filter `gravityview/edit_entry/conditional_logic` Should the Edit Entry form use Gravity Forms conditional logic showing/hiding of fields?
@@ -2269,16 +2269,16 @@  discard block
 block discarded – undo
2269 2269
 		 */
2270 2270
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
2271 2271
 
2272
-		if( $use_conditional_logic ) {
2272
+		if ( $use_conditional_logic ) {
2273 2273
 			return $form;
2274 2274
 		}
2275 2275
 
2276
-		foreach( $form['fields'] as &$field ) {
2276
+		foreach ( $form[ 'fields' ] as &$field ) {
2277 2277
 			/* @var GF_Field $field */
2278 2278
 			$field->conditionalLogic = null;
2279 2279
 		}
2280 2280
 
2281
-		unset( $form['button']['conditionalLogic'] );
2281
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
2282 2282
 
2283 2283
 		return $form;
2284 2284
 
@@ -2295,7 +2295,7 @@  discard block
 block discarded – undo
2295 2295
 	 */
2296 2296
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
2297 2297
 
2298
-		if( ! $this->is_edit_entry() ) {
2298
+		if ( ! $this->is_edit_entry() ) {
2299 2299
 			return $has_conditional_logic;
2300 2300
 		}
2301 2301
 
@@ -2327,44 +2327,44 @@  discard block
 block discarded – undo
2327 2327
 		 *  2. There are two entries embedded using oEmbed
2328 2328
 		 *  3. One of the entries has just been saved
2329 2329
 		 */
2330
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
2330
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
2331 2331
 
2332 2332
 			$error = true;
2333 2333
 
2334 2334
 		}
2335 2335
 
2336
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
2336
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
2337 2337
 
2338 2338
 			$error = true;
2339 2339
 
2340
-		} elseif( ! $this->verify_nonce() ) {
2340
+		} elseif ( ! $this->verify_nonce() ) {
2341 2341
 
2342 2342
 			/**
2343 2343
 			 * If the Entry is embedded, there may be two entries on the same page.
2344 2344
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
2345 2345
 			 */
2346
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2346
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2347 2347
 				$error = true;
2348 2348
 			} else {
2349
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
2349
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
2350 2350
 			}
2351 2351
 
2352 2352
 		}
2353 2353
 
2354
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2355
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
2354
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2355
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
2356 2356
 		}
2357 2357
 
2358
-		if( $this->entry['status'] === 'trash' ) {
2359
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
2358
+		if ( $this->entry[ 'status' ] === 'trash' ) {
2359
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
2360 2360
 		}
2361 2361
 
2362 2362
 		// No errors; everything's fine here!
2363
-		if( empty( $error ) ) {
2363
+		if ( empty( $error ) ) {
2364 2364
 			return true;
2365 2365
 		}
2366 2366
 
2367
-		if( $echo && $error !== true ) {
2367
+		if ( $echo && $error !== true ) {
2368 2368
 
2369 2369
 	        $error = esc_html( $error );
2370 2370
 
@@ -2372,10 +2372,10 @@  discard block
 block discarded – undo
2372 2372
 	         * @since 1.9
2373 2373
 	         */
2374 2374
 	        if ( ! empty( $this->entry ) ) {
2375
-		        $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;" ) );
2375
+		        $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;" ) );
2376 2376
 	        }
2377 2377
 
2378
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2378
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
2379 2379
 		}
2380 2380
 
2381 2381
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2395,17 +2395,17 @@  discard block
 block discarded – undo
2395 2395
 
2396 2396
 		$error = NULL;
2397 2397
 
2398
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2399
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
2398
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2399
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
2400 2400
 		}
2401 2401
 
2402 2402
 		// No errors; everything's fine here!
2403
-		if( empty( $error ) ) {
2403
+		if ( empty( $error ) ) {
2404 2404
 			return true;
2405 2405
 		}
2406 2406
 
2407
-		if( $echo ) {
2408
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2407
+		if ( $echo ) {
2408
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2409 2409
 		}
2410 2410
 
2411 2411
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2426,14 +2426,14 @@  discard block
 block discarded – undo
2426 2426
 	private function check_user_cap_edit_field( $field ) {
2427 2427
 
2428 2428
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2429
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2429
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2430 2430
 			return true;
2431 2431
 		}
2432 2432
 
2433
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2433
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2434 2434
 
2435
-		if( $field_cap ) {
2436
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2435
+		if ( $field_cap ) {
2436
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2437 2437
 		}
2438 2438
 
2439 2439
 		return false;
@@ -2447,17 +2447,17 @@  discard block
 block discarded – undo
2447 2447
 	public function verify_nonce() {
2448 2448
 
2449 2449
 		// Verify form submitted for editing single
2450
-		if( $this->is_edit_entry_submission() ) {
2450
+		if ( $this->is_edit_entry_submission() ) {
2451 2451
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2452 2452
 		}
2453 2453
 
2454 2454
 		// Verify
2455
-		else if( ! $this->is_edit_entry() ) {
2455
+		else if ( ! $this->is_edit_entry() ) {
2456 2456
 			$valid = false;
2457 2457
 		}
2458 2458
 
2459 2459
 		else {
2460
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2460
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2461 2461
 		}
2462 2462
 
2463 2463
 		/**
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
 		 */
2518 2518
 		$labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $this->form, $this->entry, $this->view_id );
2519 2519
 
2520
-		return (array) $labels;
2520
+		return (array)$labels;
2521 2521
 	}
2522 2522
 
2523 2523
 } //end class
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -700,7 +700,8 @@  discard block
 block discarded – undo
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
-							} else { // otherwise set to what it previously was
703
+							} else {
704
+// otherwise set to what it previously was
704 705
 								$_POST[ $input_name ] = $entry[ $input['id'] ];
705 706
 							}
706 707
 						} else {
@@ -1164,7 +1165,7 @@  discard block
 block discarded – undo
1164 1165
 
1165 1166
 		$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
1166 1167
 
1167
-		if( ! $this->is_valid ){
1168
+		if( ! $this->is_valid ) {
1168 1169
 
1169 1170
 			// Keeping this compatible with Gravity Forms.
1170 1171
 			$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
@@ -2454,9 +2455,7 @@  discard block
 block discarded – undo
2454 2455
 		// Verify
2455 2456
 		else if( ! $this->is_edit_entry() ) {
2456 2457
 			$valid = false;
2457
-		}
2458
-
2459
-		else {
2458
+		} else {
2460 2459
 			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2461 2460
 		}
2462 2461
 
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravity-forms-signature.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		$signature_fields = GFAPI::get_fields_by_type( $form, 'signature' );
54 54
 
55 55
 		foreach ( $signature_fields as $field ) {
56
-			unset( $_POST["input_{$field->id}"] );
56
+			unset( $_POST[ "input_{$field->id}" ] );
57 57
 		}
58 58
 	}
59 59
 
@@ -72,19 +72,19 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	function edit_entry_field_input( $field_content = '', $field = null, $value = '', $lead_id = 0, $form_id = 0 ) {
74 74
 
75
-		$context = function_exists('gravityview_get_context') ? gravityview_get_context() : '';
75
+		$context = function_exists( 'gravityview_get_context' ) ? gravityview_get_context() : '';
76 76
 
77
-		if( 'signature' !== $field->type || 'edit' !== $context ) {
77
+		if ( 'signature' !== $field->type || 'edit' !== $context ) {
78 78
 			return $field_content;
79 79
 		}
80 80
 
81 81
 		// We need to fetch a fresh version of the entry, since the saved entry hasn't refreshed in GV yet.
82 82
 		$entry = GravityView_View::getInstance()->getCurrentEntry();
83
-		$entry = GFAPI::get_entry( $entry['id'] );
83
+		$entry = GFAPI::get_entry( $entry[ 'id' ] );
84 84
 		$entry_value = \GV\Utils::get( $entry, $field->id );
85 85
 
86
-		$_POST["input_{$field->id}"] = $entry_value; // Used when Edit Entry form *is* submitted
87
-		$_POST["input_{$form_id}_{$field->id}_signature_filename"] = $entry_value; // Used when Edit Entry form *is not* submitted
86
+		$_POST[ "input_{$field->id}" ] = $entry_value; // Used when Edit Entry form *is* submitted
87
+		$_POST[ "input_{$form_id}_{$field->id}_signature_filename" ] = $entry_value; // Used when Edit Entry form *is not* submitted
88 88
 
89 89
 		return ''; // Return empty string to force using $_POST values instead
90 90
 	}
Please login to merge, or discard this patch.