Completed
Push — develop ( b49452...b2c39a )
by Gennady
17:49
created
includes/widgets/search-widget/templates/search-field-entry_date.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
 
8 8
 $gravityview_view = GravityView_View::getInstance();
9 9
 $view_id = $gravityview_view->getViewId();
10
-$value = $gravityview_view->search_field['value'];
11
-$label = $gravityview_view->search_field['label'];
10
+$value = $gravityview_view->search_field[ 'value' ];
11
+$label = $gravityview_view->search_field[ 'label' ];
12 12
 
13 13
 ?>
14 14
 
15 15
 <div class="gv-search-box gv-search-date gv-search-date-range gv-search-field-entry_date">
16
-	<?php if( ! gv_empty( $label, false, false ) ) { ?>
16
+	<?php if ( ! gv_empty( $label, false, false ) ) { ?>
17 17
 	<label for="gv_start_date_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label>
18 18
 	<?php } ?>
19 19
 	<p>
20
-		<input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo $value['start']; ?>">
21
-		<input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo $value['end']; ?>">
20
+		<input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo $value[ 'start' ]; ?>">
21
+		<input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo $value[ 'end' ]; ?>">
22 22
 	</p>
23 23
 </div>
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-date_range.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
 
8 8
 $gravityview_view = GravityView_View::getInstance();
9 9
 $view_id = $gravityview_view->getViewId();
10
-$value = $gravityview_view->search_field['value'];
11
-$label = $gravityview_view->search_field['label'];
12
-$name = $gravityview_view->search_field['name'];
10
+$value = $gravityview_view->search_field[ 'value' ];
11
+$label = $gravityview_view->search_field[ 'label' ];
12
+$name = $gravityview_view->search_field[ 'name' ];
13 13
 ?>
14 14
 
15 15
 <div class="gv-search-box gv-search-date gv-search-date-range">
16
-	<?php if( ! gv_empty( $label, false, false ) ) { ?>
17
-	<label for="search-box-<?php echo esc_attr( $name ).'-start'; ?>"><?php echo esc_html( $label ); ?></label>
16
+	<?php if ( ! gv_empty( $label, false, false ) ) { ?>
17
+	<label for="search-box-<?php echo esc_attr( $name ) . '-start'; ?>"><?php echo esc_html( $label ); ?></label>
18 18
 	<?php } ?>
19 19
 	<p>
20
-		<input name="<?php echo esc_attr( $name ).'[start]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['start'] ); ?>">
21
-		<input name="<?php echo esc_attr( $name ).'[end]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['end'] ); ?>">
20
+		<input name="<?php echo esc_attr( $name ) . '[start]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'start' ] ); ?>">
21
+		<input name="<?php echo esc_attr( $name ) . '[end]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'end' ] ); ?>">
22 22
 	</p>
23 23
 </div>
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
future/includes/class-gv-entry.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$args = array();
115 115
 
116
-		$view_id = is_null ( $view ) ? null : $view->ID;
116
+		$view_id = is_null( $view ) ? null : $view->ID;
117 117
 
118 118
 		$permalink = null;
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
 				$view_collection = View_Collection::from_post( $post );
128 128
 
129
-				if( 1 < $view_collection->count() ) {
130
-					$args['gvid'] = $view_id;
129
+				if ( 1 < $view_collection->count() ) {
130
+					$args[ 'gvid' ] = $view_id;
131 131
 				}
132 132
 			}
133 133
 		}
@@ -156,21 +156,21 @@  discard block
 block discarded – undo
156 156
 			 */
157 157
 			$link_parts = explode( '?', $permalink );
158 158
 
159
-			$query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : '';
159
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
160 160
 
161
-			$permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query;
161
+			$permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query;
162 162
 		} else {
163 163
 			$args[ $entry_endpoint_name ] = $entry_slug;
164 164
 		}
165 165
 
166 166
 		if ( $track_directory ) {
167
-			if ( ! empty( $_GET['pagenum'] ) ) {
168
-				$args['pagenum'] = intval( $_GET['pagenum'] );
167
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
168
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
169 169
 			}
170 170
 
171 171
 			if ( $sort = Utils::_GET( 'sort' ) ) {
172
-				$args['sort'] = $sort;
173
-				$args['dir'] = Utils::_GET( 'dir' );
172
+				$args[ 'sort' ] = $sort;
173
+				$args[ 'dir' ] = Utils::_GET( 'dir' );
174 174
 			}
175 175
 		}
176 176
 
Please login to merge, or discard this patch.
future/includes/class-gv-shortcode-gravityview.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,9 @@
 block discarded – undo
79 79
 		 * Check permissions.
80 80
 		 */
81 81
 		while ( $error = $view->can_render( array( 'shortcode' ), $request ) ) {
82
-			if ( ! is_wp_error( $error ) )
83
-				break;
82
+			if ( ! is_wp_error( $error ) ) {
83
+							break;
84
+			}
84 85
 
85 86
 			switch ( str_replace( 'gravityview/', '', $error->get_error_code() ) ) {
86 87
 				case 'post_password_required':
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 			'detail' => null,
42 42
 		) );
43 43
 		
44
-		if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) {
45
-			if ( $atts['detail'] && $view = $request->is_view() ) {
44
+		if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) {
45
+			if ( $atts[ 'detail' ] && $view = $request->is_view() ) {
46 46
 				$view_id = $view->ID;
47 47
 			}
48 48
 		}
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 			}
112 112
 		}
113 113
 
114
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
114
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
115 115
 
116 116
 		/**
117 117
 		 * View details.
118 118
 		 */
119
-		if ( $atts['detail'] ) {
119
+		if ( $atts[ 'detail' ] ) {
120 120
 			$entries = $view->get_entries( $request );
121 121
 			return self::_return( $this->detail( $view, $entries, $atts ) );
122 122
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 				return self::_return( '' );
134 134
 			}
135 135
 
136
-			if ( $entry['status'] != 'active' ) {
136
+			if ( $entry[ 'status' ] != 'active' ) {
137 137
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
138 138
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
139 139
 			}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 			}
145 145
 
146 146
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
147
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
147
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
148 148
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
149 149
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
150 150
 				}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			$entryset = $entry->is_multi() ? $entry->entries : array( $entry );
168 168
 
169 169
 			foreach ( $entryset as $e ) {
170
-				if ( $e['status'] != 'active' ) {
170
+				if ( $e[ 'status' ] != 'active' ) {
171 171
 					gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) );
172 172
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
173 173
 				}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 				}
179 179
 
180 180
 				if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
181
-					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
181
+					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
182 182
 						gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) );
183 183
 						return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
184 184
 					}
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
 				
204 204
 				// Mock the request with the actual View, not the global one
205 205
 				$mock_request = new \GV\Mock_Request();
206
-				$mock_request->returns['is_view'] = $view;
207
-				$mock_request->returns['is_entry'] = $request->is_entry( $view->form ? $view->form->ID : 0 );
208
-				$mock_request->returns['is_edit_entry'] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 );
209
-				$mock_request->returns['is_search'] = $request->is_search();
206
+				$mock_request->returns[ 'is_view' ] = $view;
207
+				$mock_request->returns[ 'is_entry' ] = $request->is_entry( $view->form ? $view->form->ID : 0 );
208
+				$mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 );
209
+				$mock_request->returns[ 'is_search' ] = $request->is_search();
210 210
 
211 211
 				$request = $mock_request;
212 212
 			}
@@ -242,16 +242,16 @@  discard block
 block discarded – undo
242 242
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
243 243
 
244 244
 		// Only keep the passed attributes after making sure that they're valid pairs
245
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
245
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
246 246
 
247 247
 		$atts = array();
248 248
 
249
-		foreach( $filtered_atts as $key => $passed_value ) {
249
+		foreach ( $filtered_atts as $key => $passed_value ) {
250 250
 
251 251
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
252 252
 			$passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value );
253 253
 
254
-			switch( $defaults[ $key ]['type'] ) {
254
+			switch ( $defaults[ $key ][ 'type' ] ) {
255 255
 
256 256
 				/**
257 257
 				 * Make sure number fields are numeric.
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
260 260
 				 */
261 261
 				case 'number':
262
-					if( is_numeric( $passed_value ) ) {
262
+					if ( is_numeric( $passed_value ) ) {
263 263
 						$atts[ $key ] = ( $passed_value + 0 );
264 264
 					}
265 265
 					break;
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 				 */
275 275
 				case 'select':
276 276
 				case 'radio':
277
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
278
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
277
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
278
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
279 279
 						$atts[ $key ] = $passed_value;
280 280
 					}
281 281
 					break;
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 			}
288 288
 		}
289 289
 
290
-		$atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null );
290
+		$atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null );
291 291
 
292 292
 		return $atts;
293 293
 	}
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	private function detail( $view, $entries, $atts ) {
305 305
 		$output = '';
306 306
 
307
-		switch ( $key = $atts['detail'] ):
307
+		switch ( $key = $atts[ 'detail' ] ):
308 308
 			case 'total_entries':
309 309
 				$output = number_format_i18n( $entries->total() );
310 310
 				break;
Please login to merge, or discard this patch.
includes/class-admin-installer.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 *
50 50
 	 * @param array $items Scripts or styles to exclude from no-conflict
51 51
 	 *
52
-	 * @return array
52
+	 * @return string[]
53 53
 	 */
54 54
 	public function register_noconflict( $items ) {
55 55
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -449,9 +449,7 @@
 block discarded – undo
449 449
 			$button_label = sprintf( __( 'Upgrade to %s for Access', 'gravityview' ), $required_license );
450 450
 			$button_class = 'button-primary button-large';
451 451
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
452
-		}
453
-
454
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
452
+		} elseif ( ! empty( $download_info['coming_soon'] ) ) {
455 453
 	        $spinner      = false;
456 454
 	        $status       = 'notinstalled';
457 455
 	        $status_label = __( 'Coming Soon', 'gravityview' );
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function register_noconflict( $items ) {
55 55
 
56
-		$items[] = 'gravityview-admin-installer';
56
+		$items[ ] = 'gravityview-admin-installer';
57 57
 
58 58
 		return $items;
59 59
 	}
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 			return;
73 73
 		}
74 74
 
75
-		add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) {
75
+		add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) {
76 76
 			foreach ( $downloads_data as $extension ) {
77
-				if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) {
77
+				if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) {
78 78
 					continue;
79 79
 				}
80 80
 
81
-				return (object) array(
82
-					'slug'          => $extension['info']['slug'],
83
-					'name'          => $extension['info']['title'],
84
-					'version'       => $extension['licensing']['version'],
85
-					'download_link' => $extension['files'][0]['file'],
81
+				return (object)array(
82
+					'slug'          => $extension[ 'info' ][ 'slug' ],
83
+					'name'          => $extension[ 'info' ][ 'title' ],
84
+					'version'       => $extension[ 'licensing' ][ 'version' ],
85
+					'download_link' => $extension[ 'files' ][ 0 ][ 'file' ],
86 86
 				);
87 87
 			}
88 88
 
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 
145 145
 		foreach ( $all_plugins as $path => $plugin ) {
146 146
 
147
-			if ( empty( $plugin['TextDomain'] ) ) {
147
+			if ( empty( $plugin[ 'TextDomain' ] ) ) {
148 148
 				continue;
149 149
 			}
150 150
 
151
-			$wp_plugins[ $plugin['TextDomain'] ] = array(
151
+			$wp_plugins[ $plugin[ 'TextDomain' ] ] = array(
152 152
 				'path'      => $path,
153
-				'version'   => $plugin['Version'],
153
+				'version'   => $plugin[ 'Version' ],
154 154
 				'activated' => is_plugin_active( $path )
155 155
 			);
156 156
 		}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			return $downloads_data;
209 209
 		}
210 210
 
211
-		if( \GV\Plugin::is_network_activated() ) {
211
+		if ( \GV\Plugin::is_network_activated() ) {
212 212
 			$home_url = network_home_url();
213 213
 		} else {
214 214
 			$home_url = home_url();
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$downloads_data = json_decode( wp_remote_retrieve_body( $response ), true );
238 238
 
239
-		if ( empty( $downloads_data['products'] ) ) {
239
+		if ( empty( $downloads_data[ 'products' ] ) ) {
240 240
 			return array();
241 241
 		}
242 242
 
243
-		$this->set_downloads_data( $downloads_data['products'] );
243
+		$this->set_downloads_data( $downloads_data[ 'products' ] );
244 244
 
245
-		return $downloads_data['products'];
245
+		return $downloads_data[ 'products' ];
246 246
 	}
247 247
 
248 248
 	/**
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
 				foreach ( $downloads_data as $extension ) {
317 317
 
318
-					if ( empty( $extension['info'] ) ) {
318
+					if ( empty( $extension[ 'info' ] ) ) {
319 319
 						continue;
320 320
 					}
321 321
 
@@ -344,29 +344,29 @@  discard block
 block discarded – undo
344 344
 
345 345
         $details = $this->get_download_display_details( $download, $wp_plugins );
346 346
 
347
-        $download_info = $details['download_info'];
347
+        $download_info = $details[ 'download_info' ];
348 348
 
349 349
 		?>
350
-        <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
350
+        <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>">
351 351
             <div class="addon-inner">
352
-                <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a>
353
-                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3>
352
+                <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a>
353
+                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3>
354 354
                 <div>
355
-                    <?php if( ! empty( $details['status_label'] ) ) { ?>
356
-                    <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>">
357
-                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span>
355
+                    <?php if ( ! empty( $details[ 'status_label' ] ) ) { ?>
356
+                    <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>">
357
+                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span>
358 358
                     </div>
359 359
 			        <?php } ?>
360 360
 
361
-                    <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>">
362
-                        <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span>
363
-                        <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?>
361
+                    <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>">
362
+                        <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span>
363
+                        <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?>
364 364
                     </a>
365 365
                 </div>
366 366
 
367 367
                 <div class="addon-excerpt"><?php
368 368
 
369
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
369
+                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] );
370 370
 
371 371
                     // Allow some pure HTML tags, but remove everything else from the excerpt.
372 372
                     $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	 */
407 407
 	private function get_download_display_details( $download, $wp_plugins ) {
408 408
 
409
-		$download_info = wp_parse_args( (array) $download['info'], array(
409
+		$download_info = wp_parse_args( (array)$download[ 'info' ], array(
410 410
 			'thumbnail' => '',
411 411
 			'title' => '',
412 412
 			'textdomain' => '',
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
 			'installer_excerpt' => null, // May not be defined
419 419
 		) );
420 420
 
421
-		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false );
421
+		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false );
422 422
 
423
-		$has_access = ! empty( $download['files'] );
423
+		$has_access = ! empty( $download[ 'files' ] );
424 424
 		$spinner = true;
425 425
 		$href = $plugin_path = '#';
426 426
 		$status = $item_class = $button_title = $button_class = '';
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 		$required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' );
431 431
 
432 432
 		// The license is not active - no matter what level, this should not work
433
-		if( ! $is_active  && empty( $base_price ) ) {
433
+		if ( ! $is_active && empty( $base_price ) ) {
434 434
 			$spinner      = false;
435 435
 			$status_label = '';
436 436
 			$button_class = 'disabled disabled-license';
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 			$status_label = '';
444 444
 			$button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price );
445 445
 			$button_class = 'button-primary button-large';
446
-			$href         = $download_info['link'];
446
+			$href         = $download_info[ 'link' ];
447 447
 			$item_class   = 'featured';
448 448
 		}
449 449
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
457 457
 		}
458 458
 
459
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
459
+        elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) {
460 460
 	        $spinner      = false;
461 461
 	        $status       = 'notinstalled';
462 462
 	        $status_label = __( 'Coming Soon', 'gravityview' );
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
 			$href = add_query_arg(
472 472
 				array(
473 473
 					'action'   => 'install-plugin',
474
-					'plugin'   => $download_info['slug'],
475
-					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ),
474
+					'plugin'   => $download_info[ 'slug' ],
475
+					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ),
476 476
 				),
477 477
 				self_admin_url( 'update.php' )
478 478
 			);
@@ -484,25 +484,25 @@  discard block
 block discarded – undo
484 484
 		}
485 485
 
486 486
 		// Access and the plugin is installed but not active
487
-		elseif ( false === $wp_plugin['activated'] ) {
487
+		elseif ( false === $wp_plugin[ 'activated' ] ) {
488 488
 			$status = 'inactive';
489 489
 			$status_label = __( 'Inactive', 'gravityview' );
490 490
 			$button_label = __( 'Activate', 'gravityview' );
491
-			$plugin_path = $wp_plugin['path'];
491
+			$plugin_path = $wp_plugin[ 'path' ];
492 492
 
493 493
 		}
494 494
 
495 495
 		// Access and the plugin is installed and active
496 496
 		else {
497 497
 
498
-			$plugin_path = $wp_plugin['path'];
498
+			$plugin_path = $wp_plugin[ 'path' ];
499 499
 			$status = 'active';
500 500
 			$status_label = __( 'Active', 'gravityview' );
501 501
 			$button_label = __( 'Deactivate', 'gravityview' );
502 502
 
503 503
 		}
504 504
 
505
-		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
505
+		return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
506 506
     }
507 507
 
508 508
 	/**
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
 	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
518 518
 		$base_price = \GFCommon::to_number( $base_price );
519 519
 
520
-		unset( $download['pricing']['amount'] );
520
+		unset( $download[ 'pricing' ][ 'amount' ] );
521 521
 
522 522
 		// Price options array, not single price
523
-		if ( ! $base_price && ! empty( $download['pricing'] ) ) {
524
-			$base_price = array_shift( $download['pricing'] );
523
+		if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) {
524
+			$base_price = array_shift( $download[ 'pricing' ] );
525 525
 		}
526 526
 
527 527
 		return floatval( $base_price );
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
 	public function activate_download() {
536 536
 		$data = \GV\Utils::_POST( 'data', array() );
537 537
 
538
-		if ( empty( $data['path'] ) ) {
538
+		if ( empty( $data[ 'path' ] ) ) {
539 539
 			return;
540 540
 		}
541 541
 
542
-		$result = activate_plugin( $data['path'] );
542
+		$result = activate_plugin( $data[ 'path' ] );
543 543
 
544
-		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
544
+		if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) {
545 545
 			wp_send_json_error( array(
546 546
                 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
547 547
             ) );
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 	public function deactivate_download() {
559 559
 		$data = \GV\Utils::_POST( 'data', array() );
560 560
 
561
-		if ( empty( $data['path'] ) ) {
561
+		if ( empty( $data[ 'path' ] ) ) {
562 562
 			return;
563 563
 		}
564 564
 
565
-		deactivate_plugins( $data['path'] );
565
+		deactivate_plugins( $data[ 'path' ] );
566 566
 
567
-		if( is_plugin_active( $data['path'] ) ) {
567
+		if ( is_plugin_active( $data[ 'path' ] ) ) {
568 568
             wp_send_json_error( array(
569 569
                 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
570 570
             ) );
Please login to merge, or discard this patch.
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function add_downloads_data_filters() {
68 68
 
69
-	    $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT );
69
+		$downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT );
70 70
 
71
-	    if ( ! $downloads_data ) {
71
+		if ( ! $downloads_data ) {
72 72
 			return;
73 73
 		}
74 74
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function add_admin_menu() {
99 99
 
100
-	    $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' );
100
+		$menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' );
101 101
 
102 102
 		$menu_text = sprintf( '<span title="%s" style="margin: 0">%s</span>', esc_attr__( 'Plugins that extend GravityView and Gravity Forms functionality.', 'gravityview' ), $menu_text );
103 103
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	}
113 113
 
114 114
 	/**
115
-     * When on the Installer page, show a different notice than on the Settings page
116
-     *
115
+	 * When on the Installer page, show a different notice than on the Settings page
116
+	 *
117 117
 	 * @param array $notice
118 118
 	 *
119 119
 	 * @return string License notice
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 	public function maybe_modify_license_notice( $notice = '' ) {
122 122
 
123 123
 		if ( ! gravityview()->request->is_admin( '', 'downloads' ) ) {
124
-            return $notice;
125
-        }
124
+			return $notice;
125
+		}
126 126
 
127
-        return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' );
127
+		return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' );
128 128
 	}
129 129
 
130 130
 	/**
@@ -162,43 +162,43 @@  discard block
 block discarded – undo
162 162
 	 * Get downloads data from transient or from API; save transient after getting data from API
163 163
 	 *
164 164
 	 * @return WP_Error|array If error, returns WP_Error. If not valid JSON, empty array. Otherwise, this structure: {
165
-     *   @type array  $info {
166
-     *       @type string $id int 17
167
-     *       @type string $slug Extension slug
168
-     *       @type string $title Extension title
169
-     *       @type string $create_date in '2018-07-19 20:03:10' format
170
-     *       @type string $modified_date
171
-     *       @type string $status
172
-     *       @type string $link URL to public plugin page
173
-     *       @type string $content
174
-     *       @type string $excerpt
175
-     *       @type string $thumbnail URL to thumbnail
176
-     *       @type array  $category Taxonomy details for the plugin's category {
177
-     *         @type int $term_id => int 30
178
-     *         @type string $name => string 'Plugins' (length=7)
179
-     *         @type string $slug => string 'plugins' (length=7)
180
-     *         @type int $term_group => int 0
181
-     *         @type int $term_taxonomy_id => int 30
182
-     *         @type string $taxonomy => string 'download_category' (length=17)
183
-     *         @type string $description => string '' (length=0)
184
-     *         @type int $parent => int 0
185
-     *         @type int $count => int 4
186
-     *         @type string $filter => string 'raw' (length=3)
187
-     *       }
188
-     *       @type array $tags {see $category above}
189
-     *       @type string $textdomain string 'gravityview' (length=11)
190
-     *   }
191
-     *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
192
-     *   @type array $licensing {
193
-     *       @type bool   $enabled Is licensing enabled for the extension
194
-     *       @type string $version Version number
195
-     *       @type string $exp_unit Expiration unit ('years')
196
-     *       @type string $exp_length Expiration length ('1')
197
-     *   }
198
-     *   @type array $files Array of files. Empty if user has no access to the file. {
199
-     *       @type string $file string URL of the file download
200
-     *   }
201
-     * }
165
+	 *   @type array  $info {
166
+	 *       @type string $id int 17
167
+	 *       @type string $slug Extension slug
168
+	 *       @type string $title Extension title
169
+	 *       @type string $create_date in '2018-07-19 20:03:10' format
170
+	 *       @type string $modified_date
171
+	 *       @type string $status
172
+	 *       @type string $link URL to public plugin page
173
+	 *       @type string $content
174
+	 *       @type string $excerpt
175
+	 *       @type string $thumbnail URL to thumbnail
176
+	 *       @type array  $category Taxonomy details for the plugin's category {
177
+	 *         @type int $term_id => int 30
178
+	 *         @type string $name => string 'Plugins' (length=7)
179
+	 *         @type string $slug => string 'plugins' (length=7)
180
+	 *         @type int $term_group => int 0
181
+	 *         @type int $term_taxonomy_id => int 30
182
+	 *         @type string $taxonomy => string 'download_category' (length=17)
183
+	 *         @type string $description => string '' (length=0)
184
+	 *         @type int $parent => int 0
185
+	 *         @type int $count => int 4
186
+	 *         @type string $filter => string 'raw' (length=3)
187
+	 *       }
188
+	 *       @type array $tags {see $category above}
189
+	 *       @type string $textdomain string 'gravityview' (length=11)
190
+	 *   }
191
+	 *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
192
+	 *   @type array $licensing {
193
+	 *       @type bool   $enabled Is licensing enabled for the extension
194
+	 *       @type string $version Version number
195
+	 *       @type string $exp_unit Expiration unit ('years')
196
+	 *       @type string $exp_length Expiration length ('1')
197
+	 *   }
198
+	 *   @type array $files Array of files. Empty if user has no access to the file. {
199
+	 *       @type string $file string URL of the file download
200
+	 *   }
201
+	 * }
202 202
 	 */
203 203
 	public function get_downloads_data() {
204 204
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		) );
231 231
 
232 232
 		if ( is_wp_error( $response ) ) {
233
-		    gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
233
+			gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
234 234
 			return $response;
235 235
 		}
236 236
 
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
                 <div class="gv-admin-installer-notice notice inline error">
284 284
                     <h3><?php esc_html_e( 'Extensions and plugins data cannot be loaded at the moment. Please try again later.', 'gravityview' ); ?></h3>
285 285
                     <?php
286
-                    if ( is_wp_error( $downloads_data ) ) {
287
-	                    echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
288
-                    }
289
-                    ?>
286
+					if ( is_wp_error( $downloads_data ) ) {
287
+						echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
288
+					}
289
+					?>
290 290
                 </div>
291 291
             </div>
292 292
 			<?php
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
 	protected function render_download( $download, $wp_plugins ) {
343 343
 
344 344
 
345
-        $details = $this->get_download_display_details( $download, $wp_plugins );
345
+		$details = $this->get_download_display_details( $download, $wp_plugins );
346 346
 
347
-        $download_info = $details['download_info'];
347
+		$download_info = $details['download_info'];
348 348
 
349 349
 		?>
350 350
         <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
@@ -366,43 +366,43 @@  discard block
 block discarded – undo
366 366
 
367 367
                 <div class="addon-excerpt"><?php
368 368
 
369
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
369
+					$excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
370 370
 
371
-                    // Allow some pure HTML tags, but remove everything else from the excerpt.
372
-                    $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
373
-                    $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
371
+					// Allow some pure HTML tags, but remove everything else from the excerpt.
372
+					$tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
373
+					$replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
374 374
 
375
-                    $excerpt = str_replace( $tags, $replacements, $excerpt );
376
-                    $excerpt = esc_html( strip_tags( $excerpt ) );
375
+					$excerpt = str_replace( $tags, $replacements, $excerpt );
376
+					$excerpt = esc_html( strip_tags( $excerpt ) );
377 377
 					$excerpt = str_replace( $replacements, $tags, $excerpt );
378 378
 
379 379
 					echo wpautop( $excerpt );
380
-                ?></div>
380
+				?></div>
381 381
             </div>
382 382
         </div>
383 383
 		<?php
384 384
 	}
385 385
 
386 386
 	/**
387
-     * Generates details array for the download to keep the render_download() method a bit tidier
388
-     *
387
+	 * Generates details array for the download to keep the render_download() method a bit tidier
388
+	 *
389 389
 	 * @param array $download Single download, as returned by {@see get_downloads_data}
390 390
 	 * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()}
391 391
 	 *
392 392
 	 * @return array {
393
-     *   @type array $download_info
394
-     *   @type string $plugin_path
395
-     *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
396
-     *   @type string $status_label
397
-     *   @type string $button_title Title attribute to show when hovering over the download's button
398
-     *   @type string $button_class CSS class to use for the button
399
-     *   @type string $button_label Text to use for the download's anchor link
400
-     *   @type string $href URL for the download's button
401
-     *   @type bool   $spinner Whether to show the spinner icon
402
-     *   @type string $item_class CSS class for the download container
403
-     *   @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions")
404
-     *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
405
-     * }
393
+	 *   @type array $download_info
394
+	 *   @type string $plugin_path
395
+	 *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
396
+	 *   @type string $status_label
397
+	 *   @type string $button_title Title attribute to show when hovering over the download's button
398
+	 *   @type string $button_class CSS class to use for the button
399
+	 *   @type string $button_label Text to use for the download's anchor link
400
+	 *   @type string $href URL for the download's button
401
+	 *   @type bool   $spinner Whether to show the spinner icon
402
+	 *   @type string $item_class CSS class for the download container
403
+	 *   @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions")
404
+	 *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
405
+	 * }
406 406
 	 */
407 407
 	private function get_download_display_details( $download, $wp_plugins ) {
408 408
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			'slug' => '',
414 414
 			'excerpt' => '',
415 415
 			'link' => '',
416
-            'coming_soon' => false,
416
+			'coming_soon' => false,
417 417
 			'installer_title' => null, // May not be defined
418 418
 			'installer_excerpt' => null, // May not be defined
419 419
 		) );
@@ -456,14 +456,14 @@  discard block
 block discarded – undo
456 456
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
457 457
 		}
458 458
 
459
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
460
-	        $spinner      = false;
461
-	        $status       = 'notinstalled';
462
-	        $status_label = __( 'Coming Soon', 'gravityview' );
463
-	        $button_label = __( 'Learn More', 'gravityview' );
464
-	        $button_class = 'button-primary button-large';
465
-	        $href         = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' );
466
-        }
459
+		elseif ( ! empty( $download_info['coming_soon'] ) ) {
460
+			$spinner      = false;
461
+			$status       = 'notinstalled';
462
+			$status_label = __( 'Coming Soon', 'gravityview' );
463
+			$button_label = __( 'Learn More', 'gravityview' );
464
+			$button_class = 'button-primary button-large';
465
+			$href         = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' );
466
+		}
467 467
 
468 468
 		// Access but the plugin is not installed
469 469
 		elseif ( ! $wp_plugin ) {
@@ -503,18 +503,18 @@  discard block
 block discarded – undo
503 503
 		}
504 504
 
505 505
 		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
506
-    }
506
+	}
507 507
 
508 508
 	/**
509
-     * Returns the base price for an extension
510
-     *
509
+	 * Returns the base price for an extension
510
+	 *
511 511
 	 * @param array $download
512 512
 	 *
513 513
 	 * @return float Base price for an extension. If not for sale separately, returns 0
514 514
 	 */
515 515
 	private function get_download_base_price( $download ) {
516 516
 
517
-	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
517
+		$base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
518 518
 		$base_price = \GFCommon::to_number( $base_price );
519 519
 
520 520
 		unset( $download['pricing']['amount'] );
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		}
526 526
 
527 527
 		return floatval( $base_price );
528
-    }
528
+	}
529 529
 
530 530
 	/**
531 531
 	 * Handle AJAX request to activate extension
@@ -543,8 +543,8 @@  discard block
 block discarded – undo
543 543
 
544 544
 		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
545 545
 			wp_send_json_error( array(
546
-                'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
547
-            ) );
546
+				'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
547
+			) );
548 548
 		}
549 549
 
550 550
 		wp_send_json_success();
@@ -565,10 +565,10 @@  discard block
 block discarded – undo
565 565
 		deactivate_plugins( $data['path'] );
566 566
 
567 567
 		if( is_plugin_active( $data['path'] ) ) {
568
-            wp_send_json_error( array(
569
-                'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
570
-            ) );
571
-        }
568
+			wp_send_json_error( array(
569
+				'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
570
+			) );
571
+		}
572 572
 
573 573
 		wp_send_json_success();
574 574
 	}
Please login to merge, or discard this patch.
future/includes/rest/class-gv-rest-route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 		$format = '(?:\.(?P<format>html|json))?';
134 134
 
135
-		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ) , array(
135
+		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ), array(
136 136
 			array(
137 137
 				'methods'         => \WP_REST_Server::READABLE,
138 138
 				'callback'        => array( $this, 'get_sub_item' ),
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @return \WP_REST_Response
384 384
 	 */
385 385
 	protected function not_implemented(  ) {
386
-		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' )  );
386
+		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) );
387 387
 		return new \WP_REST_Response( $error, 501 );
388 388
 	}
389 389
 
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@
 block discarded – undo
282 282
 	/**
283 283
 	 * Process edit entry form save
284 284
 	 *
285
-	 * @param array $gv_data The View data.
285
+	 * @param GravityView_View_Data $gv_data The View data.
286 286
 	 */
287 287
 	private function process_save( $gv_data ) {
288 288
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -573,7 +573,8 @@  discard block
 block discarded – undo
573 573
 
574 574
 							// Only allow quantity to be set if it's allowed to be edited
575 575
 							if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) {
576
-							} else { // otherwise set to what it previously was
576
+							} else {
577
+// otherwise set to what it previously was
577 578
 								$_POST[ $input_name ] = $entry[ $input['id'] ];
578 579
 							}
579 580
 						} else {
@@ -958,7 +959,7 @@  discard block
 block discarded – undo
958 959
 
959 960
 			$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
960 961
 
961
-			if( ! $this->is_valid ){
962
+			if( ! $this->is_valid ) {
962 963
 
963 964
 				// Keeping this compatible with Gravity Forms.
964 965
 				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
@@ -2070,9 +2071,7 @@  discard block
 block discarded – undo
2070 2071
 		// Verify
2071 2072
 		else if( ! $this->is_edit_entry() ) {
2072 2073
 			$valid = false;
2073
-		}
2074
-
2075
-		else {
2074
+		} else {
2076 2075
 			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2077 2076
 		}
2078 2077
 
Please login to merge, or discard this patch.
Indentation   +289 added lines, -289 removed lines patch added patch discarded remove patch
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 
103 103
 	/**
104 104
 	 * ID of the current post. May also be ID of the current View.
105
-     *
106
-     * @since 2.0.13
107
-     * 
108
-     * @var int
105
+	 *
106
+	 * @since 2.0.13
107
+	 * 
108
+	 * @var int
109 109
 	 */
110 110
 	public $post_id;
111 111
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public function prevent_maybe_process_form() {
189 189
 
190
-	    if( ! $this->is_edit_entry_submission() ) {
190
+		if( ! $this->is_edit_entry_submission() ) {
191 191
 			return;
192 192
 		}
193 193
 
@@ -221,14 +221,14 @@  discard block
 block discarded – undo
221 221
 	 * When Edit entry view is requested setup the vars
222 222
 	 */
223 223
 	private function setup_vars() {
224
-        global $post;
224
+		global $post;
225 225
 
226 226
 		$gravityview_view = GravityView_View::getInstance();
227 227
 
228 228
 
229 229
 		$entries = $gravityview_view->getEntries();
230
-	    self::$original_entry = $entries[0];
231
-	    $this->entry = $entries[0];
230
+		self::$original_entry = $entries[0];
231
+		$this->entry = $entries[0];
232 232
 
233 233
 		self::$original_form = $gravityview_view->getForm();
234 234
 		$this->form = $gravityview_view->getForm();
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 
371 371
 			GFFormsModel::save_lead( $form, $this->entry );
372 372
 
373
-	        // Delete the values for hidden inputs
374
-	        $this->unset_hidden_field_values();
373
+			// Delete the values for hidden inputs
374
+			$this->unset_hidden_field_values();
375 375
 			
376 376
 			$this->entry['date_created'] = $date_created;
377 377
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 			// Perform actions normally performed after updating a lead
382 382
 			$this->after_update();
383 383
 
384
-	        /**
384
+			/**
385 385
 			 * Must be AFTER after_update()!
386 386
 			 * @see https://github.com/gravityview/GravityView/issues/764
387 387
 			 */
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
 			/**
391 391
 			 * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry
392
-             * @since 2.1 Added $gv_data parameter
392
+			 * @since 2.1 Added $gv_data parameter
393 393
 			 * @param array $form Gravity Forms form array
394 394
 			 * @param string $entry_id Numeric ID of the entry that was updated
395 395
 			 * @param GravityView_Edit_Entry_Render $this This object
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 	 * @return void
414 414
 	 */
415 415
 	private function unset_hidden_field_values() {
416
-	    global $wpdb;
416
+		global $wpdb;
417 417
 
418 418
 		/**
419 419
 		 * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic
@@ -437,17 +437,17 @@  discard block
 block discarded – undo
437 437
 			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
438 438
 		}
439 439
 
440
-	    foreach ( $this->entry as $input_id => $field_value ) {
440
+		foreach ( $this->entry as $input_id => $field_value ) {
441 441
 
442 442
 			if ( ! is_numeric( $input_id ) ) {
443 443
 				continue;
444 444
 			}
445 445
 
446
-		    $field = RGFormsModel::get_field( $this->form, $input_id );
446
+			$field = RGFormsModel::get_field( $this->form, $input_id );
447 447
 
448
-		    // Reset fields that are hidden
449
-		    // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
450
-		    if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
448
+			// Reset fields that are hidden
449
+			// Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic
450
+			if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) {
451 451
 
452 452
 				$empty_value = $field->get_value_save_entry(
453 453
 					is_array( $field->get_entry_inputs() ) ? array() : '',
@@ -459,16 +459,16 @@  discard block
 block discarded – undo
459 459
 					$empty_value = '';
460 460
 				}
461 461
 
462
-			    $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
462
+				$lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id );
463 463
 
464
-			    GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
464
+				GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value );
465 465
 
466
-			    // Prevent the $_POST values of hidden fields from being used as default values when rendering the form
466
+				// Prevent the $_POST values of hidden fields from being used as default values when rendering the form
467 467
 				// after submission
468
-			    $post_input_id = 'input_' . str_replace( '.', '_', $input_id );
469
-			    $_POST[ $post_input_id ] = '';
470
-		    }
471
-	    }
468
+				$post_input_id = 'input_' . str_replace( '.', '_', $input_id );
469
+				$_POST[ $post_input_id ] = '';
470
+			}
471
+		}
472 472
 	}
473 473
 
474 474
 	/**
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 
563 563
 		$form = $this->filter_conditional_logic( $this->form );
564 564
 
565
-	    /** @var GF_Field $field */
565
+		/** @var GF_Field $field */
566 566
 		foreach( $form['fields'] as $k => &$field ) {
567 567
 
568 568
 			/**
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 
579 579
 			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
580 580
 				foreach( $field->inputs as $key => $input ) {
581
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
581
+					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
582 582
 				}
583 583
 			}
584 584
 		}
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 
619 619
 				$inputs = $field->get_entry_inputs();
620 620
 				if ( is_array( $inputs ) ) {
621
-				    foreach ( $inputs as $input ) {
621
+					foreach ( $inputs as $input ) {
622 622
 						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
623 623
 
624 624
 						if ( 'product' === $field->type ) {
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 						}
638 638
 
639 639
 						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
640
-				    }
640
+					}
641 641
 				} else {
642 642
 					// Set to what it previously was if it's not editable
643 643
 					if ( ! in_array( $field->id, $allowed_fields ) ) {
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
684 684
 
685 685
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
686
-	        $ary = stripslashes_deep( $ary );
686
+			$ary = stripslashes_deep( $ary );
687 687
 			$img_url = \GV\Utils::get( $ary, 0 );
688 688
 
689 689
 			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 	private function maybe_update_post_fields( $form ) {
757 757
 
758 758
 		if( empty( $this->entry['post_id'] ) ) {
759
-	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
759
+			gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
760 760
 			return;
761 761
 		}
762 762
 
@@ -791,49 +791,49 @@  discard block
 block discarded – undo
791 791
 
792 792
 				switch( $field->type ) {
793 793
 
794
-				    case 'post_title':
795
-				        $post_title = $value;
796
-				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
797
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
798
-				        }
799
-				        $updated_post->post_title = $post_title;
800
-				        $updated_post->post_name  = $post_title;
801
-				        unset( $post_title );
802
-				        break;
803
-
804
-				    case 'post_content':
805
-				        $post_content = $value;
806
-				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
807
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
808
-				        }
809
-				        $updated_post->post_content = $post_content;
810
-				        unset( $post_content );
811
-				        break;
812
-				    case 'post_excerpt':
813
-				        $updated_post->post_excerpt = $value;
814
-				        break;
815
-				    case 'post_tags':
816
-				        wp_set_post_tags( $post_id, $value, false );
817
-				        break;
818
-				    case 'post_category':
819
-				        break;
820
-				    case 'post_custom_field':
794
+					case 'post_title':
795
+						$post_title = $value;
796
+						if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
797
+							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
798
+						}
799
+						$updated_post->post_title = $post_title;
800
+						$updated_post->post_name  = $post_title;
801
+						unset( $post_title );
802
+						break;
803
+
804
+					case 'post_content':
805
+						$post_content = $value;
806
+						if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
807
+							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
808
+						}
809
+						$updated_post->post_content = $post_content;
810
+						unset( $post_content );
811
+						break;
812
+					case 'post_excerpt':
813
+						$updated_post->post_excerpt = $value;
814
+						break;
815
+					case 'post_tags':
816
+						wp_set_post_tags( $post_id, $value, false );
817
+						break;
818
+					case 'post_category':
819
+						break;
820
+					case 'post_custom_field':
821 821
 						if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) {
822 822
 							$value = $value[ $field_id ];
823 823
 						}
824 824
 
825
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
826
-				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
827
-				        }
825
+						if( ! empty( $field->customFieldTemplateEnabled ) ) {
826
+							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
827
+						}
828 828
 
829 829
 						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
830 830
 
831
-				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
832
-				        break;
831
+						update_post_meta( $post_id, $field->postCustomFieldName, $value );
832
+						break;
833 833
 
834
-				    case 'post_image':
835
-				        $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
836
-				        break;
834
+					case 'post_image':
835
+						$value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id );
836
+						break;
837 837
 
838 838
 				}
839 839
 
@@ -990,14 +990,14 @@  discard block
 block discarded – undo
990 990
 			?><h2 class="gv-edit-entry-title">
991 991
 				<span><?php
992 992
 
993
-				    /**
994
-				     * @filter `gravityview_edit_entry_title` Modify the edit entry title
995
-				     * @param string $edit_entry_title Modify the "Edit Entry" title
996
-				     * @param GravityView_Edit_Entry_Render $this This object
997
-				     */
998
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
993
+					/**
994
+					 * @filter `gravityview_edit_entry_title` Modify the edit entry title
995
+					 * @param string $edit_entry_title Modify the "Edit Entry" title
996
+					 * @param GravityView_Edit_Entry_Render $this This object
997
+					 */
998
+					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
999 999
 
1000
-				    echo esc_attr( $edit_entry_title );
1000
+					echo esc_attr( $edit_entry_title );
1001 1001
 			?></span>
1002 1002
 			</h2>
1003 1003
 
@@ -1060,26 +1060,26 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
 				switch ( $edit_redirect ) {
1062 1062
 
1063
-                    case '0':
1064
-	                    $redirect_url = $back_link;
1065
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1066
-                        break;
1067
-
1068
-                    case '1':
1069
-	                    $redirect_url = $directory_link = GravityView_API::directory_link();
1070
-	                    $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>' );
1071
-	                    break;
1072
-
1073
-                    case '2':
1074
-	                    $redirect_url = $edit_redirect_url;
1075
-	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1076
-	                    $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>' );
1077
-                        break;
1078
-
1079
-                    case '':
1080
-                    default:
1081
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1082
-                        break;
1063
+					case '0':
1064
+						$redirect_url = $back_link;
1065
+						$entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1066
+						break;
1067
+
1068
+					case '1':
1069
+						$redirect_url = $directory_link = GravityView_API::directory_link();
1070
+						$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>' );
1071
+						break;
1072
+
1073
+					case '2':
1074
+						$redirect_url = $edit_redirect_url;
1075
+						$redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1076
+						$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>' );
1077
+						break;
1078
+
1079
+					case '':
1080
+					default:
1081
+						$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1082
+						break;
1083 1083
 				}
1084 1084
 
1085 1085
 				if ( isset( $redirect_url ) ) {
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 
1169 1169
 		ob_get_clean();
1170 1170
 
1171
-	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1171
+		remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
1172 1172
 		remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1173 1173
 		remove_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1174 1174
 		remove_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
 
1225 1225
 		// for now we don't support Save and Continue feature.
1226 1226
 		if( ! self::$supports_save_and_continue ) {
1227
-	        unset( $form['save'] );
1227
+			unset( $form['save'] );
1228 1228
 		}
1229 1229
 
1230 1230
 		$form = $this->unselect_default_values( $form );
@@ -1251,30 +1251,30 @@  discard block
 block discarded – undo
1251 1251
 			return $field_content;
1252 1252
 		}
1253 1253
 
1254
-        $message = null;
1254
+		$message = null;
1255 1255
 
1256
-        // First, make sure they have the capability to edit the post.
1257
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1256
+		// First, make sure they have the capability to edit the post.
1257
+		if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1258 1258
 
1259
-            /**
1260
-             * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1261
-             * @param string $message The existing "You don't have permission..." text
1262
-             */
1263
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1259
+			/**
1260
+			 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1261
+			 * @param string $message The existing "You don't have permission..." text
1262
+			 */
1263
+			$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1264 1264
 
1265
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1266
-            /**
1267
-             * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1268
-             * @param string $message The existing "This field is not editable; the post no longer exists." text
1269
-             */
1270
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1271
-        }
1265
+		} elseif( null === get_post( $this->entry['post_id'] ) ) {
1266
+			/**
1267
+			 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1268
+			 * @param string $message The existing "This field is not editable; the post no longer exists." text
1269
+			 */
1270
+			$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1271
+		}
1272 1272
 
1273
-        if( $message ) {
1274
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1275
-        }
1273
+		if( $message ) {
1274
+			$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1275
+		}
1276 1276
 
1277
-        return $field_content;
1277
+		return $field_content;
1278 1278
 	}
1279 1279
 
1280 1280
 	/**
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
 			|| ! empty( $field_content )
1303 1303
 			|| in_array( $field->type, array( 'honeypot' ) )
1304 1304
 		) {
1305
-	        return $field_content;
1305
+			return $field_content;
1306 1306
 		}
1307 1307
 
1308 1308
 		// SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -1310,24 +1310,24 @@  discard block
 block discarded – undo
1310 1310
 
1311 1311
 		$field_value = $this->get_field_value( $field );
1312 1312
 
1313
-	    // Prevent any PHP warnings, like undefined index
1314
-	    ob_start();
1313
+		// Prevent any PHP warnings, like undefined index
1314
+		ob_start();
1315 1315
 
1316
-	    $return = null;
1316
+		$return = null;
1317 1317
 
1318 1318
 		/** @var GravityView_Field $gv_field */
1319 1319
 		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1320 1320
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1321 1321
 		} else {
1322
-	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
1323
-	    }
1322
+			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
1323
+		}
1324 1324
 
1325
-	    // If there was output, it's an error
1326
-	    $warnings = ob_get_clean();
1325
+		// If there was output, it's an error
1326
+		$warnings = ob_get_clean();
1327 1327
 
1328
-	    if( !empty( $warnings ) ) {
1329
-		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1330
-	    }
1328
+		if( !empty( $warnings ) ) {
1329
+			gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1330
+		}
1331 1331
 
1332 1332
 		return $return;
1333 1333
 	}
@@ -1362,8 +1362,8 @@  discard block
 block discarded – undo
1362 1362
 				$input_id = strval( $input['id'] );
1363 1363
 
1364 1364
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1365
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1366
-				    $allow_pre_populated = false;
1365
+					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1366
+					$allow_pre_populated = false;
1367 1367
 				}
1368 1368
 
1369 1369
 			}
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1388 1388
 				$categories = array();
1389 1389
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1390
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1390
+					$categories[] = GFCommon::format_post_category( $cat_string, true );
1391 1391
 				}
1392 1392
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1393 1393
 			}
@@ -1397,25 +1397,25 @@  discard block
 block discarded – undo
1397 1397
 		// if value is empty get the default value if defined
1398 1398
 		$field_value = $field->get_value_default_if_empty( $field_value );
1399 1399
 
1400
-	    /**
1401
-	     * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1402
-	     * @since 1.11
1403
-	     * @since 1.20 Added third param
1404
-	     * @param mixed $field_value field value used to populate the input
1405
-	     * @param object $field Gravity Forms field object ( Class GF_Field )
1406
-	     * @param GravityView_Edit_Entry_Render $this Current object
1407
-	     */
1408
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1409
-
1410
-	    /**
1411
-	     * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1412
-	     * @since 1.17
1413
-	     * @since 1.20 Added third param
1414
-	     * @param mixed $field_value field value used to populate the input
1415
-	     * @param GF_Field $field Gravity Forms field object
1416
-	     * @param GravityView_Edit_Entry_Render $this Current object
1417
-	     */
1418
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1400
+		/**
1401
+		 * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed
1402
+		 * @since 1.11
1403
+		 * @since 1.20 Added third param
1404
+		 * @param mixed $field_value field value used to populate the input
1405
+		 * @param object $field Gravity Forms field object ( Class GF_Field )
1406
+		 * @param GravityView_Edit_Entry_Render $this Current object
1407
+		 */
1408
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this );
1409
+
1410
+		/**
1411
+		 * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type
1412
+		 * @since 1.17
1413
+		 * @since 1.20 Added third param
1414
+		 * @param mixed $field_value field value used to populate the input
1415
+		 * @param GF_Field $field Gravity Forms field object
1416
+		 * @param GravityView_Edit_Entry_Render $this Current object
1417
+		 */
1418
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1419 1419
 
1420 1420
 		return $field_value;
1421 1421
 	}
@@ -1442,7 +1442,7 @@  discard block
 block discarded – undo
1442 1442
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1443 1443
 			// expects certain field array items to be set.
1444 1444
 			foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) {
1445
-	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1445
+				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1446 1446
 			}
1447 1447
 
1448 1448
 			switch( RGFormsModel::get_input_type( $field ) ) {
@@ -1456,61 +1456,61 @@  discard block
 block discarded – undo
1456 1456
 				 */
1457 1457
 				case 'fileupload':
1458 1458
 
1459
-				    // Set the previous value
1460
-				    $entry = $this->get_entry();
1459
+					// Set the previous value
1460
+					$entry = $this->get_entry();
1461 1461
 
1462
-				    $input_name = 'input_'.$field->id;
1463
-				    $form_id = $form['id'];
1462
+					$input_name = 'input_'.$field->id;
1463
+					$form_id = $form['id'];
1464 1464
 
1465
-				    $value = NULL;
1465
+					$value = NULL;
1466 1466
 
1467
-				    // Use the previous entry value as the default.
1468
-				    if( isset( $entry[ $field->id ] ) ) {
1469
-				        $value = $entry[ $field->id ];
1470
-				    }
1467
+					// Use the previous entry value as the default.
1468
+					if( isset( $entry[ $field->id ] ) ) {
1469
+						$value = $entry[ $field->id ];
1470
+					}
1471 1471
 
1472
-				    // If this is a single upload file
1473
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1474
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1475
-				        $value = $file_path['url'];
1472
+					// If this is a single upload file
1473
+					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1474
+						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1475
+						$value = $file_path['url'];
1476 1476
 
1477
-				    } else {
1477
+					} else {
1478 1478
 
1479
-				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1480
-				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1481
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1479
+						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1480
+						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1481
+						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1482 1482
 
1483
-				    }
1483
+					}
1484 1484
 
1485
-				    if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1485
+					if ( \GV\Utils::get( $field, "multipleFiles" ) ) {
1486 1486
 
1487
-				        // If there are fresh uploads, process and merge them.
1488
-				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1489
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1490
-				            $value = empty( $value ) ? '[]' : $value;
1491
-				            $value = stripslashes_deep( $value );
1492
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1493
-				        }
1487
+						// If there are fresh uploads, process and merge them.
1488
+						// Otherwise, use the passed values, which should be json-encoded array of URLs
1489
+						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1490
+							$value = empty( $value ) ? '[]' : $value;
1491
+							$value = stripslashes_deep( $value );
1492
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1493
+						}
1494 1494
 
1495
-				    } else {
1495
+					} else {
1496 1496
 
1497
-				        // A file already exists when editing an entry
1498
-				        // We set this to solve issue when file upload fields are required.
1499
-				        GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1497
+						// A file already exists when editing an entry
1498
+						// We set this to solve issue when file upload fields are required.
1499
+						GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value;
1500 1500
 
1501
-				    }
1501
+					}
1502 1502
 
1503
-				    $this->entry[ $input_name ] = $value;
1504
-				    $_POST[ $input_name ] = $value;
1503
+					$this->entry[ $input_name ] = $value;
1504
+					$_POST[ $input_name ] = $value;
1505 1505
 
1506
-				    break;
1506
+					break;
1507 1507
 
1508 1508
 				case 'number':
1509
-				    // Fix "undefined index" issue at line 1286 in form_display.php
1510
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1511
-				        $_POST['input_'.$field->id ] = NULL;
1512
-				    }
1513
-				    break;
1509
+					// Fix "undefined index" issue at line 1286 in form_display.php
1510
+					if( !isset( $_POST['input_'.$field->id ] ) ) {
1511
+						$_POST['input_'.$field->id ] = NULL;
1512
+					}
1513
+					break;
1514 1514
 			}
1515 1515
 
1516 1516
 		}
@@ -1595,43 +1595,43 @@  discard block
 block discarded – undo
1595 1595
 				case 'fileupload' :
1596 1596
 				case 'post_image':
1597 1597
 
1598
-				    // in case nothing is uploaded but there are already files saved
1599
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1600
-				        $field->failed_validation = false;
1601
-				        unset( $field->validation_message );
1602
-				    }
1598
+					// in case nothing is uploaded but there are already files saved
1599
+					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1600
+						$field->failed_validation = false;
1601
+						unset( $field->validation_message );
1602
+					}
1603 1603
 
1604
-				    // validate if multi file upload reached max number of files [maxFiles] => 2
1605
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1604
+					// validate if multi file upload reached max number of files [maxFiles] => 2
1605
+					if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1606 1606
 
1607
-				        $input_name = 'input_' . $field->id;
1608
-				        //uploaded
1609
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1607
+						$input_name = 'input_' . $field->id;
1608
+						//uploaded
1609
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1610 1610
 
1611
-				        //existent
1612
-				        $entry = $this->get_entry();
1613
-				        $value = NULL;
1614
-				        if( isset( $entry[ $field->id ] ) ) {
1615
-				            $value = json_decode( $entry[ $field->id ], true );
1616
-				        }
1611
+						//existent
1612
+						$entry = $this->get_entry();
1613
+						$value = NULL;
1614
+						if( isset( $entry[ $field->id ] ) ) {
1615
+							$value = json_decode( $entry[ $field->id ], true );
1616
+						}
1617 1617
 
1618
-				        // count uploaded files and existent entry files
1619
-				        $count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1620
-						               ( is_array( $value ) ? count( $value ) : 0 );
1618
+						// count uploaded files and existent entry files
1619
+						$count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1620
+									   ( is_array( $value ) ? count( $value ) : 0 );
1621 1621
 
1622
-				        if( $count_files > $field->maxFiles ) {
1623
-				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1624
-				            $field->failed_validation = 1;
1625
-				            $gv_valid = false;
1622
+						if( $count_files > $field->maxFiles ) {
1623
+							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1624
+							$field->failed_validation = 1;
1625
+							$gv_valid = false;
1626 1626
 
1627
-				            // in case of error make sure the newest upload files are removed from the upload input
1628
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1629
-				        }
1627
+							// in case of error make sure the newest upload files are removed from the upload input
1628
+							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1629
+						}
1630 1630
 
1631
-				    }
1631
+					}
1632 1632
 
1633 1633
 
1634
-				    break;
1634
+					break;
1635 1635
 
1636 1636
 			}
1637 1637
 
@@ -1642,47 +1642,47 @@  discard block
 block discarded – undo
1642 1642
 
1643 1643
 				switch ( $field_type ) {
1644 1644
 
1645
-				    // Captchas don't need to be re-entered.
1646
-				    case 'captcha':
1645
+					// Captchas don't need to be re-entered.
1646
+					case 'captcha':
1647 1647
 
1648
-				        // Post Image fields aren't editable, so we un-fail them.
1649
-				    case 'post_image':
1650
-				        $field->failed_validation = false;
1651
-				        unset( $field->validation_message );
1652
-				        break;
1648
+						// Post Image fields aren't editable, so we un-fail them.
1649
+					case 'post_image':
1650
+						$field->failed_validation = false;
1651
+						unset( $field->validation_message );
1652
+						break;
1653 1653
 
1654 1654
 				}
1655 1655
 
1656 1656
 				// You can't continue inside a switch, so we do it after.
1657 1657
 				if( empty( $field->failed_validation ) ) {
1658
-				    continue;
1658
+					continue;
1659 1659
 				}
1660 1660
 
1661 1661
 				// checks if the No Duplicates option is not validating entry against itself, since
1662 1662
 				// we're editing a stored entry, it would also assume it's a duplicate.
1663 1663
 				if( !empty( $field->noDuplicates ) ) {
1664 1664
 
1665
-				    $entry = $this->get_entry();
1665
+					$entry = $this->get_entry();
1666 1666
 
1667
-				    // If the value of the entry is the same as the stored value
1668
-				    // Then we can assume it's not a duplicate, it's the same.
1669
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1670
-				        //if value submitted was not changed, then don't validate
1671
-				        $field->failed_validation = false;
1667
+					// If the value of the entry is the same as the stored value
1668
+					// Then we can assume it's not a duplicate, it's the same.
1669
+					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1670
+						//if value submitted was not changed, then don't validate
1671
+						$field->failed_validation = false;
1672 1672
 
1673
-				        unset( $field->validation_message );
1673
+						unset( $field->validation_message );
1674 1674
 
1675
-				        gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1675
+						gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) );
1676 1676
 
1677
-				        continue;
1678
-				    }
1677
+						continue;
1678
+					}
1679 1679
 				}
1680 1680
 
1681 1681
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1682 1682
 				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1683
-				    unset( $field->validation_message );
1684
-	                $field->validation_message = false;
1685
-				    continue;
1683
+					unset( $field->validation_message );
1684
+					$field->validation_message = false;
1685
+					continue;
1686 1686
 				}
1687 1687
 
1688 1688
 				$gv_valid = false;
@@ -1746,8 +1746,8 @@  discard block
 block discarded – undo
1746 1746
 		// Hide fields depending on admin settings
1747 1747
 		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1748 1748
 
1749
-	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1750
-	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1749
+		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1750
+		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
1751 1751
 
1752 1752
 		/**
1753 1753
 		 * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form
@@ -1826,11 +1826,11 @@  discard block
 block discarded – undo
1826 1826
 		// The edit tab has been configured, so we loop through to configured settings
1827 1827
 		foreach ( $configured_fields as $configured_field ) {
1828 1828
 
1829
-	        /** @var GF_Field $field */
1830
-	        foreach ( $fields as $field ) {
1829
+			/** @var GF_Field $field */
1830
+			foreach ( $fields as $field ) {
1831 1831
 				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1832
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1833
-				    break;
1832
+					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1833
+					break;
1834 1834
 				}
1835 1835
 
1836 1836
 			}
@@ -1886,28 +1886,28 @@  discard block
 block discarded – undo
1886 1886
 	 */
1887 1887
 	private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) {
1888 1888
 
1889
-	    /**
1889
+		/**
1890 1890
 		 * @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
1891
-	     * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1892
-	     * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1893
-	     * @since 1.9.1
1894
-	     * @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.
1895
-	     * @param array $form GF Form array
1896
-	     * @param int $view_id View ID
1897
-	     */
1898
-	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1899
-
1900
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1891
+		 * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators.
1892
+		 * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions
1893
+		 * @since 1.9.1
1894
+		 * @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.
1895
+		 * @param array $form GF Form array
1896
+		 * @param int $view_id View ID
1897
+		 */
1898
+		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1899
+
1900
+		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1901 1901
 			foreach( $fields as $k => $field ) {
1902 1902
 				if( $field->adminOnly ) {
1903
-				    unset( $fields[ $k ] );
1903
+					unset( $fields[ $k ] );
1904 1904
 				}
1905 1905
 			}
1906 1906
 			return array_values( $fields );
1907 1907
 		}
1908 1908
 
1909
-	    foreach( $fields as &$field ) {
1910
-		    $field->adminOnly = false;
1909
+		foreach( $fields as &$field ) {
1910
+			$field->adminOnly = false;
1911 1911
 		}
1912 1912
 
1913 1913
 		return $fields;
@@ -1927,13 +1927,13 @@  discard block
 block discarded – undo
1927 1927
 	 */
1928 1928
 	private function unselect_default_values( $form ) {
1929 1929
 
1930
-	    foreach ( $form['fields'] as &$field ) {
1930
+		foreach ( $form['fields'] as &$field ) {
1931 1931
 
1932 1932
 			if ( empty( $field->choices ) ) {
1933
-                continue;
1933
+				continue;
1934 1934
 			}
1935 1935
 
1936
-            foreach ( $field->choices as &$choice ) {
1936
+			foreach ( $field->choices as &$choice ) {
1937 1937
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1938 1938
 					$choice['isSelected'] = false;
1939 1939
 				}
@@ -1970,36 +1970,36 @@  discard block
 block discarded – undo
1970 1970
 
1971 1971
 			if( 'checkbox' === $field->type ) {
1972 1972
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1973
-				    $input_id = $input['id'];
1974
-				    $choice = $field->choices[ $key ];
1975
-				    $value = \GV\Utils::get( $this->entry, $input_id );
1976
-				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1977
-				    if( $match ) {
1978
-				        $field->choices[ $key ]['isSelected'] = true;
1979
-				    }
1973
+					$input_id = $input['id'];
1974
+					$choice = $field->choices[ $key ];
1975
+					$value = \GV\Utils::get( $this->entry, $input_id );
1976
+					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1977
+					if( $match ) {
1978
+						$field->choices[ $key ]['isSelected'] = true;
1979
+					}
1980 1980
 				}
1981 1981
 			} else {
1982 1982
 
1983 1983
 				// We need to run through each field to set the default values
1984 1984
 				foreach ( $this->entry as $field_id => $field_value ) {
1985 1985
 
1986
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1986
+					if( floatval( $field_id ) === floatval( $field->id ) ) {
1987 1987
 
1988
-				        if( 'list' === $field->type ) {
1989
-				            $list_rows = maybe_unserialize( $field_value );
1988
+						if( 'list' === $field->type ) {
1989
+							$list_rows = maybe_unserialize( $field_value );
1990 1990
 
1991
-				            $list_field_value = array();
1992
-				            foreach ( (array) $list_rows as $row ) {
1993
-				                foreach ( (array) $row as $column ) {
1994
-				                    $list_field_value[] = $column;
1995
-				                }
1996
-				            }
1991
+							$list_field_value = array();
1992
+							foreach ( (array) $list_rows as $row ) {
1993
+								foreach ( (array) $row as $column ) {
1994
+									$list_field_value[] = $column;
1995
+								}
1996
+							}
1997 1997
 
1998
-				            $field->defaultValue = serialize( $list_field_value );
1999
-				        } else {
2000
-				            $field->defaultValue = $field_value;
2001
-				        }
2002
-				    }
1998
+							$field->defaultValue = serialize( $list_field_value );
1999
+						} else {
2000
+							$field->defaultValue = $field_value;
2001
+						}
2002
+					}
2003 2003
 				}
2004 2004
 			}
2005 2005
 		}
@@ -2060,7 +2060,7 @@  discard block
 block discarded – undo
2060 2060
 			foreach ( $form['fields'] as &$field ) {
2061 2061
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2062 2062
 
2063
-				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2063
+					list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2064 2064
 
2065 2065
 					if ( $field['id'] == $rule_field_id ) {
2066 2066
 						unset( $field->conditionalLogic['rules'][ $rule_i ] );
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
 			return $has_conditional_logic;
2112 2112
 		}
2113 2113
 
2114
-	    /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2114
+		/** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */
2115 2115
 		return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form );
2116 2116
 	}
2117 2117
 
@@ -2178,14 +2178,14 @@  discard block
 block discarded – undo
2178 2178
 
2179 2179
 		if( $echo && $error !== true ) {
2180 2180
 
2181
-	        $error = esc_html( $error );
2181
+			$error = esc_html( $error );
2182 2182
 
2183
-	        /**
2184
-	         * @since 1.9
2185
-	         */
2186
-	        if ( ! empty( $this->entry ) ) {
2187
-		        $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;" ) );
2188
-	        }
2183
+			/**
2184
+			 * @since 1.9
2185
+			 */
2186
+			if ( ! empty( $this->entry ) ) {
2187
+				$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;" ) );
2188
+			}
2189 2189
 
2190 2190
 			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2191 2191
 		}
Please login to merge, or discard this patch.
Spacing   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
 	function load() {
135 135
 
136 136
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
137
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
137
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
138 138
 
139 139
 		// Don't display an embedded form when editing an entry
140 140
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
141 141
 		add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
142 142
 
143 143
 		// Stop Gravity Forms processing what is ours!
144
-		add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
144
+		add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
145 145
 
146
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
146
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
147 147
 
148 148
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ), 10, 4 );
149 149
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
155 155
 
156 156
 		// Add fields expected by GFFormDisplay::validate()
157
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
157
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
158 158
 
159 159
 		// Fix multiselect value for GF 2.2
160 160
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @return void
172 172
 	 */
173 173
 	public function prevent_render_form() {
174
-		if( $this->is_edit_entry() ) {
175
-			if( 'wp_head' === current_filter() ) {
174
+		if ( $this->is_edit_entry() ) {
175
+			if ( 'wp_head' === current_filter() ) {
176 176
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
177 177
 			} else {
178 178
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public function prevent_maybe_process_form() {
189 189
 
190
-	    if( ! $this->is_edit_entry_submission() ) {
190
+	    if ( ! $this->is_edit_entry_submission() ) {
191 191
 			return;
192 192
 		}
193 193
 
194 194
 		gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] Removing GFForms::maybe_process_form() action.' );
195 195
 
196
-		remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
197
-		remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
196
+		remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
197
+		remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
198 198
 	}
199 199
 
200 200
 	/**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 */
204 204
 	public function is_edit_entry() {
205 205
 
206
-		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] );
206
+		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] );
207 207
 
208 208
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
209 209
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @return boolean
215 215
 	 */
216 216
 	public function is_edit_entry_submission() {
217
-		return !empty( $_POST[ self::$nonce_field ] );
217
+		return ! empty( $_POST[ self::$nonce_field ] );
218 218
 	}
219 219
 
220 220
 	/**
@@ -227,16 +227,16 @@  discard block
 block discarded – undo
227 227
 
228 228
 
229 229
 		$entries = $gravityview_view->getEntries();
230
-	    self::$original_entry = $entries[0];
231
-	    $this->entry = $entries[0];
230
+	    self::$original_entry = $entries[ 0 ];
231
+	    $this->entry = $entries[ 0 ];
232 232
 
233 233
 		self::$original_form = $gravityview_view->getForm();
234 234
 		$this->form = $gravityview_view->getForm();
235
-		$this->form_id = $this->entry['form_id'];
235
+		$this->form_id = $this->entry[ 'form_id' ];
236 236
 		$this->view_id = $gravityview_view->getViewId();
237 237
 		$this->post_id = \GV\Utils::get( $post, 'ID', null );
238 238
 
239
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
239
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
240 240
 	}
241 241
 
242 242
 
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 	private function print_scripts() {
296 296
 		$gravityview_view = GravityView_View::getInstance();
297 297
 
298
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
298
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
299 299
 
300
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
300
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
301 301
 
302 302
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
303 303
 
@@ -313,19 +313,19 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	private function process_save( $gv_data ) {
315 315
 
316
-		if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
316
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
317 317
 			return;
318 318
 		}
319 319
 
320 320
 		// Make sure the entry, view, and form IDs are all correct
321 321
 		$valid = $this->verify_nonce();
322 322
 
323
-		if ( !$valid ) {
323
+		if ( ! $valid ) {
324 324
 			gravityview()->log->error( 'Nonce validation failed.' );
325 325
 			return;
326 326
 		}
327 327
 
328
-		if ( $this->entry['id'] !== $_POST['lid'] ) {
328
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
329 329
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
330 330
 			return;
331 331
 		}
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 
337 337
 		$this->validate();
338 338
 
339
-		if( $this->is_valid ) {
339
+		if ( $this->is_valid ) {
340 340
 
341 341
 			gravityview()->log->debug( 'Submission is valid.' );
342 342
 
@@ -348,15 +348,15 @@  discard block
 block discarded – undo
348 348
 			/**
349 349
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
350 350
 			 */
351
-			unset( $_GET['page'] );
351
+			unset( $_GET[ 'page' ] );
352 352
 
353
-			$date_created = $this->entry['date_created'];
353
+			$date_created = $this->entry[ 'date_created' ];
354 354
 
355 355
 			/**
356 356
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
357 357
 			 * @since 1.17.2
358 358
 			 */
359
-			unset( $this->entry['date_created'] );
359
+			unset( $this->entry[ 'date_created' ] );
360 360
 
361 361
 			/**
362 362
 			 * @action `gravityview/edit_entry/before_update` Perform an action after the entry has been updated using Edit Entry
@@ -366,14 +366,14 @@  discard block
 block discarded – undo
366 366
 			 * @param GravityView_Edit_Entry_Render $this This object
367 367
 			 * @param GravityView_View_Data $gv_data The View data
368 368
 			 */
369
-			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry['id'], $this, $gv_data );
369
+			do_action( 'gravityview/edit_entry/before_update', $form, $this->entry[ 'id' ], $this, $gv_data );
370 370
 
371 371
 			GFFormsModel::save_lead( $form, $this->entry );
372 372
 
373 373
 	        // Delete the values for hidden inputs
374 374
 	        $this->unset_hidden_field_values();
375 375
 			
376
-			$this->entry['date_created'] = $date_created;
376
+			$this->entry[ 'date_created' ] = $date_created;
377 377
 
378 378
 			// Process calculation fields
379 379
 			$this->update_calculation_fields();
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 			 * @param GravityView_Edit_Entry_Render $this This object
396 396
 			 * @param GravityView_View_Data $gv_data The View data
397 397
 			 */
398
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data );
398
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data );
399 399
 
400 400
 		} else {
401 401
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -425,16 +425,16 @@  discard block
 block discarded – undo
425 425
 
426 426
 		$this->unset_hidden_calculations = array();
427 427
 
428
-		if( ! $unset_hidden_field_values ) {
428
+		if ( ! $unset_hidden_field_values ) {
429 429
 			return;
430 430
 		}
431 431
 
432 432
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
433 433
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
434
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
434
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
435 435
 		} else {
436 436
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
437
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
437
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
438 438
 		}
439 439
 
440 440
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 
452 452
 				$empty_value = $field->get_value_save_entry(
453 453
 					is_array( $field->get_entry_inputs() ) ? array() : '',
454
-					$this->form, '', $this->entry['id'], $this->entry
454
+					$this->form, '', $this->entry[ 'id' ], $this->entry
455 455
 				);
456 456
 
457 457
 				if ( $field->has_calculation() ) {
458
-					$this->unset_hidden_calculations[] = $field->id; // Unset
458
+					$this->unset_hidden_calculations[ ] = $field->id; // Unset
459 459
 					$empty_value = '';
460 460
 				}
461 461
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 		}
527 527
 
528 528
 		/** No file is being uploaded. */
529
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
529
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
530 530
 			/** So return the original upload */
531 531
 			return $entry[ $input_id ];
532 532
 		}
@@ -544,11 +544,11 @@  discard block
 block discarded – undo
544 544
 	 * @return mixed
545 545
 	 */
546 546
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
547
-		if( ! $this->is_edit_entry() ) {
547
+		if ( ! $this->is_edit_entry() ) {
548 548
 			return $plupload_init;
549 549
 		}
550 550
 
551
-		$plupload_init['gf_vars']['max_files'] = 0;
551
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
552 552
 
553 553
 		return $plupload_init;
554 554
 	}
@@ -563,27 +563,27 @@  discard block
 block discarded – undo
563 563
 		$form = $this->filter_conditional_logic( $this->form );
564 564
 
565 565
 	    /** @var GF_Field $field */
566
-		foreach( $form['fields'] as $k => &$field ) {
566
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
567 567
 
568 568
 			/**
569 569
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
570 570
 			 * @since 1.16.3
571 571
 			 * @var GF_Field $field
572 572
 			 */
573
-			if( $field->has_calculation() ) {
574
-				unset( $form['fields'][ $k ] );
573
+			if ( $field->has_calculation() ) {
574
+				unset( $form[ 'fields' ][ $k ] );
575 575
 			}
576 576
 
577 577
 			$field->adminOnly = false;
578 578
 
579
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
580
-				foreach( $field->inputs as $key => $input ) {
581
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
579
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
580
+				foreach ( $field->inputs as $key => $input ) {
581
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
582 582
 				}
583 583
 			}
584 584
 		}
585 585
 
586
-		$form['fields'] = array_values( $form['fields'] );
586
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
587 587
 
588 588
 		return $form;
589 589
 	}
@@ -595,14 +595,14 @@  discard block
 block discarded – undo
595 595
 		$update = false;
596 596
 
597 597
 		// get the most up to date entry values
598
-		$entry = GFAPI::get_entry( $this->entry['id'] );
598
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
599 599
 
600 600
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
601 601
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
602
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry['id'] ) );
602
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $entry_meta_table WHERE entry_id=%d", $entry[ 'id' ] ) );
603 603
 		} else {
604 604
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
605
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry['id'] ) );
605
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $lead_detail_table WHERE lead_id=%d", $entry[ 'id' ] ) );
606 606
 		}
607 607
 
608 608
 
@@ -619,24 +619,24 @@  discard block
 block discarded – undo
619 619
 				$inputs = $field->get_entry_inputs();
620 620
 				if ( is_array( $inputs ) ) {
621 621
 				    foreach ( $inputs as $input ) {
622
-						list( $field_id, $input_id ) = rgexplode( '.', $input['id'], 2 );
622
+						list( $field_id, $input_id ) = rgexplode( '.', $input[ 'id' ], 2 );
623 623
 
624 624
 						if ( 'product' === $field->type ) {
625
-							$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
625
+							$input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
626 626
 
627 627
 							// Only allow quantity to be set if it's allowed to be edited
628 628
 							if ( in_array( $field_id, $allowed_fields ) && $input_id == 3 ) {
629 629
 							} else { // otherwise set to what it previously was
630
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
630
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
631 631
 							}
632 632
 						} else {
633 633
 							// Set to what it previously was if it's not editable
634 634
 							if ( ! in_array( $field_id, $allowed_fields ) ) {
635
-								$_POST[ $input_name ] = $entry[ $input['id'] ];
635
+								$_POST[ $input_name ] = $entry[ $input[ 'id' ] ];
636 636
 							}
637 637
 						}
638 638
 
639
-						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input['id'] );
639
+						GFFormsModel::save_input( $form, $field, $entry, $current_fields, $input[ 'id' ] );
640 640
 				    }
641 641
 				} else {
642 642
 					// Set to what it previously was if it's not editable
@@ -676,19 +676,19 @@  discard block
 block discarded – undo
676 676
 
677 677
 		$input_name = 'input_' . $field_id;
678 678
 
679
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
679
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
680 680
 
681 681
 			// We have a new image
682 682
 
683
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
683
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
684 684
 
685 685
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
686 686
 	        $ary = stripslashes_deep( $ary );
687 687
 			$img_url = \GV\Utils::get( $ary, 0 );
688 688
 
689
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
690
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
691
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
689
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
690
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
691
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
692 692
 
693 693
 			$image_meta = array(
694 694
 				'post_excerpt' => $img_caption,
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 
698 698
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
699 699
 			if ( ! empty( $img_title ) ) {
700
-				$image_meta['post_title'] = $img_title;
700
+				$image_meta[ 'post_title' ] = $img_title;
701 701
 			}
702 702
 
703 703
 			/**
@@ -755,15 +755,15 @@  discard block
 block discarded – undo
755 755
 	 */
756 756
 	private function maybe_update_post_fields( $form ) {
757 757
 
758
-		if( empty( $this->entry['post_id'] ) ) {
758
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
759 759
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
760 760
 			return;
761 761
 		}
762 762
 
763
-		$post_id = $this->entry['post_id'];
763
+		$post_id = $this->entry[ 'post_id' ];
764 764
 
765 765
 		// Security check
766
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
766
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
767 767
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
768 768
 			return;
769 769
 		}
@@ -776,25 +776,25 @@  discard block
 block discarded – undo
776 776
 
777 777
 			$field = RGFormsModel::get_field( $form, $field_id );
778 778
 
779
-			if( ! $field ) {
779
+			if ( ! $field ) {
780 780
 				continue;
781 781
 			}
782 782
 
783
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
783
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
784 784
 
785 785
 				// Get the value of the field, including $_POSTed value
786 786
 				$value = RGFormsModel::get_field_value( $field );
787 787
 
788 788
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
789 789
 				$entry_tmp = $this->entry;
790
-				$entry_tmp["{$field_id}"] = $value;
790
+				$entry_tmp[ "{$field_id}" ] = $value;
791 791
 
792
-				switch( $field->type ) {
792
+				switch ( $field->type ) {
793 793
 
794 794
 				    case 'post_title':
795 795
 				        $post_title = $value;
796 796
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
797
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
797
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
798 798
 				        }
799 799
 				        $updated_post->post_title = $post_title;
800 800
 				        $updated_post->post_name  = $post_title;
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 				    case 'post_content':
805 805
 				        $post_content = $value;
806 806
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
807
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
807
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
808 808
 				        }
809 809
 				        $updated_post->post_content = $post_content;
810 810
 				        unset( $post_content );
@@ -822,11 +822,11 @@  discard block
 block discarded – undo
822 822
 							$value = $value[ $field_id ];
823 823
 						}
824 824
 
825
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
825
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
826 826
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
827 827
 				        }
828 828
 
829
-						$value = $field->get_value_save_entry( $value, $form, '', $this->entry['id'], $this->entry );
829
+						$value = $field->get_value_save_entry( $value, $form, '', $this->entry[ 'id' ], $this->entry );
830 830
 
831 831
 				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
832 832
 				        break;
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 				}
839 839
 
840 840
 				// update entry after
841
-				$this->entry["{$field_id}"] = $value;
841
+				$this->entry[ "{$field_id}" ] = $value;
842 842
 
843 843
 				$update_entry = true;
844 844
 
@@ -847,11 +847,11 @@  discard block
 block discarded – undo
847 847
 
848 848
 		}
849 849
 
850
-		if( $update_entry ) {
850
+		if ( $update_entry ) {
851 851
 
852 852
 			$return_entry = GFAPI::update_entry( $this->entry );
853 853
 
854
-			if( is_wp_error( $return_entry ) ) {
854
+			if ( is_wp_error( $return_entry ) ) {
855 855
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
856 856
 			} else {
857 857
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 
862 862
 		$return_post = wp_update_post( $updated_post, true );
863 863
 
864
-		if( is_wp_error( $return_post ) ) {
864
+		if ( is_wp_error( $return_post ) ) {
865 865
 			$return_post->add_data( $updated_post, '$updated_post' );
866 866
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
867 867
 		} else {
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
896 896
 
897 897
 		// replace conditional shortcodes
898
-		if( $do_shortcode ) {
898
+		if ( $do_shortcode ) {
899 899
 			$output = do_shortcode( $output );
900 900
 		}
901 901
 
@@ -914,19 +914,19 @@  discard block
 block discarded – undo
914 914
 	 */
915 915
 	private function after_update() {
916 916
 
917
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
918
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
917
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
918
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
919 919
 
920 920
 		// Re-define the entry now that we've updated it.
921
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
921
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
922 922
 
923 923
 		$entry = GFFormsModel::set_entry_meta( $entry, self::$original_form );
924 924
 
925 925
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
926 926
 			// We need to clear the cache because Gravity Forms caches the field values, which
927 927
 			// we have just updated.
928
-			foreach ($this->form['fields'] as $key => $field) {
929
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
928
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
929
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
930 930
 			}
931 931
 		}
932 932
 
@@ -936,11 +936,11 @@  discard block
 block discarded – undo
936 936
 		 * @since develop
937 937
 		 */
938 938
 		if ( $allowed_feeds = $this->view->settings->get( 'edit_feeds', array() ) ) {
939
-			$feeds = GFAPI::get_feeds( null, $entry['form_id'] );
939
+			$feeds = GFAPI::get_feeds( null, $entry[ 'form_id' ] );
940 940
 			if ( ! is_wp_error( $feeds ) ) {
941 941
 				$registered_feeds = array();
942 942
 				foreach ( GFAddOn::get_registered_addons() as $registered_feed ) {
943
-					if ( is_subclass_of( $registered_feed,  'GFFeedAddOn' ) ) {
943
+					if ( is_subclass_of( $registered_feed, 'GFFeedAddOn' ) ) {
944 944
 						if ( method_exists( $registered_feed, 'get_instance' ) ) {
945 945
 							$registered_feed = call_user_func( array( $registered_feed, 'get_instance' ) );
946 946
 							$registered_feeds[ $registered_feed->get_slug() ] = $registered_feed;
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
 					}
949 949
 				}
950 950
 				foreach ( $feeds as $feed ) {
951
-					if ( in_array( $feed['id'], $allowed_feeds ) ) {
952
-						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed['addon_slug'] ) ) {
951
+					if ( in_array( $feed[ 'id' ], $allowed_feeds ) ) {
952
+						if ( $feed_object = \GV\Utils::get( $registered_feeds, $feed[ 'addon_slug' ] ) ) {
953 953
 							$returned_entry = $feed_object->process_feed( $feed, $entry, self::$original_form );
954 954
 							if ( is_array( $returned_entry ) && rgar( $returned_entry, 'id' ) ) {
955 955
 								$entry = $returned_entry;
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
 
980 980
 		<div class="gv-edit-entry-wrapper"><?php
981 981
 
982
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
982
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
983 983
 
984 984
 			/**
985 985
 			 * Fixes weird wpautop() issue
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
996 996
 				     * @param GravityView_Edit_Entry_Render $this This object
997 997
 				     */
998
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
998
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
999 999
 
1000 1000
 				    echo esc_attr( $edit_entry_title );
1001 1001
 			?></span>
@@ -1045,13 +1045,13 @@  discard block
 block discarded – undo
1045 1045
 
1046 1046
 			$back_link = remove_query_arg( array( 'page', 'view', 'edit' ) );
1047 1047
 
1048
-			if( ! $this->is_valid ){
1048
+			if ( ! $this->is_valid ) {
1049 1049
 
1050 1050
 				// Keeping this compatible with Gravity Forms.
1051
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
1052
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
1051
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
1052
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
1053 1053
 
1054
-				echo GVCommon::generate_notice( $message , 'gv-error' );
1054
+				echo GVCommon::generate_notice( $message, 'gv-error' );
1055 1055
 
1056 1056
 			} else {
1057 1057
 				$view = \GV\View::by_id( $this->view_id );
@@ -1062,23 +1062,23 @@  discard block
 block discarded – undo
1062 1062
 
1063 1063
                     case '0':
1064 1064
 	                    $redirect_url = $back_link;
1065
-	                    $entry_updated_message = sprintf( esc_attr_x('Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview'), '<a href="'. esc_url( $redirect_url ) .'">', '</a>' );
1065
+	                    $entry_updated_message = sprintf( esc_attr_x( 'Entry Updated. %sReturning to Entry%s', 'Replacements are HTML', 'gravityview' ), '<a href="' . esc_url( $redirect_url ) . '">', '</a>' );
1066 1066
                         break;
1067 1067
 
1068 1068
                     case '1':
1069 1069
 	                    $redirect_url = $directory_link = GravityView_API::directory_link();
1070
-	                    $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>' );
1070
+	                    $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>' );
1071 1071
 	                    break;
1072 1072
 
1073 1073
                     case '2':
1074 1074
 	                    $redirect_url = $edit_redirect_url;
1075 1075
 	                    $redirect_url = GFCommon::replace_variables( $redirect_url, $this->form, $this->entry, false, false, false, 'text' );
1076
-	                    $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>' );
1076
+	                    $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>' );
1077 1077
                         break;
1078 1078
 
1079 1079
                     case '':
1080 1080
                     default:
1081
-					    $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. esc_url( $back_link ) .'">', '</a>' );
1081
+					    $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . esc_url( $back_link ) . '">', '</a>' );
1082 1082
                         break;
1083 1083
 				}
1084 1084
 
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 				 * @param array $entry Gravity Forms entry array
1095 1095
 				 * @param string $back_link URL to return to the original entry. @since 1.6
1096 1096
 				 */
1097
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
1097
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
1098 1098
 
1099 1099
 				echo GVCommon::generate_notice( $message );
1100 1100
 			}
@@ -1118,8 +1118,8 @@  discard block
 block discarded – undo
1118 1118
 		 */
1119 1119
 		do_action( 'gravityview/edit-entry/render/before', $this );
1120 1120
 
1121
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
1122
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
1121
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
1122
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
1123 1123
 		add_filter( 'gform_next_button', array( $this, 'render_form_buttons' ) );
1124 1124
 		add_filter( 'gform_previous_button', array( $this, 'render_form_buttons' ) );
1125 1125
 		add_filter( 'gform_disable_view_counter', '__return_true' );
@@ -1128,17 +1128,17 @@  discard block
 block discarded – undo
1128 1128
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
1129 1129
 
1130 1130
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
1131
-		unset( $_GET['page'] );
1131
+		unset( $_GET[ 'page' ] );
1132 1132
 
1133 1133
 		$this->show_next_button = false;
1134 1134
 		$this->show_previous_button = false;
1135 1135
 
1136 1136
 		// TODO: Verify multiple-page forms
1137 1137
 		if ( GFCommon::has_pages( $this->form ) && apply_filters( 'gravityview/features/paged-edit', false ) ) {
1138
-			if ( intval( $page_number = \GV\Utils::_POST( 'gform_target_page_number_' . $this->form['id'], 1 ) ) > 1 ) {
1139
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'form' ] = $this->form;
1140
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'is_valid' ] = true;
1141
-				GFFormDisplay::$submission[ $this->form['id'] ][ 'page_number' ] = $page_number;
1138
+			if ( intval( $page_number = \GV\Utils::_POST( 'gform_target_page_number_' . $this->form[ 'id' ], 1 ) ) > 1 ) {
1139
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'form' ] = $this->form;
1140
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'is_valid' ] = true;
1141
+				GFFormDisplay::$submission[ $this->form[ 'id' ] ][ 'page_number' ] = $page_number;
1142 1142
 			}
1143 1143
 
1144 1144
 			if ( ( $page_number = intval( $page_number ) ) < 2 ) {
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 
1165 1165
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1166 1166
 
1167
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1167
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1168 1168
 
1169 1169
 		ob_get_clean();
1170 1170
 
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 	 * @return string
1193 1193
 	 */
1194 1194
 	public function render_form_buttons() {
1195
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1195
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1196 1196
 	}
1197 1197
 
1198 1198
 
@@ -1212,10 +1212,10 @@  discard block
 block discarded – undo
1212 1212
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1213 1213
 
1214 1214
 		// In case we have validated the form, use it to inject the validation results into the form render
1215
-		if( isset( $this->form_after_validation ) && $this->form_after_validation['id'] === $form['id'] ) {
1215
+		if ( isset( $this->form_after_validation ) && $this->form_after_validation[ 'id' ] === $form[ 'id' ] ) {
1216 1216
 			$form = $this->form_after_validation;
1217 1217
 		} else {
1218
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1218
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1219 1219
 		}
1220 1220
 
1221 1221
 		$form = $this->filter_conditional_logic( $form );
@@ -1223,8 +1223,8 @@  discard block
 block discarded – undo
1223 1223
 		$form = $this->prefill_conditional_logic( $form );
1224 1224
 
1225 1225
 		// for now we don't support Save and Continue feature.
1226
-		if( ! self::$supports_save_and_continue ) {
1227
-	        unset( $form['save'] );
1226
+		if ( ! self::$supports_save_and_continue ) {
1227
+	        unset( $form[ 'save' ] );
1228 1228
 		}
1229 1229
 
1230 1230
 		$form = $this->unselect_default_values( $form );
@@ -1247,31 +1247,31 @@  discard block
 block discarded – undo
1247 1247
 	 */
1248 1248
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1249 1249
 
1250
-		if( ! GFCommon::is_post_field( $field ) ) {
1250
+		if ( ! GFCommon::is_post_field( $field ) ) {
1251 1251
 			return $field_content;
1252 1252
 		}
1253 1253
 
1254 1254
         $message = null;
1255 1255
 
1256 1256
         // First, make sure they have the capability to edit the post.
1257
-        if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1257
+        if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1258 1258
 
1259 1259
             /**
1260 1260
              * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1261 1261
              * @param string $message The existing "You don't have permission..." text
1262 1262
              */
1263
-            $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1263
+            $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1264 1264
 
1265
-        } elseif( null === get_post( $this->entry['post_id'] ) ) {
1265
+        } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1266 1266
             /**
1267 1267
              * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1268 1268
              * @param string $message The existing "This field is not editable; the post no longer exists." text
1269 1269
              */
1270
-            $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1270
+            $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1271 1271
         }
1272 1272
 
1273
-        if( $message ) {
1274
-            $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1273
+        if ( $message ) {
1274
+            $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1275 1275
         }
1276 1276
 
1277 1277
         return $field_content;
@@ -1295,8 +1295,8 @@  discard block
 block discarded – undo
1295 1295
 
1296 1296
 		// If the form has been submitted, then we don't need to pre-fill the values,
1297 1297
 		// Except for fileupload type and when a field input is overridden- run always!!
1298
-		if(
1299
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1298
+		if (
1299
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1300 1300
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1301 1301
 			&& ! GFCommon::is_product_field( $field->type )
1302 1302
 			|| ! empty( $field_content )
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 	    $return = null;
1317 1317
 
1318 1318
 		/** @var GravityView_Field $gv_field */
1319
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1319
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1320 1320
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1321 1321
 		} else {
1322 1322
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
 	    // If there was output, it's an error
1326 1326
 	    $warnings = ob_get_clean();
1327 1327
 
1328
-	    if( !empty( $warnings ) ) {
1328
+	    if ( ! empty( $warnings ) ) {
1329 1329
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1330 1330
 	    }
1331 1331
 
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1351 1351
 
1352 1352
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1353
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1353
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1354 1354
 
1355 1355
 			$field_value = array();
1356 1356
 
@@ -1359,10 +1359,10 @@  discard block
 block discarded – undo
1359 1359
 
1360 1360
 			foreach ( (array)$field->inputs as $input ) {
1361 1361
 
1362
-				$input_id = strval( $input['id'] );
1362
+				$input_id = strval( $input[ 'id' ] );
1363 1363
 
1364 1364
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1365
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1365
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1366 1366
 				    $allow_pre_populated = false;
1367 1367
 				}
1368 1368
 
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
 
1371 1371
 			$pre_value = $field->get_value_submission( array(), false );
1372 1372
 
1373
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1373
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1374 1374
 
1375 1375
 		} else {
1376 1376
 
@@ -1381,13 +1381,13 @@  discard block
 block discarded – undo
1381 1381
 
1382 1382
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1383 1383
 			// or pre-populated value if not empty and set to override saved value
1384
-			$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;
1384
+			$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;
1385 1385
 
1386 1386
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1387
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1387
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1388 1388
 				$categories = array();
1389 1389
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1390
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1390
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1391 1391
 				}
1392 1392
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1393 1393
 			}
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
 	     * @param GF_Field $field Gravity Forms field object
1416 1416
 	     * @param GravityView_Edit_Entry_Render $this Current object
1417 1417
 	     */
1418
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1418
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1419 1419
 
1420 1420
 		return $field_value;
1421 1421
 	}
@@ -1432,12 +1432,12 @@  discard block
 block discarded – undo
1432 1432
 	 */
1433 1433
 	public function gform_pre_validation( $form ) {
1434 1434
 
1435
-		if( ! $this->verify_nonce() ) {
1435
+		if ( ! $this->verify_nonce() ) {
1436 1436
 			return $form;
1437 1437
 		}
1438 1438
 
1439 1439
 		// Fix PHP warning regarding undefined index.
1440
-		foreach ( $form['fields'] as &$field) {
1440
+		foreach ( $form[ 'fields' ] as &$field ) {
1441 1441
 
1442 1442
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1443 1443
 			// expects certain field array items to be set.
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1446 1446
 			}
1447 1447
 
1448
-			switch( RGFormsModel::get_input_type( $field ) ) {
1448
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1449 1449
 
1450 1450
 				/**
1451 1451
 				 * 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.
@@ -1459,26 +1459,26 @@  discard block
 block discarded – undo
1459 1459
 				    // Set the previous value
1460 1460
 				    $entry = $this->get_entry();
1461 1461
 
1462
-				    $input_name = 'input_'.$field->id;
1463
-				    $form_id = $form['id'];
1462
+				    $input_name = 'input_' . $field->id;
1463
+				    $form_id = $form[ 'id' ];
1464 1464
 
1465 1465
 				    $value = NULL;
1466 1466
 
1467 1467
 				    // Use the previous entry value as the default.
1468
-				    if( isset( $entry[ $field->id ] ) ) {
1468
+				    if ( isset( $entry[ $field->id ] ) ) {
1469 1469
 				        $value = $entry[ $field->id ];
1470 1470
 				    }
1471 1471
 
1472 1472
 				    // If this is a single upload file
1473
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1474
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1475
-				        $value = $file_path['url'];
1473
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1474
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1475
+				        $value = $file_path[ 'url' ];
1476 1476
 
1477 1477
 				    } else {
1478 1478
 
1479 1479
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1480 1480
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1481
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1481
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1482 1482
 
1483 1483
 				    }
1484 1484
 
@@ -1486,10 +1486,10 @@  discard block
 block discarded – undo
1486 1486
 
1487 1487
 				        // If there are fresh uploads, process and merge them.
1488 1488
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1489
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1489
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1490 1490
 				            $value = empty( $value ) ? '[]' : $value;
1491 1491
 				            $value = stripslashes_deep( $value );
1492
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1492
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1493 1493
 				        }
1494 1494
 
1495 1495
 				    } else {
@@ -1507,8 +1507,8 @@  discard block
 block discarded – undo
1507 1507
 
1508 1508
 				case 'number':
1509 1509
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1510
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1511
-				        $_POST['input_'.$field->id ] = NULL;
1510
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1511
+				        $_POST[ 'input_' . $field->id ] = NULL;
1512 1512
 				    }
1513 1513
 				    break;
1514 1514
 			}
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 		 * You can enter whatever you want!
1546 1546
 		 * We try validating, and customize the results using `self::custom_validation()`
1547 1547
 		 */
1548
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1548
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1549 1549
 
1550 1550
 		// Needed by the validate funtion
1551 1551
 		$failed_validation_page = NULL;
@@ -1553,14 +1553,14 @@  discard block
 block discarded – undo
1553 1553
 
1554 1554
 		// Prevent entry limit from running when editing an entry, also
1555 1555
 		// prevent form scheduling from preventing editing
1556
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1556
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1557 1557
 
1558 1558
 		// Hide fields depending on Edit Entry settings
1559
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1559
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1560 1560
 
1561 1561
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1562 1562
 
1563
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1563
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1564 1564
 	}
1565 1565
 
1566 1566
 
@@ -1583,7 +1583,7 @@  discard block
 block discarded – undo
1583 1583
 
1584 1584
 		$gv_valid = true;
1585 1585
 
1586
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1586
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1587 1587
 
1588 1588
 			$value = RGFormsModel::get_field_value( $field );
1589 1589
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1596,22 +1596,22 @@  discard block
 block discarded – undo
1596 1596
 				case 'post_image':
1597 1597
 
1598 1598
 				    // in case nothing is uploaded but there are already files saved
1599
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1599
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1600 1600
 				        $field->failed_validation = false;
1601 1601
 				        unset( $field->validation_message );
1602 1602
 				    }
1603 1603
 
1604 1604
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1605
-				    if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) {
1605
+				    if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) {
1606 1606
 
1607 1607
 				        $input_name = 'input_' . $field->id;
1608 1608
 				        //uploaded
1609
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1609
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1610 1610
 
1611 1611
 				        //existent
1612 1612
 				        $entry = $this->get_entry();
1613 1613
 				        $value = NULL;
1614
-				        if( isset( $entry[ $field->id ] ) ) {
1614
+				        if ( isset( $entry[ $field->id ] ) ) {
1615 1615
 				            $value = json_decode( $entry[ $field->id ], true );
1616 1616
 				        }
1617 1617
 
@@ -1619,13 +1619,13 @@  discard block
 block discarded – undo
1619 1619
 				        $count_files = ( is_array( $file_names ) ? count( $file_names ) : 0 ) +
1620 1620
 						               ( is_array( $value ) ? count( $value ) : 0 );
1621 1621
 
1622
-				        if( $count_files > $field->maxFiles ) {
1622
+				        if ( $count_files > $field->maxFiles ) {
1623 1623
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1624 1624
 				            $field->failed_validation = 1;
1625 1625
 				            $gv_valid = false;
1626 1626
 
1627 1627
 				            // in case of error make sure the newest upload files are removed from the upload input
1628
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1628
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1629 1629
 				        }
1630 1630
 
1631 1631
 				    }
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
 			}
1637 1637
 
1638 1638
 			// This field has failed validation.
1639
-			if( !empty( $field->failed_validation ) ) {
1639
+			if ( ! empty( $field->failed_validation ) ) {
1640 1640
 
1641 1641
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1642 1642
 
@@ -1654,19 +1654,19 @@  discard block
 block discarded – undo
1654 1654
 				}
1655 1655
 
1656 1656
 				// You can't continue inside a switch, so we do it after.
1657
-				if( empty( $field->failed_validation ) ) {
1657
+				if ( empty( $field->failed_validation ) ) {
1658 1658
 				    continue;
1659 1659
 				}
1660 1660
 
1661 1661
 				// checks if the No Duplicates option is not validating entry against itself, since
1662 1662
 				// we're editing a stored entry, it would also assume it's a duplicate.
1663
-				if( !empty( $field->noDuplicates ) ) {
1663
+				if ( ! empty( $field->noDuplicates ) ) {
1664 1664
 
1665 1665
 				    $entry = $this->get_entry();
1666 1666
 
1667 1667
 				    // If the value of the entry is the same as the stored value
1668 1668
 				    // Then we can assume it's not a duplicate, it's the same.
1669
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1669
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1670 1670
 				        //if value submitted was not changed, then don't validate
1671 1671
 				        $field->failed_validation = false;
1672 1672
 
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 				}
1680 1680
 
1681 1681
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1682
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1682
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1683 1683
 				    unset( $field->validation_message );
1684 1684
 	                $field->validation_message = false;
1685 1685
 				    continue;
@@ -1691,12 +1691,12 @@  discard block
 block discarded – undo
1691 1691
 
1692 1692
 		}
1693 1693
 
1694
-		$validation_results['is_valid'] = $gv_valid;
1694
+		$validation_results[ 'is_valid' ] = $gv_valid;
1695 1695
 
1696 1696
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1697 1697
 
1698 1698
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1699
-		$this->form_after_validation = $validation_results['form'];
1699
+		$this->form_after_validation = $validation_results[ 'form' ];
1700 1700
 
1701 1701
 		return $validation_results;
1702 1702
 	}
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
 	 */
1710 1710
 	public function get_entry() {
1711 1711
 
1712
-		if( empty( $this->entry ) ) {
1712
+		if ( empty( $this->entry ) ) {
1713 1713
 			// Get the database value of the entry that's being edited
1714 1714
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1715 1715
 		}
@@ -1741,10 +1741,10 @@  discard block
 block discarded – undo
1741 1741
 		}
1742 1742
 
1743 1743
 		// If edit tab not yet configured, show all fields
1744
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1744
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1745 1745
 
1746 1746
 		// Hide fields depending on admin settings
1747
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1747
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1748 1748
 
1749 1749
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1750 1750
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1777,7 +1777,7 @@  discard block
 block discarded – undo
1777 1777
 	 */
1778 1778
 	private function filter_fields( $fields, $configured_fields ) {
1779 1779
 
1780
-		if( empty( $fields ) || !is_array( $fields ) ) {
1780
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1781 1781
 			return $fields;
1782 1782
 		}
1783 1783
 
@@ -1794,12 +1794,12 @@  discard block
 block discarded – undo
1794 1794
 
1795 1795
 			// Remove the fields that have calculation properties and keep them to be used later
1796 1796
 			// @since 1.16.2
1797
-			if( $field->has_calculation() ) {
1798
-				$this->fields_with_calculation[] = $field;
1797
+			if ( $field->has_calculation() ) {
1798
+				$this->fields_with_calculation[ ] = $field;
1799 1799
 				// don't remove the calculation fields on form render.
1800 1800
 			}
1801 1801
 
1802
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1802
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1803 1803
 				unset( $fields[ $key ] );
1804 1804
 			}
1805 1805
 		}
@@ -1817,7 +1817,7 @@  discard block
 block discarded – undo
1817 1817
 					continue; // Same
1818 1818
 				}
1819 1819
 
1820
-				$out_fields[] = $field;
1820
+				$out_fields[ ] = $field;
1821 1821
 			}
1822 1822
 
1823 1823
 			return array_values( $out_fields );
@@ -1828,8 +1828,8 @@  discard block
 block discarded – undo
1828 1828
 
1829 1829
 	        /** @var GF_Field $field */
1830 1830
 	        foreach ( $fields as $field ) {
1831
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1832
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1831
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1832
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1833 1833
 				    break;
1834 1834
 				}
1835 1835
 
@@ -1852,14 +1852,14 @@  discard block
 block discarded – undo
1852 1852
 
1853 1853
 		$return_field = $field;
1854 1854
 
1855
-		if( empty( $field_setting['show_label'] ) ) {
1855
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1856 1856
 			$return_field->label = '';
1857
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1858
-			$return_field->label = $field_setting['custom_label'];
1857
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1858
+			$return_field->label = $field_setting[ 'custom_label' ];
1859 1859
 		}
1860 1860
 
1861
-		if( !empty( $field_setting['custom_class'] ) ) {
1862
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1861
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1862
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1863 1863
 		}
1864 1864
 
1865 1865
 		/**
@@ -1897,16 +1897,16 @@  discard block
 block discarded – undo
1897 1897
 	     */
1898 1898
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1899 1899
 
1900
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1901
-			foreach( $fields as $k => $field ) {
1902
-				if( $field->adminOnly ) {
1900
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1901
+			foreach ( $fields as $k => $field ) {
1902
+				if ( $field->adminOnly ) {
1903 1903
 				    unset( $fields[ $k ] );
1904 1904
 				}
1905 1905
 			}
1906 1906
 			return array_values( $fields );
1907 1907
 		}
1908 1908
 
1909
-	    foreach( $fields as &$field ) {
1909
+	    foreach ( $fields as &$field ) {
1910 1910
 		    $field->adminOnly = false;
1911 1911
 		}
1912 1912
 
@@ -1927,7 +1927,7 @@  discard block
 block discarded – undo
1927 1927
 	 */
1928 1928
 	private function unselect_default_values( $form ) {
1929 1929
 
1930
-	    foreach ( $form['fields'] as &$field ) {
1930
+	    foreach ( $form[ 'fields' ] as &$field ) {
1931 1931
 
1932 1932
 			if ( empty( $field->choices ) ) {
1933 1933
                 continue;
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
 
1936 1936
             foreach ( $field->choices as &$choice ) {
1937 1937
 				if ( \GV\Utils::get( $choice, 'isSelected' ) ) {
1938
-					$choice['isSelected'] = false;
1938
+					$choice[ 'isSelected' ] = false;
1939 1939
 				}
1940 1940
 			}
1941 1941
 		}
@@ -1960,22 +1960,22 @@  discard block
 block discarded – undo
1960 1960
 	 */
1961 1961
 	function prefill_conditional_logic( $form ) {
1962 1962
 
1963
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1963
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1964 1964
 			return $form;
1965 1965
 		}
1966 1966
 
1967 1967
 		// Have Conditional Logic pre-fill fields as if the data were default values
1968 1968
 		/** @var GF_Field $field */
1969
-		foreach ( $form['fields'] as &$field ) {
1969
+		foreach ( $form[ 'fields' ] as &$field ) {
1970 1970
 
1971
-			if( 'checkbox' === $field->type ) {
1971
+			if ( 'checkbox' === $field->type ) {
1972 1972
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1973
-				    $input_id = $input['id'];
1973
+				    $input_id = $input[ 'id' ];
1974 1974
 				    $choice = $field->choices[ $key ];
1975 1975
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1976 1976
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1977
-				    if( $match ) {
1978
-				        $field->choices[ $key ]['isSelected'] = true;
1977
+				    if ( $match ) {
1978
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1979 1979
 				    }
1980 1980
 				}
1981 1981
 			} else {
@@ -1983,15 +1983,15 @@  discard block
 block discarded – undo
1983 1983
 				// We need to run through each field to set the default values
1984 1984
 				foreach ( $this->entry as $field_id => $field_value ) {
1985 1985
 
1986
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1986
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1987 1987
 
1988
-				        if( 'list' === $field->type ) {
1988
+				        if ( 'list' === $field->type ) {
1989 1989
 				            $list_rows = maybe_unserialize( $field_value );
1990 1990
 
1991 1991
 				            $list_field_value = array();
1992
-				            foreach ( (array) $list_rows as $row ) {
1993
-				                foreach ( (array) $row as $column ) {
1994
-				                    $list_field_value[] = $column;
1992
+				            foreach ( (array)$list_rows as $row ) {
1993
+				                foreach ( (array)$row as $column ) {
1994
+				                    $list_field_value[ ] = $column;
1995 1995
 				                }
1996 1996
 				            }
1997 1997
 
@@ -2024,32 +2024,32 @@  discard block
 block discarded – undo
2024 2024
 		 * @see https://github.com/gravityview/GravityView/issues/840
2025 2025
 		 * @since develop
2026 2026
 		 */
2027
-		$the_form = GFAPI::get_form( $form['id'] );
2027
+		$the_form = GFAPI::get_form( $form[ 'id' ] );
2028 2028
 		$editable_ids = array();
2029
-		foreach ( $form['fields'] as $field ) {
2030
-			$editable_ids[] = $field['id']; // wp_list_pluck is destructive in this context
2029
+		foreach ( $form[ 'fields' ] as $field ) {
2030
+			$editable_ids[ ] = $field[ 'id' ]; // wp_list_pluck is destructive in this context
2031 2031
 		}
2032 2032
 		$remove_conditions_rule = array();
2033
-		foreach ( $the_form['fields'] as $field ) {
2034
-			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic['rules'] ) ) {
2035
-				foreach ( $field->conditionalLogic['rules'] as $i => $rule ) {
2036
-					if ( ! in_array( $rule['fieldId'], $editable_ids ) ) {
2033
+		foreach ( $the_form[ 'fields' ] as $field ) {
2034
+			if ( ! empty( $field->conditionalLogic ) && ! empty( $field->conditionalLogic[ 'rules' ] ) ) {
2035
+				foreach ( $field->conditionalLogic[ 'rules' ] as $i => $rule ) {
2036
+					if ( ! in_array( $rule[ 'fieldId' ], $editable_ids ) ) {
2037 2037
 						/**
2038 2038
 						 * This conditional field is not editable in this View.
2039 2039
 						 * We need to remove the rule, but only if it matches.
2040 2040
 						 */
2041
-						if ( $_field = GFAPI::get_field( $the_form, $rule['fieldId'] ) ) {
2041
+						if ( $_field = GFAPI::get_field( $the_form, $rule[ 'fieldId' ] ) ) {
2042 2042
 							$value = $_field->get_value_export( $this->entry );
2043
-						} elseif ( isset( $this->entry[ $rule['fieldId'] ] ) ) {
2044
-							$value = $this->entry[ $rule['fieldId'] ];
2043
+						} elseif ( isset( $this->entry[ $rule[ 'fieldId' ] ] ) ) {
2044
+							$value = $this->entry[ $rule[ 'fieldId' ] ];
2045 2045
 						} else {
2046
-							$value = gform_get_meta( $this->entry['id'], $rule['fieldId'] );
2046
+							$value = gform_get_meta( $this->entry[ 'id' ], $rule[ 'fieldId' ] );
2047 2047
 						}
2048 2048
 
2049
-						$match = GFFormsModel::matches_operation( $value, $rule['value'], $rule['operator'] );
2049
+						$match = GFFormsModel::matches_operation( $value, $rule[ 'value' ], $rule[ 'operator' ] );
2050 2050
 						
2051 2051
 						if ( $match ) {
2052
-							$remove_conditions_rule[] = array( $field['id'], $i );
2052
+							$remove_conditions_rule[ ] = array( $field[ 'id' ], $i );
2053 2053
 						}
2054 2054
 					}
2055 2055
 				}
@@ -2057,21 +2057,21 @@  discard block
 block discarded – undo
2057 2057
 		}
2058 2058
 
2059 2059
 		if ( $remove_conditions_rule ) {
2060
-			foreach ( $form['fields'] as &$field ) {
2060
+			foreach ( $form[ 'fields' ] as &$field ) {
2061 2061
 				foreach ( $remove_conditions_rule as $_remove_conditions_r ) {
2062 2062
 
2063 2063
 				    list( $rule_field_id, $rule_i ) = $_remove_conditions_r;
2064 2064
 
2065
-					if ( $field['id'] == $rule_field_id ) {
2066
-						unset( $field->conditionalLogic['rules'][ $rule_i ] );
2067
-						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field['id'] ) );
2065
+					if ( $field[ 'id' ] == $rule_field_id ) {
2066
+						unset( $field->conditionalLogic[ 'rules' ][ $rule_i ] );
2067
+						gravityview()->log->debug( 'Removed conditional rule #{rule} for field {field_id}', array( 'rule' => $rule_i, 'field_id' => $field[ 'id' ] ) );
2068 2068
 					}
2069 2069
 				}
2070 2070
 			}
2071 2071
 		}
2072 2072
 
2073 2073
 		/** Normalize the indices... */
2074
-		$form['fields'] = array_values( $form['fields'] );
2074
+		$form[ 'fields' ] = array_values( $form[ 'fields' ] );
2075 2075
 
2076 2076
 		/**
2077 2077
 		 * @filter `gravityview/edit_entry/conditional_logic` Should the Edit Entry form use Gravity Forms conditional logic showing/hiding of fields?
@@ -2081,16 +2081,16 @@  discard block
 block discarded – undo
2081 2081
 		 */
2082 2082
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
2083 2083
 
2084
-		if( $use_conditional_logic ) {
2084
+		if ( $use_conditional_logic ) {
2085 2085
 			return $form;
2086 2086
 		}
2087 2087
 
2088
-		foreach( $form['fields'] as &$field ) {
2088
+		foreach ( $form[ 'fields' ] as &$field ) {
2089 2089
 			/* @var GF_Field $field */
2090 2090
 			$field->conditionalLogic = null;
2091 2091
 		}
2092 2092
 
2093
-		unset( $form['button']['conditionalLogic'] );
2093
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
2094 2094
 
2095 2095
 		return $form;
2096 2096
 
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 	 */
2108 2108
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
2109 2109
 
2110
-		if( ! $this->is_edit_entry() ) {
2110
+		if ( ! $this->is_edit_entry() ) {
2111 2111
 			return $has_conditional_logic;
2112 2112
 		}
2113 2113
 
@@ -2139,44 +2139,44 @@  discard block
 block discarded – undo
2139 2139
 		 *  2. There are two entries embedded using oEmbed
2140 2140
 		 *  3. One of the entries has just been saved
2141 2141
 		 */
2142
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
2142
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
2143 2143
 
2144 2144
 			$error = true;
2145 2145
 
2146 2146
 		}
2147 2147
 
2148
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
2148
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
2149 2149
 
2150 2150
 			$error = true;
2151 2151
 
2152
-		} elseif( ! $this->verify_nonce() ) {
2152
+		} elseif ( ! $this->verify_nonce() ) {
2153 2153
 
2154 2154
 			/**
2155 2155
 			 * If the Entry is embedded, there may be two entries on the same page.
2156 2156
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
2157 2157
 			 */
2158
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2158
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
2159 2159
 				$error = true;
2160 2160
 			} else {
2161
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
2161
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
2162 2162
 			}
2163 2163
 
2164 2164
 		}
2165 2165
 
2166
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2167
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
2166
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
2167
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
2168 2168
 		}
2169 2169
 
2170
-		if( $this->entry['status'] === 'trash' ) {
2171
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
2170
+		if ( $this->entry[ 'status' ] === 'trash' ) {
2171
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
2172 2172
 		}
2173 2173
 
2174 2174
 		// No errors; everything's fine here!
2175
-		if( empty( $error ) ) {
2175
+		if ( empty( $error ) ) {
2176 2176
 			return true;
2177 2177
 		}
2178 2178
 
2179
-		if( $echo && $error !== true ) {
2179
+		if ( $echo && $error !== true ) {
2180 2180
 
2181 2181
 	        $error = esc_html( $error );
2182 2182
 
@@ -2184,10 +2184,10 @@  discard block
 block discarded – undo
2184 2184
 	         * @since 1.9
2185 2185
 	         */
2186 2186
 	        if ( ! empty( $this->entry ) ) {
2187
-		        $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;" ) );
2187
+		        $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;" ) );
2188 2188
 	        }
2189 2189
 
2190
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
2190
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
2191 2191
 		}
2192 2192
 
2193 2193
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2207,17 +2207,17 @@  discard block
 block discarded – undo
2207 2207
 
2208 2208
 		$error = NULL;
2209 2209
 
2210
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
2211
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
2210
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
2211
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
2212 2212
 		}
2213 2213
 
2214 2214
 		// No errors; everything's fine here!
2215
-		if( empty( $error ) ) {
2215
+		if ( empty( $error ) ) {
2216 2216
 			return true;
2217 2217
 		}
2218 2218
 
2219
-		if( $echo ) {
2220
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
2219
+		if ( $echo ) {
2220
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2221 2221
 		}
2222 2222
 
2223 2223
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -2238,14 +2238,14 @@  discard block
 block discarded – undo
2238 2238
 	private function check_user_cap_edit_field( $field ) {
2239 2239
 
2240 2240
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2241
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2241
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2242 2242
 			return true;
2243 2243
 		}
2244 2244
 
2245
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2245
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2246 2246
 
2247
-		if( $field_cap ) {
2248
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2247
+		if ( $field_cap ) {
2248
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2249 2249
 		}
2250 2250
 
2251 2251
 		return false;
@@ -2259,17 +2259,17 @@  discard block
 block discarded – undo
2259 2259
 	public function verify_nonce() {
2260 2260
 
2261 2261
 		// Verify form submitted for editing single
2262
-		if( $this->is_edit_entry_submission() ) {
2262
+		if ( $this->is_edit_entry_submission() ) {
2263 2263
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2264 2264
 		}
2265 2265
 
2266 2266
 		// Verify
2267
-		else if( ! $this->is_edit_entry() ) {
2267
+		else if ( ! $this->is_edit_entry() ) {
2268 2268
 			$valid = false;
2269 2269
 		}
2270 2270
 
2271 2271
 		else {
2272
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2272
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2273 2273
 		}
2274 2274
 
2275 2275
 		/**
Please login to merge, or discard this patch.
includes/class-gravityview-shortcode.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		gravityview()->log->debug( '$passed_atts: ', array( 'data' => $passed_atts ) );
49 49
 
50 50
 		// Get details about the current View
51
-		if( !empty( $passed_atts['detail'] ) ) {
52
-			return $this->get_view_detail( $passed_atts['detail'] );
51
+		if ( ! empty( $passed_atts[ 'detail' ] ) ) {
52
+			return $this->get_view_detail( $passed_atts[ 'detail' ] );
53 53
 		}
54 54
 
55 55
 		$atts = $this->parse_and_sanitize_atts( $passed_atts );
@@ -85,16 +85,16 @@  discard block
 block discarded – undo
85 85
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
86 86
 
87 87
 		// Only keep the passed attributes after making sure that they're valid pairs
88
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
88
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
89 89
 
90 90
 		$atts = array();
91 91
 
92
-		foreach( $filtered_atts as $key => $passed_value ) {
92
+		foreach ( $filtered_atts as $key => $passed_value ) {
93 93
 
94 94
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
95 95
 			$passed_value = GravityView_Merge_Tags::replace_variables( $passed_value );
96 96
 
97
-			switch( $defaults[ $key ]['type'] ) {
97
+			switch ( $defaults[ $key ][ 'type' ] ) {
98 98
 
99 99
 				/**
100 100
 				 * Make sure number fields are numeric.
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
103 103
 				 */
104 104
 				case 'number':
105
-					if( is_numeric( $passed_value ) ) {
105
+					if ( is_numeric( $passed_value ) ) {
106 106
 						$atts[ $key ] = ( $passed_value + 0 );
107 107
 					}
108 108
 					break;
109 109
 
110 110
 				/** @since 2.1 */
111 111
 				case 'operator':
112
-					if( GFFormsModel::is_valid_operator( $passed_value ) ) {
112
+					if ( GFFormsModel::is_valid_operator( $passed_value ) ) {
113 113
 						$atts[ $key ] = $passed_value;
114 114
 					}
115 115
 					break;
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 				 */
125 125
 				case 'select':
126 126
 				case 'radio':
127
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
128
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
127
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
128
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
129 129
 						$atts[ $key ] = $passed_value;
130 130
 					}
131 131
 					break;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		$gravityview_view = GravityView_View::getInstance();
155 155
 		$return = '';
156 156
 
157
-		switch( $detail ) {
157
+		switch ( $detail ) {
158 158
 			case 'total_entries':
159 159
 				$return = number_format_i18n( $gravityview_view->getTotalEntries() );
160 160
 				break;
Please login to merge, or discard this patch.
includes/class-gravityview-extension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
  */
15 15
 abstract class GravityView_Extension extends \GV\Extension {
16 16
 	public function __construct() {
17
-		if( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) {
17
+		if ( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) {
18 18
 			gravityview()->log->warning( '\GravityView_Extension is deprecated. Inherit from \GV\Extension instead', array( 'data' => $this ) );
19 19
 		}
20 20
 		parent::__construct();
Please login to merge, or discard this patch.