Completed
Push — develop ( e7038a...fd73f3 )
by Gennady
16:55
created
includes/class-admin-views.php 1 patch
Spacing   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -28,30 +28,30 @@  discard block
 block discarded – undo
28 28
 		add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 );
29 29
 
30 30
 		// Tooltips
31
-		add_filter( 'gform_tooltips', array( $this, 'tooltips') );
31
+		add_filter( 'gform_tooltips', array( $this, 'tooltips' ) );
32 32
 
33 33
 		// adding styles and scripts
34
-		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 );
35
-		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') );
36
-		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') );
37
-		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') );
38
-		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') );
39
-
40
-		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 );
41
-		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 );
42
-		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 );
43
-		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') );
44
-		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 );
34
+		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 );
35
+		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) );
36
+		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) );
37
+		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) );
38
+		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
39
+
40
+		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 );
41
+		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 );
42
+		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 );
43
+		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) );
44
+		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 );
45 45
 
46 46
 		// @todo check if this hook is needed..
47 47
 		//add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 );
48 48
 
49 49
 		// Add Connected Form column
50
-		add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) );
50
+		add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) );
51 51
 
52 52
 		add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );
53 53
 
54
-		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 );
54
+		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 );
55 55
 
56 56
 		add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) );
57 57
 
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	function suggest_support_articles( $localization_data = array() ) {
72 72
 
73
-	    if( ! gravityview()->request->is_view() ) {
73
+	    if ( ! gravityview()->request->is_view() ) {
74 74
 	        return $localization_data;
75 75
         }
76 76
 
77
-		$localization_data['suggest'] = array(
77
+		$localization_data[ 'suggest' ] = array(
78 78
             '57ef23539033602e61d4a560',
79 79
             '54c67bb9e4b0512429885513',
80 80
             '54c67bb9e4b0512429885512',
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 	public function filter_pre_get_posts_by_gravityview_form_id( &$query ) {
96 96
 		global $pagenow;
97 97
 
98
-		if ( !is_admin() ) {
98
+		if ( ! is_admin() ) {
99 99
 			return;
100 100
 		}
101 101
 
102
-		$form_id = isset( $_GET['gravityview_form_id'] ) ? (int) $_GET['gravityview_form_id'] : false;
102
+		$form_id = isset( $_GET[ 'gravityview_form_id' ] ) ? (int)$_GET[ 'gravityview_form_id' ] : false;
103 103
 
104
-		if( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) {
104
+		if ( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) {
105 105
 			return;
106 106
 		}
107 107
 
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
 	function add_view_dropdown() {
119 119
 		$current_screen = get_current_screen();
120 120
 
121
-		if( 'gravityview' !== $current_screen->post_type ) {
121
+		if ( 'gravityview' !== $current_screen->post_type ) {
122 122
 			return;
123 123
 		}
124 124
 
125 125
 		$forms = gravityview_get_forms();
126 126
 		$current_form = \GV\Utils::_GET( 'gravityview_form_id' );
127 127
 		// If there are no forms to select, show no forms.
128
-		if( !empty( $forms ) ) { ?>
128
+		if ( ! empty( $forms ) ) { ?>
129 129
 			<select name="gravityview_form_id" id="gravityview_form_id">
130 130
 				<option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option>
131
-				<?php foreach( $forms as $form ) { ?>
132
-					<option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
131
+				<?php foreach ( $forms as $form ) { ?>
132
+					<option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
133 133
 				<?php } ?>
134 134
 			</select>
135 135
 		<?php }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) {
144 144
 		_deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' );
145
-		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id );
145
+		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id );
146 146
 	}
147 147
 
148 148
 	/**
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 
166 166
 		$connected_views = gravityview_get_connected_views( $id, array( 'post_status' => 'any' ) );
167 167
 
168
-		if( empty( $connected_views ) ) {
168
+		if ( empty( $connected_views ) ) {
169 169
 
170
-		    $menu_items['gravityview'] = array(
170
+		    $menu_items[ 'gravityview' ] = array(
171 171
 				'label'          => esc_attr__( 'Create a View', 'gravityview' ),
172 172
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
173 173
 				'title'          => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -183,22 +183,22 @@  discard block
 block discarded – undo
183 183
 		$sub_menu_items = array();
184 184
 		foreach ( (array)$connected_views as $view ) {
185 185
 
186
-			if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
186
+			if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
187 187
 				continue;
188 188
 			}
189 189
 
190
-			$label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
190
+			$label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
191 191
 
192
-			$sub_menu_items[] = array(
192
+			$sub_menu_items[ ] = array(
193 193
 				'label' => esc_attr( $label ),
194
-				'url' => admin_url( 'post.php?action=edit&post='.$view->ID ),
194
+				'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ),
195 195
 			);
196 196
 		}
197 197
 
198 198
 		// If there were no items added, then let's create the parent menu
199
-		if( $sub_menu_items ) {
199
+		if ( $sub_menu_items ) {
200 200
 
201
-		    $sub_menu_items[] = array(
201
+		    $sub_menu_items[ ] = array(
202 202
 			    'label' => esc_attr__( 'Create a View', 'gravityview' ),
203 203
                 'link_class' => 'gv-create-view',
204 204
 			    'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
             );
208 208
 
209 209
 			// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
210
-			$sub_menu_items[] = array(
210
+			$sub_menu_items[ ] = array(
211 211
 				'url' => '#',
212 212
 				'label' => '',
213 213
 				'menu_class' => 'hidden',
214 214
 				'capabilities' => '',
215 215
 			);
216 216
 
217
-			$menu_items['gravityview'] = array(
217
+			$menu_items[ 'gravityview' ] = array(
218 218
 				'label'          => __( 'Connected Views', 'gravityview' ),
219 219
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
220 220
 				'title'          => __( 'GravityView Views using this form as a data source', 'gravityview' ),
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 		$add = array( 'captcha', 'page' );
244 244
 
245 245
 		// Don't allowing editing the following values:
246
-		if( $context === 'edit' ) {
247
-			$add[] = 'post_id';
246
+		if ( $context === 'edit' ) {
247
+			$add[ ] = 'post_id';
248 248
 		}
249 249
 
250 250
 		$return = array_merge( $array, $add );
@@ -267,32 +267,32 @@  discard block
 block discarded – undo
267 267
 		foreach ( $default_args as $key => $arg ) {
268 268
 
269 269
 			// If an arg has `tooltip` defined, but it's false, don't display a tooltip
270
-			if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; }
270
+			if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; }
271 271
 
272 272
 			// By default, use `tooltip` if defined.
273
-			$tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip'];
273
+			$tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ];
274 274
 
275 275
 			// Otherwise, use the description as a tooltip.
276
-			if( empty( $tooltip ) && !empty( $arg['desc'] ) ) {
277
-				$tooltip = $arg['desc'];
276
+			if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) {
277
+				$tooltip = $arg[ 'desc' ];
278 278
 			}
279 279
 
280 280
 			// If there's no tooltip set, continue
281
-			if( empty( $tooltip ) ) {
281
+			if ( empty( $tooltip ) ) {
282 282
 				continue;
283 283
 			}
284 284
 
285 285
 			// Add the tooltip
286
-			$gv_tooltips[ 'gv_'.$key ] = array(
287
-				'title'	=> $arg['label'],
286
+			$gv_tooltips[ 'gv_' . $key ] = array(
287
+				'title'	=> $arg[ 'label' ],
288 288
 				'value'	=> $tooltip,
289 289
 			);
290 290
 
291 291
 		}
292 292
 
293
-		$gv_tooltips['gv_css_merge_tags'] = array(
294
-			'title' => __('CSS Merge Tags', 'gravityview'),
295
-			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' )
293
+		$gv_tooltips[ 'gv_css_merge_tags' ] = array(
294
+			'title' => __( 'CSS Merge Tags', 'gravityview' ),
295
+			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' )
296 296
 		);
297 297
 
298 298
 		/**
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
 
311 311
 		foreach ( $gv_tooltips as $key => $tooltip ) {
312 312
 
313
-			$title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>';
313
+			$title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>';
314 314
 
315
-			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) );
315
+			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) );
316 316
 		}
317 317
 
318 318
 		return $tooltips;
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 *
327 327
 	 * @return void
328 328
 	 */
329
-	public function add_custom_column_content( $column_name = NULL, $post_id )	{
329
+	public function add_custom_column_content( $column_name = NULL, $post_id ) {
330 330
 
331 331
 		$output = '';
332 332
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 				// Generate backup if label doesn't exist: `example_name` => `Example Name`
349 349
 				$template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) );
350 350
 
351
-				$output = $template ? $template['label'] : $template_id_pretty;
351
+				$output = $template ? $template[ 'label' ] : $template_id_pretty;
352 352
 
353 353
 				break;
354 354
 
@@ -389,44 +389,44 @@  discard block
 block discarded – undo
389 389
 	static public function get_connected_form_links( $form, $include_form_link = true ) {
390 390
 
391 391
 		// Either the form is empty or the form ID is 0, not yet set.
392
-		if( empty( $form ) ) {
392
+		if ( empty( $form ) ) {
393 393
 			return '';
394 394
 		}
395 395
 
396 396
 		// The $form is passed as the form ID
397
-		if( !is_array( $form ) ) {
397
+		if ( ! is_array( $form ) ) {
398 398
 			$form = gravityview_get_form( $form );
399 399
 		}
400 400
 
401
-		$form_id = $form['id'];
401
+		$form_id = $form[ 'id' ];
402 402
 		$links = array();
403 403
 
404
-		if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
404
+		if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
405 405
 			$form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;id=%d', $form_id ) );
406
-			$form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>';
407
-			$links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>';
406
+			$form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>';
407
+			$links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>';
408 408
 		} else {
409
-			$form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>';
409
+			$form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>';
410 410
 		}
411 411
 
412
-		if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
412
+		if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
413 413
 			$entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&amp;id=%d', $form_id ) );
414
-			$links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>';
414
+			$links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>';
415 415
 		}
416 416
 
417
-		if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
417
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
418 418
 			$settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=%d', $form_id ) );
419
-			$links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>';
419
+			$links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>';
420 420
 		}
421 421
 
422
-		if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) {
422
+		if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) {
423 423
 			$preview_url = site_url( sprintf( '?gf_page=preview&amp;id=%d', $form_id ) );
424
-			$links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>';
424
+			$links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>';
425 425
 		}
426 426
 
427 427
 		$output = '';
428 428
 
429
-		if( !empty( $include_form_link ) ) {
429
+		if ( ! empty( $include_form_link ) ) {
430 430
 			$output .= $form_link;
431 431
 		}
432 432
 
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		 */
439 439
 		$links = apply_filters( 'gravityview_connected_form_links', $links, $form );
440 440
 
441
-		$output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>';
441
+		$output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>';
442 442
 
443 443
 		return $output;
444 444
 	}
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
 		// Get the date column and save it for later to add back in.
453 453
 		// This adds it after the Data Source column.
454 454
 		// This way, we don't need to do array_slice, array_merge, etc.
455
-		$date = $columns['date'];
456
-		unset( $columns['date'] );
455
+		$date = $columns[ 'date' ];
456
+		unset( $columns[ 'date' ] );
457 457
 
458 458
 		$data_source_required_caps = array(
459 459
 			'gravityforms_edit_forms',
@@ -464,14 +464,14 @@  discard block
 block discarded – undo
464 464
 			'gravityforms_preview_forms',
465 465
 		);
466 466
 
467
-		if( GVCommon::has_cap( $data_source_required_caps ) ) {
468
-			$columns['gv_connected_form'] = __( 'Data Source', 'gravityview' );
467
+		if ( GVCommon::has_cap( $data_source_required_caps ) ) {
468
+			$columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' );
469 469
 		}
470 470
 
471
-		$columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
471
+		$columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
472 472
 
473 473
 		// Add the date back in.
474
-		$columns['date'] = $date;
474
+		$columns[ 'date' ] = $date;
475 475
 
476 476
 		return $columns;
477 477
 	}
@@ -485,12 +485,12 @@  discard block
 block discarded – undo
485 485
 	 */
486 486
 	function save_postdata( $post_id ) {
487 487
 
488
-		if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
488
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
489 489
 			return;
490 490
 		}
491 491
 
492 492
 		// validate post_type
493
-		if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) {
493
+		if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) {
494 494
 			return;
495 495
 		}
496 496
 
@@ -505,63 +505,63 @@  discard block
 block discarded – undo
505 505
 		$statii = array();
506 506
 
507 507
 		// check if this is a start fresh View
508
-		if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) {
508
+		if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) {
509 509
 
510
-			$form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : '';
510
+			$form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : '';
511 511
 			// save form id
512
-			$statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
512
+			$statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
513 513
 
514 514
 		}
515 515
 
516
-		if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) {
516
+		if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) {
517 517
 			gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) );
518 518
 			return;
519 519
 		}
520 520
 
521 521
 		// Was this a start fresh?
522
-		if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) {
523
-			$statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
522
+		if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) {
523
+			$statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
524 524
 		} else {
525
-			$statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
525
+			$statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
526 526
 		}
527 527
 
528 528
 		// Check if we have a template id
529
-		if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) {
529
+		if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) {
530 530
 
531
-			$template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : '';
531
+			$template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : '';
532 532
 
533 533
 			// now save template id
534
-			$statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
534
+			$statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
535 535
 		}
536 536
 
537 537
 
538 538
 		// save View Configuration metabox
539
-		if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) {
539
+		if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) {
540 540
 
541 541
 			// template settings
542
-			if( empty( $_POST['template_settings'] ) ) {
543
-				$_POST['template_settings'] = array();
542
+			if ( empty( $_POST[ 'template_settings' ] ) ) {
543
+				$_POST[ 'template_settings' ] = array();
544 544
 			}
545
-			$statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] );
545
+			$statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] );
546 546
 
547 547
 			$fields = array();
548 548
 
549 549
 			// Directory&single Visible Fields
550
-			if( !empty( $preset_fields ) ) {
550
+			if ( ! empty( $preset_fields ) ) {
551 551
 
552 552
 				$fields = $preset_fields;
553 553
 
554
-			} elseif( !empty( $_POST['gv_fields'] ) ) {
554
+			} elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) {
555 555
 				$fields = _gravityview_process_posted_fields();
556 556
 			}
557 557
 
558
-			$statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
558
+			$statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
559 559
 
560 560
 			// Directory Visible Widgets
561
-			if( empty( $_POST['widgets'] ) ) {
562
-				$_POST['widgets'] = array();
561
+			if ( empty( $_POST[ 'widgets' ] ) ) {
562
+				$_POST[ 'widgets' ] = array();
563 563
 			}
564
-			$statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] );
564
+			$statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] );
565 565
 
566 566
 		} // end save view configuration
567 567
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 		 * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false.
572 572
 		 * @since 1.17.2
573 573
 		 */
574
-		do_action('gravityview_view_saved', $post_id, $statii );
574
+		do_action( 'gravityview_view_saved', $post_id, $statii );
575 575
 
576 576
 		gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) );
577 577
 	}
@@ -615,20 +615,20 @@  discard block
 block discarded – undo
615 615
 
616 616
 		$output = '';
617 617
 
618
-		if( !empty( $fields ) ) {
618
+		if ( ! empty( $fields ) ) {
619 619
 
620
-			foreach( $fields as $id => $details ) {
620
+			foreach ( $fields as $id => $details ) {
621 621
 
622
-				if( in_array( $details['type'], (array) $blacklist_field_types ) ) {
622
+				if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) {
623 623
 					continue;
624 624
 				}
625 625
 
626 626
 				// Edit mode only allows editing the parent fields, not single inputs.
627
-				if( $context === 'edit' && !empty( $details['parent'] ) ) {
627
+				if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) {
628 628
 					continue;
629 629
 				}
630 630
 
631
-				$output .= new GravityView_Admin_View_Field( $details['label'], $id, $details );
631
+				$output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details );
632 632
 
633 633
 			} // End foreach
634 634
 		}
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 		echo $output;
637 637
 
638 638
 		// For the EDIT view we only want to allow the form fields.
639
-		if( $context === 'edit' ) {
639
+		if ( $context === 'edit' ) {
640 640
 			return;
641 641
 		}
642 642
 
@@ -660,16 +660,16 @@  discard block
 block discarded – undo
660 660
 		$additional_fields = apply_filters( 'gravityview_additional_fields', array(
661 661
 			array(
662 662
 				'label_text' => __( '+ Add All Fields', 'gravityview' ),
663
-				'desc' => __('Add all the available fields at once.', 'gravityview'),
663
+				'desc' => __( 'Add all the available fields at once.', 'gravityview' ),
664 664
 				'field_id' => 'all-fields',
665 665
 				'label_type' => 'field',
666 666
 				'input_type' => NULL,
667 667
 				'field_options' => NULL,
668 668
 				'settings_html'	=> NULL,
669 669
 			)
670
-		));
670
+		) );
671 671
 
672
-		if( !empty( $additional_fields )) {
672
+		if ( ! empty( $additional_fields ) ) {
673 673
 			foreach ( (array)$additional_fields as $item ) {
674 674
 
675 675
 				// Prevent items from not having index set
@@ -680,16 +680,16 @@  discard block
 block discarded – undo
680 680
 					'input_type' => NULL,
681 681
 					'field_options' => NULL,
682 682
 					'settings_html'	=> NULL,
683
-				));
683
+				) );
684 684
 
685 685
 				// Backward compat.
686
-				if( !empty( $item['field_options'] ) ) {
686
+				if ( ! empty( $item[ 'field_options' ] ) ) {
687 687
 					// Use settings_html from now on.
688
-					$item['settings_html'] = $item['field_options'];
688
+					$item[ 'settings_html' ] = $item[ 'field_options' ];
689 689
 				}
690 690
 
691 691
 				// Render a label for each of them
692
-				echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item );
692
+				echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item );
693 693
 
694 694
 			}
695 695
 		}
@@ -702,54 +702,54 @@  discard block
 block discarded – undo
702 702
 	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
703 703
 	 * @return array
704 704
 	 */
705
-	function get_entry_default_fields($form, $zone) {
705
+	function get_entry_default_fields( $form, $zone ) {
706 706
 
707 707
 		$entry_default_fields = array();
708 708
 
709
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
709
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
710 710
 
711 711
 			$entry_default_fields = array(
712 712
 				'id' => array(
713
-					'label' => __('Entry ID', 'gravityview'),
713
+					'label' => __( 'Entry ID', 'gravityview' ),
714 714
 					'type' => 'id',
715
-					'desc'	=> __('The unique ID of the entry.', 'gravityview'),
715
+					'desc'	=> __( 'The unique ID of the entry.', 'gravityview' ),
716 716
 				),
717 717
 				'date_created' => array(
718
-					'label' => __('Entry Date', 'gravityview'),
719
-					'desc'	=> __('The date the entry was created.', 'gravityview'),
718
+					'label' => __( 'Entry Date', 'gravityview' ),
719
+					'desc'	=> __( 'The date the entry was created.', 'gravityview' ),
720 720
 					'type' => 'date_created',
721 721
 				),
722 722
 				'source_url' => array(
723
-					'label' => __('Source URL', 'gravityview'),
723
+					'label' => __( 'Source URL', 'gravityview' ),
724 724
 					'type' => 'source_url',
725
-					'desc'	=> __('The URL of the page where the form was submitted.', 'gravityview'),
725
+					'desc'	=> __( 'The URL of the page where the form was submitted.', 'gravityview' ),
726 726
 				),
727 727
 				'ip' => array(
728
-					'label' => __('User IP', 'gravityview'),
728
+					'label' => __( 'User IP', 'gravityview' ),
729 729
 					'type' => 'ip',
730
-					'desc'	=> __('The IP Address of the user who created the entry.', 'gravityview'),
730
+					'desc'	=> __( 'The IP Address of the user who created the entry.', 'gravityview' ),
731 731
 				),
732 732
 				'created_by' => array(
733
-					'label' => __('User', 'gravityview'),
733
+					'label' => __( 'User', 'gravityview' ),
734 734
 					'type' => 'created_by',
735
-					'desc'	=> __('Details of the logged-in user who created the entry (if any).', 'gravityview'),
735
+					'desc'	=> __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ),
736 736
 				),
737 737
 
738 738
 				/**
739 739
 				 * @since 1.7.2
740 740
 				 */
741 741
 			    'other_entries' => array(
742
-				    'label'	=> __('Other Entries', 'gravityview'),
742
+				    'label'	=> __( 'Other Entries', 'gravityview' ),
743 743
 				    'type'	=> 'other_entries',
744
-				    'desc'	=> __('Display other entries created by the entry creator.', 'gravityview'),
744
+				    'desc'	=> __( 'Display other entries created by the entry creator.', 'gravityview' ),
745 745
 			    ),
746 746
 	        );
747 747
 
748
-			if( 'single' !== $zone) {
748
+			if ( 'single' !== $zone ) {
749 749
 
750
-				$entry_default_fields['entry_link'] = array(
751
-					'label' => __('Link to Entry', 'gravityview'),
752
-					'desc'	=> __('A dedicated link to the single entry with customizable text.', 'gravityview'),
750
+				$entry_default_fields[ 'entry_link' ] = array(
751
+					'label' => __( 'Link to Entry', 'gravityview' ),
752
+					'desc'	=> __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ),
753 753
 					'type' => 'entry_link',
754 754
 				);
755 755
 			}
@@ -759,10 +759,10 @@  discard block
 block discarded – undo
759 759
 		/**
760 760
 		 * @since  1.2
761 761
 		 */
762
-		$entry_default_fields['custom']	= array(
763
-			'label'	=> __('Custom Content', 'gravityview'),
762
+		$entry_default_fields[ 'custom' ] = array(
763
+			'label'	=> __( 'Custom Content', 'gravityview' ),
764 764
 			'type'	=> 'custom',
765
-			'desc'	=> __('Insert custom text or HTML.', 'gravityview'),
765
+			'desc'	=> __( 'Insert custom text or HTML.', 'gravityview' ),
766 766
 		);
767 767
 
768 768
 		/**
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 		 * @param  string|array $form form_ID or form object
772 772
 		 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
773 773
 		 */
774
-		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone);
774
+		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone );
775 775
 	}
776 776
 
777 777
 	/**
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 	 */
783 783
 	function get_available_fields( $form = '', $zone = NULL ) {
784 784
 
785
-		if( empty( $form ) ) {
785
+		if ( empty( $form ) ) {
786 786
 			gravityview()->log->error( '$form is empty' );
787 787
 			return array();
788 788
 		}
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 		$fields = gravityview_get_form_fields( $form, true );
792 792
 
793 793
 		// get meta fields ( only if form was already created )
794
-		if( !is_array( $form ) ) {
794
+		if ( ! is_array( $form ) ) {
795 795
 			$meta_fields = gravityview_get_entry_meta( $form );
796 796
 		} else {
797 797
 			$meta_fields = array();
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 		$fields = $fields + $meta_fields + $default_fields;
805 805
 
806 806
 		// Move Custom Content to top
807
-		$fields = array( 'custom' => $fields['custom'] ) + $fields;
807
+		$fields = array( 'custom' => $fields[ 'custom' ] ) + $fields;
808 808
 
809 809
 		return $fields;
810 810
 	}
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
 
819 819
 		$widgets = $this->get_registered_widgets();
820 820
 
821
-		if( !empty( $widgets ) ) {
821
+		if ( ! empty( $widgets ) ) {
822 822
 
823
-			foreach( $widgets as $id => $details ) {
823
+			foreach ( $widgets as $id => $details ) {
824 824
 
825
-				echo new GravityView_Admin_View_Widget( $details['label'], $id, $details );
825
+				echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details );
826 826
 
827 827
 			}
828 828
 		}
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 	function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
852 852
 		global $post;
853 853
 
854
-		if( $type === 'widget' ) {
854
+		if ( $type === 'widget' ) {
855 855
 			$button_label = __( 'Add Widget', 'gravityview' );
856 856
 		} else {
857 857
 			$button_label = __( 'Add Field', 'gravityview' );
@@ -862,15 +862,15 @@  discard block
 block discarded – undo
862 862
 		$view = \GV\View::from_post( $post );
863 863
 
864 864
 		// if saved values, get available fields to label everyone
865
-		if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) {
865
+		if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) {
866 866
 
867
-			if( !empty( $_POST['template_id'] ) ) {
868
-				$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
867
+			if ( ! empty( $_POST[ 'template_id' ] ) ) {
868
+				$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
869 869
 			} else {
870 870
 				$form = gravityview_get_form_id( $post->ID );
871 871
 			}
872 872
 
873
-			if( 'field' === $type ) {
873
+			if ( 'field' === $type ) {
874 874
 				$available_items = $this->get_available_fields( $form, $zone );
875 875
 			} else {
876 876
 				$available_items = $this->get_registered_widgets();
@@ -878,42 +878,42 @@  discard block
 block discarded – undo
878 878
 
879 879
 		}
880 880
 
881
-		foreach( $rows as $row ) :
882
-			foreach( $row as $col => $areas ) :
883
-				$column = ($col == '2-2') ? '1-2' : $col; ?>
881
+		foreach ( $rows as $row ) :
882
+			foreach ( $row as $col => $areas ) :
883
+				$column = ( $col == '2-2' ) ? '1-2' : $col; ?>
884 884
 
885 885
 				<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
886 886
 
887
-					<?php foreach( $areas as $area ) : 	?>
887
+					<?php foreach ( $areas as $area ) : 	?>
888 888
 
889 889
 						<div class="gv-droppable-area">
890
-							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>">
890
+							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>">
891 891
 
892 892
 								<?php // render saved fields
893 893
 
894
-								if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) {
894
+								if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) {
895 895
 
896
-									foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) {
896
+									foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) {
897 897
 
898 898
 										$input_type = NULL;
899
-										$original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ;
899
+										$original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false;
900 900
 
901
-										if( !$original_item ) {
901
+										if ( ! $original_item ) {
902 902
 
903
-											gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) );
903
+											gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) );
904 904
 
905 905
 											$original_item = $field;
906 906
 										} else {
907 907
 
908
-											$input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL;
908
+											$input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL;
909 909
 
910 910
 										}
911 911
 
912 912
 										// Maybe has a form ID
913
-										$form_id = empty( $field['form_id'] ) ? null : $field['form_id'];
913
+										$form_id = empty( $field[ 'form_id' ] ) ? null : $field[ 'form_id' ];
914 914
 
915 915
 										// Field options dialog box
916
-										$field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item );
916
+										$field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item );
917 917
 
918 918
 										$item = array(
919 919
 											'input_type' => $input_type,
@@ -922,16 +922,16 @@  discard block
 block discarded – undo
922 922
 										);
923 923
 
924 924
 										// Merge the values with the current item to pass things like widget descriptions and original field names
925
-										if( $original_item ) {
925
+										if ( $original_item ) {
926 926
 											$item = wp_parse_args( $item, $original_item );
927 927
 										}
928 928
 
929
-										switch( $type ) {
929
+										switch ( $type ) {
930 930
 											case 'widget':
931
-												echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field );
931
+												echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field );
932 932
 												break;
933 933
 											default:
934
-												echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field );
934
+												echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field );
935 935
 										}
936 936
 
937 937
 
@@ -941,12 +941,12 @@  discard block
 block discarded – undo
941 941
 
942 942
 								} // End if zone is not empty ?>
943 943
 
944
-								<span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span>
944
+								<span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span>
945 945
 							</div>
946 946
 							<div class="gv-droppable-area-action">
947
-								<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></a>
947
+								<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a>
948 948
 
949
-								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p>
949
+								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p>
950 950
 							</div>
951 951
 						</div>
952 952
 
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 		$default_widget_areas = GravityView_Widget::get_default_widget_areas();
969 969
 
970 970
 		$widgets = array();
971
-		if( !empty( $post_id ) ) {
971
+		if ( ! empty( $post_id ) ) {
972 972
 			$widgets = gravityview_get_directory_widgets( $post_id );
973 973
 		}
974 974
 
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
 	 * @return string HTML of the active areas
998 998
 	 */
999 999
 	function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) {
1000
-		if( empty( $template_id ) ) {
1000
+		if ( empty( $template_id ) ) {
1001 1001
 			gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) );
1002 1002
 			return '';
1003 1003
 		}
@@ -1011,12 +1011,12 @@  discard block
 block discarded – undo
1011 1011
 		 */
1012 1012
 		$template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context );
1013 1013
 
1014
-		if( empty( $template_areas ) ) {
1014
+		if ( empty( $template_areas ) ) {
1015 1015
 
1016 1016
 			gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) );
1017 1017
 			$output = '<div>';
1018
-			$output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>';
1019
-			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>';
1018
+			$output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>';
1019
+			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>';
1020 1020
 			$output .= '</div>';
1021 1021
 		} else {
1022 1022
 
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 
1032 1032
 		}
1033 1033
 
1034
-		if( $echo ) {
1034
+		if ( $echo ) {
1035 1035
 			echo $output;
1036 1036
 		}
1037 1037
 
@@ -1051,26 +1051,26 @@  discard block
 block discarded – undo
1051 1051
 		$is_widgets_page = ( $pagenow === 'widgets.php' );
1052 1052
 
1053 1053
 		// Add the GV font (with the Astronaut)
1054
-		wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
1054
+		wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
1055 1055
 
1056
-		wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true );
1056
+		wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1057 1057
 
1058 1058
 		// Don't process any scripts below here if it's not a GravityView page.
1059
-		if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) {
1059
+		if ( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) {
1060 1060
 		    return;
1061 1061
 		}
1062 1062
 
1063 1063
         wp_enqueue_script( 'jquery-ui-datepicker' );
1064
-        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version );
1064
+        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version );
1065 1065
 
1066
-        $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
1066
+        $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1067 1067
 
1068 1068
         //enqueue scripts
1069 1069
         wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version );
1070 1070
 
1071
-        wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1071
+        wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array(
1072 1072
             'cookiepath' => COOKIEPATH,
1073
-            'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ),
1073
+            'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ),
1074 1074
             'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1075 1075
             'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1076 1076
             'label_close' => __( 'Close', 'gravityview' ),
@@ -1082,9 +1082,9 @@  discard block
 block discarded – undo
1082 1082
             'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1083 1083
             'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1084 1084
             'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ),
1085
-        ));
1085
+        ) );
1086 1086
 
1087
-        wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1087
+        wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1088 1088
 
1089 1089
         // Enqueue scripts needed for merge tags
1090 1090
         self::enqueue_gravity_forms_scripts();
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
 		);
1110 1110
 
1111 1111
 		if ( wp_is_mobile() ) {
1112
-		    $scripts[] = 'jquery-touch-punch';
1112
+		    $scripts[ ] = 'jquery-touch-punch';
1113 1113
 		}
1114 1114
 
1115 1115
 		wp_enqueue_script( $scripts );
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-custom.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
42 42
 
43
-		unset ( $field_options['search_filter'], $field_options['show_as_link'] );
43
+		unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] );
44 44
 
45 45
 		$new_fields = array(
46 46
 			'content' => array(
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		);
69 69
 
70 70
 		if ( 'edit' === $context ) {
71
-			unset( $field_options['custom_label'], $field_options['show_label'], $field_options['allow_edit_cap'], $new_fields['wpautop'], $new_fields['oembed'] );
71
+			unset( $field_options[ 'custom_label' ], $field_options[ 'show_label' ], $field_options[ 'allow_edit_cap' ], $new_fields[ 'wpautop' ], $new_fields[ 'oembed' ] );
72 72
 		}
73 73
 
74 74
 		return $new_fields + $field_options;
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 
103 103
 		// Loop through the configured Edit Entry fields and add Custom Content fields if there are any
104 104
 		// TODO: Make this available to other custom GV field types
105
-		foreach ( (array) $edit_fields as $edit_field ) {
105
+		foreach ( (array)$edit_fields as $edit_field ) {
106 106
 
107
-			if( 'custom' === \GV\Utils::get( $edit_field, 'id') ) {
107
+			if ( 'custom' === \GV\Utils::get( $edit_field, 'id' ) ) {
108 108
 
109 109
 				$field_data = array(
110 110
 					'label' => \GV\Utils::get( $edit_field, 'custom_label' ),
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 					$field_data[ $key ] = GravityView_Merge_Tags::replace_variables( $field_datum, $form, $entry->as_entry(), false, false );
118 118
 				}
119 119
 
120
-				$field_data['cssClass'] = \GV\Utils::get( $edit_field, 'custom_class' );
120
+				$field_data[ 'cssClass' ] = \GV\Utils::get( $edit_field, 'custom_class' );
121 121
 
122
-				$new_fields[] = new GF_Field_HTML( $field_data );
122
+				$new_fields[ ] = new GF_Field_HTML( $field_data );
123 123
 
124 124
 			} else {
125
-				if( isset( $fields[ $i ] ) ) {
126
-					$new_fields[] =  $fields[ $i ];
125
+				if ( isset( $fields[ $i ] ) ) {
126
+					$new_fields[ ] = $fields[ $i ];
127 127
 				}
128 128
 				$i++;
129 129
 			}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Spacing   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
 	function load() {
107 107
 
108 108
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
109
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
109
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
110 110
 
111 111
 		// Don't display an embedded form when editing an entry
112 112
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
113 113
 		add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
114 114
 
115 115
 		// Stop Gravity Forms processing what is ours!
116
-		add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
116
+		add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
117 117
 
118
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
118
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
119 119
 
120 120
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
121 121
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
127 127
 
128 128
 		// Add fields expected by GFFormDisplay::validate()
129
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
129
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
130 130
 
131 131
 		// Fix multiselect value for GF 2.2
132 132
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 * @return void
144 144
 	 */
145 145
 	public function prevent_render_form() {
146
-		if( $this->is_edit_entry() ) {
147
-			if( 'wp_head' === current_filter() ) {
146
+		if ( $this->is_edit_entry() ) {
147
+			if ( 'wp_head' === current_filter() ) {
148 148
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
149 149
 			} else {
150 150
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function prevent_maybe_process_form() {
161 161
 
162
-		if( ! empty( $_POST ) ) {
162
+		if ( ! empty( $_POST ) ) {
163 163
 	        gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) );
164 164
 		}
165 165
 
166
-		if( $this->is_edit_entry_submission() ) {
167
-			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
168
-	        remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
166
+		if ( $this->is_edit_entry_submission() ) {
167
+			remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
168
+	        remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
169 169
 		}
170 170
 	}
171 171
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function is_edit_entry() {
177 177
 
178
-		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] );
178
+		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] );
179 179
 
180 180
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
181 181
 	}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @return boolean
187 187
 	 */
188 188
 	public function is_edit_entry_submission() {
189
-		return !empty( $_POST[ self::$nonce_field ] );
189
+		return ! empty( $_POST[ self::$nonce_field ] );
190 190
 	}
191 191
 
192 192
 	/**
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 		$entries = $gravityview_view->getEntries();
200
-	    self::$original_entry = $entries[0];
201
-	    $this->entry = $entries[0];
200
+	    self::$original_entry = $entries[ 0 ];
201
+	    $this->entry = $entries[ 0 ];
202 202
 
203 203
 		self::$original_form = $gravityview_view->getForm();
204 204
 		$this->form = $gravityview_view->getForm();
205 205
 		$this->form_id = $gravityview_view->getFormId();
206 206
 		$this->view_id = $gravityview_view->getViewId();
207 207
 
208
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
208
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
209 209
 	}
210 210
 
211 211
 
@@ -229,13 +229,13 @@  discard block
 block discarded – undo
229 229
 		}
230 230
 
231 231
 		// Multiple Views embedded, don't proceed if nonce fails
232
-		if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) {
232
+		if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) {
233 233
 			gravityview()->log->error( 'Nonce validation failed for the Edit Entry request; returning' );
234 234
 			return;
235 235
 		}
236 236
 
237 237
 		// Sorry, you're not allowed here.
238
-		if( false === $this->user_can_edit_entry( true ) ) {
238
+		if ( false === $this->user_can_edit_entry( true ) ) {
239 239
 			gravityview()->log->error( 'User is not allowed to edit this entry; returning', array( 'data' => $this->entry ) );
240 240
 			return;
241 241
 		}
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	private function print_scripts() {
257 257
 		$gravityview_view = GravityView_View::getInstance();
258 258
 
259
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
259
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
260 260
 
261
-		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false);
261
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
262 262
 
263 263
 		wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) );
264 264
 
@@ -272,19 +272,19 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	private function process_save() {
274 274
 
275
-		if( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
275
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
276 276
 			return;
277 277
 		}
278 278
 
279 279
 		// Make sure the entry, view, and form IDs are all correct
280 280
 		$valid = $this->verify_nonce();
281 281
 
282
-		if( !$valid ) {
282
+		if ( ! $valid ) {
283 283
 			gravityview()->log->error( 'Nonce validation failed.' );
284 284
 			return;
285 285
 		}
286 286
 
287
-		if( $this->entry['id'] !== $_POST['lid'] ) {
287
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
288 288
 			gravityview()->log->error( 'Entry ID did not match posted entry ID.' );
289 289
 			return;
290 290
 		}
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 		$this->validate();
297 297
 
298
-		if( $this->is_valid ) {
298
+		if ( $this->is_valid ) {
299 299
 
300 300
 			gravityview()->log->debug( 'Submission is valid.' );
301 301
 
@@ -307,22 +307,22 @@  discard block
 block discarded – undo
307 307
 			/**
308 308
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
309 309
 			 */
310
-			unset( $_GET['page'] );
310
+			unset( $_GET[ 'page' ] );
311 311
 
312
-			$date_created = $this->entry['date_created'];
312
+			$date_created = $this->entry[ 'date_created' ];
313 313
 
314 314
 			/**
315 315
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
316 316
 			 * @since 1.17.2
317 317
 			 */
318
-			unset( $this->entry['date_created'] );
318
+			unset( $this->entry[ 'date_created' ] );
319 319
 
320 320
 			GFFormsModel::save_lead( $form, $this->entry );
321 321
 
322 322
 	        // Delete the values for hidden inputs
323 323
 	        $this->unset_hidden_field_values();
324 324
 			
325
-			$this->entry['date_created'] = $date_created;
325
+			$this->entry[ 'date_created' ] = $date_created;
326 326
 
327 327
 			// Process calculation fields
328 328
 			$this->update_calculation_fields();
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			 * @param string $entry_id Numeric ID of the entry that was updated
343 343
 			 * @param GravityView_Edit_Entry_Render $this This object
344 344
 			 */
345
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this );
345
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this );
346 346
 
347 347
 		} else {
348 348
 			gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) );
@@ -370,16 +370,16 @@  discard block
 block discarded – undo
370 370
 		 */
371 371
 		$unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this );
372 372
 
373
-		if( ! $unset_hidden_field_values ) {
373
+		if ( ! $unset_hidden_field_values ) {
374 374
 			return;
375 375
 		}
376 376
 
377 377
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) {
378 378
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
379
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
379
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
380 380
 		} else {
381 381
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
382
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
382
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
383 383
 		}
384 384
 
385 385
 	    foreach ( $this->entry as $input_id => $field_value ) {
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 		}
461 461
 
462 462
 		/** No file is being uploaded. */
463
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
463
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
464 464
 			/** So return the original upload */
465 465
 			return $entry[ $input_id ];
466 466
 		}
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 	 * @return mixed
479 479
 	 */
480 480
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
481
-		if( ! $this->is_edit_entry() ) {
481
+		if ( ! $this->is_edit_entry() ) {
482 482
 			return $plupload_init;
483 483
 		}
484 484
 
485
-		$plupload_init['gf_vars']['max_files'] = 0;
485
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
486 486
 
487 487
 		return $plupload_init;
488 488
 	}
@@ -497,22 +497,22 @@  discard block
 block discarded – undo
497 497
 		$form = $this->form;
498 498
 
499 499
 	    /** @var GF_Field $field */
500
-		foreach( $form['fields'] as $k => &$field ) {
500
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
501 501
 
502 502
 			/**
503 503
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
504 504
 			 * @since 1.16.3
505 505
 			 * @var GF_Field $field
506 506
 			 */
507
-			if( $field->has_calculation() ) {
508
-				unset( $form['fields'][ $k ] );
507
+			if ( $field->has_calculation() ) {
508
+				unset( $form[ 'fields' ][ $k ] );
509 509
 			}
510 510
 
511 511
 			$field->adminOnly = false;
512 512
 
513
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
514
-				foreach( $field->inputs as $key => $input ) {
515
-				    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
513
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
514
+				foreach ( $field->inputs as $key => $input ) {
515
+				    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
516 516
 				}
517 517
 			}
518 518
 		}
@@ -526,30 +526,30 @@  discard block
 block discarded – undo
526 526
 		$update = false;
527 527
 
528 528
 		// get the most up to date entry values
529
-		$entry = GFAPI::get_entry( $this->entry['id'] );
529
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
530 530
 
531
-		if( !empty( $this->fields_with_calculation ) ) {
531
+		if ( ! empty( $this->fields_with_calculation ) ) {
532 532
 			$update = true;
533 533
 			foreach ( $this->fields_with_calculation as $calc_field ) {
534 534
 				$inputs = $calc_field->get_entry_inputs();
535 535
 				if ( is_array( $inputs ) ) {
536 536
 				    foreach ( $inputs as $input ) {
537
-				        $input_name = 'input_' . str_replace( '.', '_', $input['id'] );
538
-				        $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
537
+				        $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
538
+				        $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
539 539
 				    }
540 540
 				} else {
541
-				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
542
-				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
541
+				    $input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
542
+				    $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
543 543
 				}
544 544
 			}
545 545
 
546 546
 		}
547 547
 
548
-		if( $update ) {
548
+		if ( $update ) {
549 549
 
550 550
 			$return_entry = GFAPI::update_entry( $entry );
551 551
 
552
-			if( is_wp_error( $return_entry ) ) {
552
+			if ( is_wp_error( $return_entry ) ) {
553 553
 				gravityview()->log->error( 'Updating the entry calculation fields failed', array( 'data' => $return_entry ) );
554 554
 			} else {
555 555
 				gravityview()->log->debug( 'Updating the entry calculation fields succeeded' );
@@ -580,19 +580,19 @@  discard block
 block discarded – undo
580 580
 
581 581
 		$input_name = 'input_' . $field_id;
582 582
 
583
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
583
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
584 584
 
585 585
 			// We have a new image
586 586
 
587
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
587
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
588 588
 
589 589
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
590 590
 	        $ary = stripslashes_deep( $ary );
591 591
 			$img_url = \GV\Utils::get( $ary, 0 );
592 592
 
593
-			$img_title       = count( $ary ) > 1 ? $ary[1] : '';
594
-			$img_caption     = count( $ary ) > 2 ? $ary[2] : '';
595
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
593
+			$img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
594
+			$img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
595
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
596 596
 
597 597
 			$image_meta = array(
598 598
 				'post_excerpt' => $img_caption,
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 
602 602
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
603 603
 			if ( ! empty( $img_title ) ) {
604
-				$image_meta['post_title'] = $img_title;
604
+				$image_meta[ 'post_title' ] = $img_title;
605 605
 			}
606 606
 
607 607
 			/**
@@ -659,15 +659,15 @@  discard block
 block discarded – undo
659 659
 	 */
660 660
 	private function maybe_update_post_fields( $form ) {
661 661
 
662
-		if( empty( $this->entry['post_id'] ) ) {
662
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
663 663
 	        gravityview()->log->debug( 'This entry has no post fields. Continuing...' );
664 664
 			return;
665 665
 		}
666 666
 
667
-		$post_id = $this->entry['post_id'];
667
+		$post_id = $this->entry[ 'post_id' ];
668 668
 
669 669
 		// Security check
670
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
670
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
671 671
 			gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) );
672 672
 			return;
673 673
 		}
@@ -680,25 +680,25 @@  discard block
 block discarded – undo
680 680
 
681 681
 			$field = RGFormsModel::get_field( $form, $field_id );
682 682
 
683
-			if( ! $field ) {
683
+			if ( ! $field ) {
684 684
 				continue;
685 685
 			}
686 686
 
687
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
687
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
688 688
 
689 689
 				// Get the value of the field, including $_POSTed value
690 690
 				$value = RGFormsModel::get_field_value( $field );
691 691
 
692 692
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
693 693
 				$entry_tmp = $this->entry;
694
-				$entry_tmp["{$field_id}"] = $value;
694
+				$entry_tmp[ "{$field_id}" ] = $value;
695 695
 
696
-				switch( $field->type ) {
696
+				switch ( $field->type ) {
697 697
 
698 698
 				    case 'post_title':
699 699
 				        $post_title = $value;
700 700
 				        if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) {
701
-				            $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
701
+				            $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
702 702
 				        }
703 703
 				        $updated_post->post_title = $post_title;
704 704
 				        $updated_post->post_name  = $post_title;
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 				    case 'post_content':
709 709
 				        $post_content = $value;
710 710
 				        if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) {
711
-				            $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
711
+				            $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
712 712
 				        }
713 713
 				        $updated_post->post_content = $post_content;
714 714
 				        unset( $post_content );
@@ -726,12 +726,12 @@  discard block
 block discarded – undo
726 726
 							$value = $value[ $field_id ];
727 727
 						}
728 728
 
729
-				        if( ! empty( $field->customFieldTemplateEnabled ) ) {
729
+				        if ( ! empty( $field->customFieldTemplateEnabled ) ) {
730 730
 				            $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
731 731
 				        }
732 732
 
733 733
 	                    if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
734
-		                    $value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value );
734
+		                    $value = function_exists( 'wp_json_encode' ) ? wp_json_encode( $value ) : json_encode( $value );
735 735
 	                    }
736 736
 
737 737
 				        update_post_meta( $post_id, $field->postCustomFieldName, $value );
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 				}
745 745
 
746 746
 				// update entry after
747
-				$this->entry["{$field_id}"] = $value;
747
+				$this->entry[ "{$field_id}" ] = $value;
748 748
 
749 749
 				$update_entry = true;
750 750
 
@@ -753,11 +753,11 @@  discard block
 block discarded – undo
753 753
 
754 754
 		}
755 755
 
756
-		if( $update_entry ) {
756
+		if ( $update_entry ) {
757 757
 
758 758
 			$return_entry = GFAPI::update_entry( $this->entry );
759 759
 
760
-			if( is_wp_error( $return_entry ) ) {
760
+			if ( is_wp_error( $return_entry ) ) {
761 761
 				gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) );
762 762
 			} else {
763 763
 				gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) );
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 
768 768
 		$return_post = wp_update_post( $updated_post, true );
769 769
 
770
-		if( is_wp_error( $return_post ) ) {
770
+		if ( is_wp_error( $return_post ) ) {
771 771
 			$return_post->add_data( $updated_post, '$updated_post' );
772 772
 			gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) );
773 773
 		} else {
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 		$input_type = RGFormsModel::get_input_type( $field );
790 790
 
791 791
 	    // Only certain custom field types are supported
792
-	    switch( $input_type ) {
792
+	    switch ( $input_type ) {
793 793
 		    case 'fileupload':
794 794
 		    case 'list':
795 795
 		    case 'multiselect':
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
827 827
 
828 828
 		// replace conditional shortcodes
829
-		if( $do_shortcode ) {
829
+		if ( $do_shortcode ) {
830 830
 			$output = do_shortcode( $output );
831 831
 		}
832 832
 
@@ -845,19 +845,19 @@  discard block
 block discarded – undo
845 845
 	 */
846 846
 	private function after_update() {
847 847
 
848
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
849
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
848
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
849
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
850 850
 
851 851
 		// Re-define the entry now that we've updated it.
852
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
852
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
853 853
 
854 854
 		$entry = GFFormsModel::set_entry_meta( $entry, $this->form );
855 855
 
856 856
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
857 857
 			// We need to clear the cache because Gravity Forms caches the field values, which
858 858
 			// we have just updated.
859
-			foreach ($this->form['fields'] as $key => $field) {
860
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
859
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
860
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
861 861
 			}
862 862
 		}
863 863
 
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 
877 877
 		<div class="gv-edit-entry-wrapper"><?php
878 878
 
879
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
879
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
880 880
 
881 881
 			/**
882 882
 			 * Fixes weird wpautop() issue
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 				     * @param string $edit_entry_title Modify the "Edit Entry" title
893 893
 				     * @param GravityView_Edit_Entry_Render $this This object
894 894
 				     */
895
-				    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
895
+				    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
896 896
 
897 897
 				    echo esc_attr( $edit_entry_title );
898 898
 			?></span>
@@ -942,16 +942,16 @@  discard block
 block discarded – undo
942 942
 
943 943
 			$back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
944 944
 
945
-			if( ! $this->is_valid ){
945
+			if ( ! $this->is_valid ) {
946 946
 
947 947
 				// Keeping this compatible with Gravity Forms.
948
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
949
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
948
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
949
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
950 950
 
951
-				echo GVCommon::generate_notice( $message , 'gv-error' );
951
+				echo GVCommon::generate_notice( $message, 'gv-error' );
952 952
 
953 953
 			} else {
954
-				$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
954
+				$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
955 955
 
956 956
 				/**
957 957
 				 * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 				 * @param array $entry Gravity Forms entry array
962 962
 				 * @param string $back_link URL to return to the original entry. @since 1.6
963 963
 				 */
964
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
964
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
965 965
 
966 966
 				echo GVCommon::generate_notice( $message );
967 967
 			}
@@ -985,21 +985,21 @@  discard block
 block discarded – undo
985 985
 		 */
986 986
 		do_action( 'gravityview/edit-entry/render/before', $this );
987 987
 
988
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
989
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
988
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
989
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
990 990
 		add_filter( 'gform_disable_view_counter', '__return_true' );
991 991
 
992 992
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
993 993
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
994 994
 
995 995
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
996
-		unset( $_GET['page'] );
996
+		unset( $_GET[ 'page' ] );
997 997
 
998 998
 		// TODO: Verify multiple-page forms
999 999
 
1000 1000
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1001 1001
 
1002
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1002
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1003 1003
 
1004 1004
 		ob_get_clean();
1005 1005
 
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 	 * @return string
1026 1026
 	 */
1027 1027
 	public function render_form_buttons() {
1028
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1028
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1045,10 +1045,10 @@  discard block
 block discarded – undo
1045 1045
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1046 1046
 
1047 1047
 		// In case we have validated the form, use it to inject the validation results into the form render
1048
-		if( isset( $this->form_after_validation ) ) {
1048
+		if ( isset( $this->form_after_validation ) ) {
1049 1049
 			$form = $this->form_after_validation;
1050 1050
 		} else {
1051
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1051
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1052 1052
 		}
1053 1053
 
1054 1054
 		$form = $this->filter_conditional_logic( $form );
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
 		$form = $this->prefill_conditional_logic( $form );
1057 1057
 
1058 1058
 		// for now we don't support Save and Continue feature.
1059
-		if( ! self::$supports_save_and_continue ) {
1060
-	        unset( $form['save'] );
1059
+		if ( ! self::$supports_save_and_continue ) {
1060
+	        unset( $form[ 'save' ] );
1061 1061
 		}
1062 1062
 
1063 1063
 		return $form;
@@ -1078,29 +1078,29 @@  discard block
 block discarded – undo
1078 1078
 	 */
1079 1079
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1080 1080
 
1081
-		if( GFCommon::is_post_field( $field ) ) {
1081
+		if ( GFCommon::is_post_field( $field ) ) {
1082 1082
 
1083 1083
 			$message = null;
1084 1084
 
1085 1085
 			// First, make sure they have the capability to edit the post.
1086
-			if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1086
+			if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1087 1087
 
1088 1088
 				/**
1089 1089
 				 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1090 1090
 				 * @param string $message The existing "You don't have permission..." text
1091 1091
 				 */
1092
-				$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1092
+				$message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1093 1093
 
1094
-			} elseif( null === get_post( $this->entry['post_id'] ) ) {
1094
+			} elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1095 1095
 				/**
1096 1096
 				 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1097 1097
 				 * @param string $message The existing "This field is not editable; the post no longer exists." text
1098 1098
 				 */
1099
-				$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1099
+				$message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1100 1100
 			}
1101 1101
 
1102
-			if( $message ) {
1103
-				$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1102
+			if ( $message ) {
1103
+				$field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1104 1104
 			}
1105 1105
 		}
1106 1106
 
@@ -1125,8 +1125,8 @@  discard block
 block discarded – undo
1125 1125
 
1126 1126
 		// If the form has been submitted, then we don't need to pre-fill the values,
1127 1127
 		// Except for fileupload type and when a field input is overridden- run always!!
1128
-		if(
1129
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1128
+		if (
1129
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1130 1130
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1131 1131
 			&& ! GFCommon::is_product_field( $field->type )
1132 1132
 			|| ! empty( $field_content )
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 	    $return = null;
1147 1147
 
1148 1148
 		/** @var GravityView_Field $gv_field */
1149
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1149
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1150 1150
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1151 1151
 		} else {
1152 1152
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 	    // If there was output, it's an error
1156 1156
 	    $warnings = ob_get_clean();
1157 1157
 
1158
-	    if( !empty( $warnings ) ) {
1158
+	    if ( ! empty( $warnings ) ) {
1159 1159
 		    gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) );
1160 1160
 	    }
1161 1161
 
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1181 1181
 
1182 1182
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1183
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1183
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1184 1184
 
1185 1185
 			$field_value = array();
1186 1186
 
@@ -1189,10 +1189,10 @@  discard block
 block discarded – undo
1189 1189
 
1190 1190
 			foreach ( (array)$field->inputs as $input ) {
1191 1191
 
1192
-				$input_id = strval( $input['id'] );
1192
+				$input_id = strval( $input[ 'id' ] );
1193 1193
 				
1194 1194
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1195
-				    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1195
+				    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1196 1196
 				    $allow_pre_populated = false;
1197 1197
 				}
1198 1198
 
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 
1201 1201
 			$pre_value = $field->get_value_submission( array(), false );
1202 1202
 
1203
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1203
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1204 1204
 
1205 1205
 		} else {
1206 1206
 
@@ -1211,13 +1211,13 @@  discard block
 block discarded – undo
1211 1211
 
1212 1212
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1213 1213
 			// or pre-populated value if not empty and set to override saved value
1214
-			$field_value = 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;
1214
+			$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;
1215 1215
 
1216 1216
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1217
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1217
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1218 1218
 				$categories = array();
1219 1219
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1220
-				    $categories[] = GFCommon::format_post_category( $cat_string, true );
1220
+				    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
1221 1221
 				}
1222 1222
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1223 1223
 			}
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 	     * @param GF_Field $field Gravity Forms field object
1246 1246
 	     * @param GravityView_Edit_Entry_Render $this Current object
1247 1247
 	     */
1248
-	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1248
+	    $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1249 1249
 
1250 1250
 		return $field_value;
1251 1251
 	}
@@ -1262,12 +1262,12 @@  discard block
 block discarded – undo
1262 1262
 	 */
1263 1263
 	public function gform_pre_validation( $form ) {
1264 1264
 
1265
-		if( ! $this->verify_nonce() ) {
1265
+		if ( ! $this->verify_nonce() ) {
1266 1266
 			return $form;
1267 1267
 		}
1268 1268
 
1269 1269
 		// Fix PHP warning regarding undefined index.
1270
-		foreach ( $form['fields'] as &$field) {
1270
+		foreach ( $form[ 'fields' ] as &$field ) {
1271 1271
 
1272 1272
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1273 1273
 			// expects certain field array items to be set.
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
 	            $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1276 1276
 			}
1277 1277
 
1278
-			switch( RGFormsModel::get_input_type( $field ) ) {
1278
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1279 1279
 
1280 1280
 				/**
1281 1281
 				 * this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend.
@@ -1289,26 +1289,26 @@  discard block
 block discarded – undo
1289 1289
 				    // Set the previous value
1290 1290
 				    $entry = $this->get_entry();
1291 1291
 
1292
-				    $input_name = 'input_'.$field->id;
1293
-				    $form_id = $form['id'];
1292
+				    $input_name = 'input_' . $field->id;
1293
+				    $form_id = $form[ 'id' ];
1294 1294
 
1295 1295
 				    $value = NULL;
1296 1296
 
1297 1297
 				    // Use the previous entry value as the default.
1298
-				    if( isset( $entry[ $field->id ] ) ) {
1298
+				    if ( isset( $entry[ $field->id ] ) ) {
1299 1299
 				        $value = $entry[ $field->id ];
1300 1300
 				    }
1301 1301
 
1302 1302
 				    // If this is a single upload file
1303
-				    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1304
-				        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1305
-				        $value = $file_path['url'];
1303
+				    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1304
+				        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1305
+				        $value = $file_path[ 'url' ];
1306 1306
 
1307 1307
 				    } else {
1308 1308
 
1309 1309
 				        // Fix PHP warning on line 1498 of form_display.php for post_image fields
1310 1310
 				        // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1311
-				        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1311
+				        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1312 1312
 
1313 1313
 				    }
1314 1314
 
@@ -1316,10 +1316,10 @@  discard block
 block discarded – undo
1316 1316
 
1317 1317
 				        // If there are fresh uploads, process and merge them.
1318 1318
 				        // Otherwise, use the passed values, which should be json-encoded array of URLs
1319
-				        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1319
+				        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1320 1320
 				            $value = empty( $value ) ? '[]' : $value;
1321 1321
 				            $value = stripslashes_deep( $value );
1322
-				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1322
+				            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1323 1323
 				        }
1324 1324
 
1325 1325
 				    } else {
@@ -1337,8 +1337,8 @@  discard block
 block discarded – undo
1337 1337
 
1338 1338
 				case 'number':
1339 1339
 				    // Fix "undefined index" issue at line 1286 in form_display.php
1340
-				    if( !isset( $_POST['input_'.$field->id ] ) ) {
1341
-				        $_POST['input_'.$field->id ] = NULL;
1340
+				    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1341
+				        $_POST[ 'input_' . $field->id ] = NULL;
1342 1342
 				    }
1343 1343
 				    break;
1344 1344
 			}
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 		 * You can enter whatever you want!
1376 1376
 		 * We try validating, and customize the results using `self::custom_validation()`
1377 1377
 		 */
1378
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1378
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1379 1379
 
1380 1380
 		// Needed by the validate funtion
1381 1381
 		$failed_validation_page = NULL;
@@ -1383,14 +1383,14 @@  discard block
 block discarded – undo
1383 1383
 
1384 1384
 		// Prevent entry limit from running when editing an entry, also
1385 1385
 		// prevent form scheduling from preventing editing
1386
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1386
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1387 1387
 
1388 1388
 		// Hide fields depending on Edit Entry settings
1389
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1389
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1390 1390
 
1391 1391
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1392 1392
 
1393
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1393
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1394 1394
 	}
1395 1395
 
1396 1396
 
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 
1414 1414
 		$gv_valid = true;
1415 1415
 
1416
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1416
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1417 1417
 
1418 1418
 			$value = RGFormsModel::get_field_value( $field );
1419 1419
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1426,35 +1426,35 @@  discard block
 block discarded – undo
1426 1426
 				case 'post_image':
1427 1427
 
1428 1428
 				    // in case nothing is uploaded but there are already files saved
1429
-				    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1429
+				    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1430 1430
 				        $field->failed_validation = false;
1431 1431
 				        unset( $field->validation_message );
1432 1432
 				    }
1433 1433
 
1434 1434
 				    // validate if multi file upload reached max number of files [maxFiles] => 2
1435
-				    if( rgobj( $field, 'maxFiles') && rgobj( $field, 'multipleFiles') ) {
1435
+				    if ( rgobj( $field, 'maxFiles' ) && rgobj( $field, 'multipleFiles' ) ) {
1436 1436
 
1437 1437
 				        $input_name = 'input_' . $field->id;
1438 1438
 				        //uploaded
1439
-				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1439
+				        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1440 1440
 
1441 1441
 				        //existent
1442 1442
 				        $entry = $this->get_entry();
1443 1443
 				        $value = NULL;
1444
-				        if( isset( $entry[ $field->id ] ) ) {
1444
+				        if ( isset( $entry[ $field->id ] ) ) {
1445 1445
 				            $value = json_decode( $entry[ $field->id ], true );
1446 1446
 				        }
1447 1447
 
1448 1448
 				        // count uploaded files and existent entry files
1449 1449
 				        $count_files = count( $file_names ) + count( $value );
1450 1450
 
1451
-				        if( $count_files > $field->maxFiles ) {
1451
+				        if ( $count_files > $field->maxFiles ) {
1452 1452
 				            $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1453 1453
 				            $field->failed_validation = 1;
1454 1454
 				            $gv_valid = false;
1455 1455
 
1456 1456
 				            // in case of error make sure the newest upload files are removed from the upload input
1457
-				            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1457
+				            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1458 1458
 				        }
1459 1459
 
1460 1460
 				    }
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 			}
1466 1466
 
1467 1467
 			// This field has failed validation.
1468
-			if( !empty( $field->failed_validation ) ) {
1468
+			if ( ! empty( $field->failed_validation ) ) {
1469 1469
 
1470 1470
 				gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) );
1471 1471
 
@@ -1483,19 +1483,19 @@  discard block
 block discarded – undo
1483 1483
 				}
1484 1484
 
1485 1485
 				// You can't continue inside a switch, so we do it after.
1486
-				if( empty( $field->failed_validation ) ) {
1486
+				if ( empty( $field->failed_validation ) ) {
1487 1487
 				    continue;
1488 1488
 				}
1489 1489
 
1490 1490
 				// checks if the No Duplicates option is not validating entry against itself, since
1491 1491
 				// we're editing a stored entry, it would also assume it's a duplicate.
1492
-				if( !empty( $field->noDuplicates ) ) {
1492
+				if ( ! empty( $field->noDuplicates ) ) {
1493 1493
 
1494 1494
 				    $entry = $this->get_entry();
1495 1495
 
1496 1496
 				    // If the value of the entry is the same as the stored value
1497 1497
 				    // Then we can assume it's not a duplicate, it's the same.
1498
-				    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1498
+				    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1499 1499
 				        //if value submitted was not changed, then don't validate
1500 1500
 				        $field->failed_validation = false;
1501 1501
 
@@ -1508,7 +1508,7 @@  discard block
 block discarded – undo
1508 1508
 				}
1509 1509
 
1510 1510
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1511
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1511
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1512 1512
 				    unset( $field->validation_message );
1513 1513
 	                $field->validation_message = false;
1514 1514
 				    continue;
@@ -1520,12 +1520,12 @@  discard block
 block discarded – undo
1520 1520
 
1521 1521
 		}
1522 1522
 
1523
-		$validation_results['is_valid'] = $gv_valid;
1523
+		$validation_results[ 'is_valid' ] = $gv_valid;
1524 1524
 
1525 1525
 		gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) );
1526 1526
 
1527 1527
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1528
-		$this->form_after_validation = $validation_results['form'];
1528
+		$this->form_after_validation = $validation_results[ 'form' ];
1529 1529
 
1530 1530
 		return $validation_results;
1531 1531
 	}
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
 	 */
1539 1539
 	public function get_entry() {
1540 1540
 
1541
-		if( empty( $this->entry ) ) {
1541
+		if ( empty( $this->entry ) ) {
1542 1542
 			// Get the database value of the entry that's being edited
1543 1543
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1544 1544
 		}
@@ -1570,10 +1570,10 @@  discard block
 block discarded – undo
1570 1570
 		}
1571 1571
 
1572 1572
 		// If edit tab not yet configured, show all fields
1573
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1573
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1574 1574
 
1575 1575
 		// Hide fields depending on admin settings
1576
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1576
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1577 1577
 
1578 1578
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1579 1579
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 	 */
1606 1606
 	private function filter_fields( $fields, $configured_fields ) {
1607 1607
 
1608
-		if( empty( $fields ) || !is_array( $fields ) ) {
1608
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1609 1609
 			return $fields;
1610 1610
 		}
1611 1611
 
@@ -1618,18 +1618,18 @@  discard block
 block discarded – undo
1618 1618
 
1619 1619
 			// Remove the fields that have calculation properties and keep them to be used later
1620 1620
 			// @since 1.16.2
1621
-			if( $field->has_calculation() ) {
1622
-				$this->fields_with_calculation[] = $field;
1621
+			if ( $field->has_calculation() ) {
1622
+				$this->fields_with_calculation[ ] = $field;
1623 1623
 				// don't remove the calculation fields on form render.
1624 1624
 			}
1625 1625
 
1626
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1626
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1627 1627
 				unset( $fields[ $key ] );
1628 1628
 			}
1629 1629
 		}
1630 1630
 
1631 1631
 		// The Edit tab has not been configured, so we return all fields by default.
1632
-		if( empty( $configured_fields ) ) {
1632
+		if ( empty( $configured_fields ) ) {
1633 1633
 			return $fields;
1634 1634
 		}
1635 1635
 
@@ -1638,8 +1638,8 @@  discard block
 block discarded – undo
1638 1638
 
1639 1639
 	        /** @var GF_Field $field */
1640 1640
 	        foreach ( $fields as $field ) {
1641
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1642
-				    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1641
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1642
+				    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1643 1643
 				    break;
1644 1644
 				}
1645 1645
 
@@ -1662,14 +1662,14 @@  discard block
 block discarded – undo
1662 1662
 
1663 1663
 		$return_field = $field;
1664 1664
 
1665
-		if( empty( $field_setting['show_label'] ) ) {
1665
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1666 1666
 			$return_field->label = '';
1667
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1668
-			$return_field->label = $field_setting['custom_label'];
1667
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1668
+			$return_field->label = $field_setting[ 'custom_label' ];
1669 1669
 		}
1670 1670
 
1671
-		if( !empty( $field_setting['custom_class'] ) ) {
1672
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1671
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1672
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1673 1673
 		}
1674 1674
 
1675 1675
 		/**
@@ -1707,16 +1707,16 @@  discard block
 block discarded – undo
1707 1707
 	     */
1708 1708
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1709 1709
 
1710
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1711
-			foreach( $fields as $k => $field ) {
1712
-				if( $field->adminOnly ) {
1710
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1711
+			foreach ( $fields as $k => $field ) {
1712
+				if ( $field->adminOnly ) {
1713 1713
 				    unset( $fields[ $k ] );
1714 1714
 				}
1715 1715
 			}
1716 1716
 			return $fields;
1717 1717
 		}
1718 1718
 
1719
-	    foreach( $fields as &$field ) {
1719
+	    foreach ( $fields as &$field ) {
1720 1720
 		    $field->adminOnly = false;
1721 1721
 		}
1722 1722
 
@@ -1740,22 +1740,22 @@  discard block
 block discarded – undo
1740 1740
 	 */
1741 1741
 	function prefill_conditional_logic( $form ) {
1742 1742
 
1743
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1743
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1744 1744
 			return $form;
1745 1745
 		}
1746 1746
 
1747 1747
 		// Have Conditional Logic pre-fill fields as if the data were default values
1748 1748
 		/** @var GF_Field $field */
1749
-		foreach ( $form['fields'] as &$field ) {
1749
+		foreach ( $form[ 'fields' ] as &$field ) {
1750 1750
 
1751
-			if( 'checkbox' === $field->type ) {
1751
+			if ( 'checkbox' === $field->type ) {
1752 1752
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1753
-				    $input_id = $input['id'];
1753
+				    $input_id = $input[ 'id' ];
1754 1754
 				    $choice = $field->choices[ $key ];
1755 1755
 				    $value = \GV\Utils::get( $this->entry, $input_id );
1756 1756
 				    $match = RGFormsModel::choice_value_match( $field, $choice, $value );
1757
-				    if( $match ) {
1758
-				        $field->choices[ $key ]['isSelected'] = true;
1757
+				    if ( $match ) {
1758
+				        $field->choices[ $key ][ 'isSelected' ] = true;
1759 1759
 				    }
1760 1760
 				}
1761 1761
 			} else {
@@ -1763,15 +1763,15 @@  discard block
 block discarded – undo
1763 1763
 				// We need to run through each field to set the default values
1764 1764
 				foreach ( $this->entry as $field_id => $field_value ) {
1765 1765
 
1766
-				    if( floatval( $field_id ) === floatval( $field->id ) ) {
1766
+				    if ( floatval( $field_id ) === floatval( $field->id ) ) {
1767 1767
 
1768
-				        if( 'list' === $field->type ) {
1768
+				        if ( 'list' === $field->type ) {
1769 1769
 				            $list_rows = maybe_unserialize( $field_value );
1770 1770
 
1771 1771
 				            $list_field_value = array();
1772
-				            foreach ( (array) $list_rows as $row ) {
1773
-				                foreach ( (array) $row as $column ) {
1774
-				                    $list_field_value[] = $column;
1772
+				            foreach ( (array)$list_rows as $row ) {
1773
+				                foreach ( (array)$row as $column ) {
1774
+				                    $list_field_value[ ] = $column;
1775 1775
 				                }
1776 1776
 				            }
1777 1777
 
@@ -1806,16 +1806,16 @@  discard block
 block discarded – undo
1806 1806
 		 */
1807 1807
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1808 1808
 
1809
-		if( $use_conditional_logic ) {
1809
+		if ( $use_conditional_logic ) {
1810 1810
 			return $form;
1811 1811
 		}
1812 1812
 
1813
-		foreach( $form['fields'] as &$field ) {
1813
+		foreach ( $form[ 'fields' ] as &$field ) {
1814 1814
 			/* @var GF_Field $field */
1815 1815
 			$field->conditionalLogic = null;
1816 1816
 		}
1817 1817
 
1818
-		unset( $form['button']['conditionalLogic'] );
1818
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1819 1819
 
1820 1820
 		return $form;
1821 1821
 
@@ -1832,7 +1832,7 @@  discard block
 block discarded – undo
1832 1832
 	 */
1833 1833
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1834 1834
 
1835
-		if( ! $this->is_edit_entry() ) {
1835
+		if ( ! $this->is_edit_entry() ) {
1836 1836
 			return $has_conditional_logic;
1837 1837
 		}
1838 1838
 
@@ -1864,44 +1864,44 @@  discard block
 block discarded – undo
1864 1864
 		 *  2. There are two entries embedded using oEmbed
1865 1865
 		 *  3. One of the entries has just been saved
1866 1866
 		 */
1867
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1867
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1868 1868
 
1869 1869
 			$error = true;
1870 1870
 
1871 1871
 		}
1872 1872
 
1873
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1873
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1874 1874
 
1875 1875
 			$error = true;
1876 1876
 
1877
-		} elseif( ! $this->verify_nonce() ) {
1877
+		} elseif ( ! $this->verify_nonce() ) {
1878 1878
 
1879 1879
 			/**
1880 1880
 			 * If the Entry is embedded, there may be two entries on the same page.
1881 1881
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1882 1882
 			 */
1883
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1883
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1884 1884
 				$error = true;
1885 1885
 			} else {
1886
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1886
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1887 1887
 			}
1888 1888
 
1889 1889
 		}
1890 1890
 
1891
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1892
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1891
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1892
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1893 1893
 		}
1894 1894
 
1895
-		if( $this->entry['status'] === 'trash' ) {
1896
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1895
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1896
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1897 1897
 		}
1898 1898
 
1899 1899
 		// No errors; everything's fine here!
1900
-		if( empty( $error ) ) {
1900
+		if ( empty( $error ) ) {
1901 1901
 			return true;
1902 1902
 		}
1903 1903
 
1904
-		if( $echo && $error !== true ) {
1904
+		if ( $echo && $error !== true ) {
1905 1905
 
1906 1906
 	        $error = esc_html( $error );
1907 1907
 
@@ -1909,10 +1909,10 @@  discard block
 block discarded – undo
1909 1909
 	         * @since 1.9
1910 1910
 	         */
1911 1911
 	        if ( ! empty( $this->entry ) ) {
1912
-		        $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;" ) );
1912
+		        $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;" ) );
1913 1913
 	        }
1914 1914
 
1915
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1915
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1916 1916
 		}
1917 1917
 
1918 1918
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1932,17 +1932,17 @@  discard block
 block discarded – undo
1932 1932
 
1933 1933
 		$error = NULL;
1934 1934
 
1935
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
1936
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
1935
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
1936
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
1937 1937
 		}
1938 1938
 
1939 1939
 		// No errors; everything's fine here!
1940
-		if( empty( $error ) ) {
1940
+		if ( empty( $error ) ) {
1941 1941
 			return true;
1942 1942
 		}
1943 1943
 
1944
-		if( $echo ) {
1945
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1944
+		if ( $echo ) {
1945
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1946 1946
 		}
1947 1947
 
1948 1948
 		gravityview()->log->error( '{error}', array( 'error' => $error ) );
@@ -1963,14 +1963,14 @@  discard block
 block discarded – undo
1963 1963
 	private function check_user_cap_edit_field( $field ) {
1964 1964
 
1965 1965
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
1966
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1966
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1967 1967
 			return true;
1968 1968
 		}
1969 1969
 
1970
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
1970
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
1971 1971
 
1972
-		if( $field_cap ) {
1973
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
1972
+		if ( $field_cap ) {
1973
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
1974 1974
 		}
1975 1975
 
1976 1976
 		return false;
@@ -1984,17 +1984,17 @@  discard block
 block discarded – undo
1984 1984
 	public function verify_nonce() {
1985 1985
 
1986 1986
 		// Verify form submitted for editing single
1987
-		if( $this->is_edit_entry_submission() ) {
1987
+		if ( $this->is_edit_entry_submission() ) {
1988 1988
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
1989 1989
 		}
1990 1990
 
1991 1991
 		// Verify
1992
-		else if( ! $this->is_edit_entry() ) {
1992
+		else if ( ! $this->is_edit_entry() ) {
1993 1993
 			$valid = false;
1994 1994
 		}
1995 1995
 
1996 1996
 		else {
1997
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
1997
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
1998 1998
 		}
1999 1999
 
2000 2000
 		/**
Please login to merge, or discard this patch.
future/includes/class-gv-field.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @return \GV\Field The field implementation from configuration (\GV\GF_Field, \GV\Internal_Field).
167 167
 	 */
168 168
 	public static function from_configuration( $configuration ) {
169
-		if ( empty( $configuration['id'] ) ) {
169
+		if ( empty( $configuration[ 'id' ] ) ) {
170 170
 			$field = new self();
171 171
 			gravityview()->log->error( 'Trying to get field from configuration without a field ID.', array( 'data' => $configuration ) );
172 172
 			$field->update_configuration( $configuration );
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 		} else {
180 180
 			$trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS );
181 181
 		}
182
-		$trace = $trace[1];
183
-		if ( $trace['function'] == 'from_configuration' && $trace['class'] == __CLASS__ ) {
182
+		$trace = $trace[ 1 ];
183
+		if ( $trace[ 'function' ] == 'from_configuration' && $trace[ 'class' ] == __CLASS__ ) {
184 184
 			$field = new self();
185 185
 			gravityview()->log->error( 'Infinite loop protection tripped. Returning default class here.' );
186 186
 			$field->update_configuration( $configuration );
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		}
189 189
 
190 190
 		/** Determine the field implementation to use, and try to use. */
191
-		$field_class = is_numeric( $configuration['id'] ) ? '\GV\GF_Field' : '\GV\Internal_Field';
191
+		$field_class = is_numeric( $configuration[ 'id' ] ) ? '\GV\GF_Field' : '\GV\Internal_Field';
192 192
 
193 193
 		/**
194 194
 		 * @filter `gravityview/field/class` Filter the field class about to be created from the configuration.
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	public function update_configuration( $configuration ) {
228 228
 		$configuration = wp_parse_args( $configuration, $this->as_configuration() );
229 229
 
230
-		if ( $this->ID != $configuration['id'] ) {
230
+		if ( $this->ID != $configuration[ 'id' ] ) {
231 231
 			/** Smelling trouble here... */
232 232
 			gravityview()->log->warning( 'ID is being changed for {field_class} instance, but implementation is not. Use ::from_configuration instead', array( 'field_class', __CLASS__ ) );
233 233
 		}
234 234
 
235
-		$this->ID = $configuration['id'];
236
-		$this->label = $configuration['label'];
237
-		$this->show_label = $configuration['show_label'] == '1';
238
-		$this->custom_label = $configuration['custom_label'];
239
-		$this->custom_class = $configuration['custom_class'];
240
-		$this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : '';
241
-		$this->search_filter = $configuration['search_filter'] == '1';
242
-		$this->show_as_link = $configuration['show_as_link'] == '1';
235
+		$this->ID = $configuration[ 'id' ];
236
+		$this->label = $configuration[ 'label' ];
237
+		$this->show_label = $configuration[ 'show_label' ] == '1';
238
+		$this->custom_label = $configuration[ 'custom_label' ];
239
+		$this->custom_class = $configuration[ 'custom_class' ];
240
+		$this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : '';
241
+		$this->search_filter = $configuration[ 'search_filter' ] == '1';
242
+		$this->show_as_link = $configuration[ 'show_as_link' ] == '1';
243 243
 
244 244
 		/** Shared among all field types (sort of). */
245 245
 		$shared_configuration_keys = array(
246 246
 			'id', 'label', 'show_label', 'custom_label', 'custom_class',
247
-			'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link',
247
+			'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link',
248 248
 		);
249 249
 
250 250
 		/** Everything else goes into the properties for now. @todo subclasses! */
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
 		/** A custom label is available. */
275 275
 		if ( ! empty( $this->custom_label ) ) {
276
-			return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null );
276
+			return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ?: null : null, $entry ? $entry->as_entry() : null );
277 277
 		}
278 278
 
279 279
 		return '';
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 * @return mixed|null The value for the given configuration key, null if doesn't exist.
351 351
 	 */
352 352
 	public function __get( $key ) {
353
-		switch( $key ):
353
+		switch ( $key ):
354 354
 			default:
355 355
 				if ( isset( $this->configuration[ $key ] ) ) {
356 356
 					return $this->configuration[ $key ];
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 * @return boolean Whether this $key is set or not.
367 367
 	 */
368 368
 	public function __isset( $key ) {
369
-		switch( $key ):
369
+		switch ( $key ):
370 370
 			default:
371 371
 				return isset( $this->configuration[ $key ] );
372 372
 		endswitch;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-list.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	public function remove_columns_from_searchable_fields( $fields ) {
61 61
 
62 62
 		foreach ( $fields as $key => $field ) {
63
-			if ( isset( $field['parent'] ) && $field['parent'] instanceof \GF_Field_List ) {
63
+			if ( isset( $field[ 'parent' ] ) && $field[ 'parent' ] instanceof \GF_Field_List ) {
64 64
 				unset( $fields[ $key ] );
65 65
 			}
66 66
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		// Add the list columns
87 87
 		foreach ( $list_fields as $list_field ) {
88 88
 
89
-			if( empty( $list_field->enableColumns ) ) {
89
+			if ( empty( $list_field->enableColumns ) ) {
90 90
 				continue;
91 91
 			}
92 92
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			}
108 108
 
109 109
 			// If there are columns, add them under the parent field
110
-			if( ! empty( $list_columns ) ) {
110
+			if ( ! empty( $list_columns ) ) {
111 111
 
112 112
 				$index = array_search( $list_field->id, array_keys( $fields ) ) + 1;
113 113
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 				 * Merge the $list_columns into the $fields array at $index
116 116
 				 * @see https://stackoverflow.com/a/1783125
117 117
 				 */
118
-				$fields = array_slice( $fields, 0, $index, true) + $list_columns + array_slice( $fields, $index, null, true);
118
+				$fields = array_slice( $fields, 0, $index, true ) + $list_columns + array_slice( $fields, $index, null, true );
119 119
 			}
120 120
 
121 121
 			unset( $list_columns, $index, $input_id );
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
 		$list_rows = maybe_unserialize( $field_value );
144 144
 
145
-		if( ! is_array( $list_rows ) ) {
145
+		if ( ! is_array( $list_rows ) ) {
146 146
 			gravityview()->log->error( '$field_value did not unserialize', array( 'data' => $field_value ) );
147 147
 			return null;
148 148
 		}
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
 		// Each list row
153 153
 		foreach ( $list_rows as $list_row ) {
154 154
 			$current_column = 0;
155
-			foreach ( (array) $list_row as $column_key => $column_value ) {
155
+			foreach ( (array)$list_row as $column_key => $column_value ) {
156 156
 
157 157
 				// If the label of the column matches $column_id, or the numeric key value matches, add the value
158
-				if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) {
159
-					$column_values[] = $column_value;
158
+				if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) {
159
+					$column_values[ ] = $column_value;
160 160
 				}
161 161
 				$current_column++;
162 162
 			}
163 163
 		}
164 164
 
165 165
 		// Return the array of values
166
-		if( 'raw' === $format ) {
166
+		if ( 'raw' === $format ) {
167 167
 			return $column_values;
168 168
 		}
169 169
 		// Return the Gravity Forms Field output
@@ -186,22 +186,22 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function _filter_field_label( $label, $field, $form, $entry ) {
188 188
 
189
-		$field_object = RGFormsModel::get_field( $form, $field['id'] );
189
+		$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
190 190
 
191 191
 		// Not a list field
192
-		if( ! $field_object || 'list' !== $field_object->type ) {
192
+		if ( ! $field_object || 'list' !== $field_object->type ) {
193 193
 			return $label;
194 194
 		}
195 195
 
196 196
 		// Custom label is defined, so use it
197
-		if( ! empty( $field['custom_label'] ) ) {
197
+		if ( ! empty( $field[ 'custom_label' ] ) ) {
198 198
 			return $label;
199 199
 		}
200 200
 
201
-		$column_id = gravityview_get_input_id_from_id( $field['id'] );
201
+		$column_id = gravityview_get_input_id_from_id( $field[ 'id' ] );
202 202
 
203 203
 		// Parent field, not column field
204
-		if( false === $column_id ) {
204
+		if ( false === $column_id ) {
205 205
 			return $label;
206 206
 		}
207 207
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) {
223 223
 
224 224
 		// Doesn't have columns enabled
225
-		if( ! isset( $field->choices ) || ! $field->enableColumns ) {
225
+		if ( ! isset( $field->choices ) || ! $field->enableColumns ) {
226 226
 			return $backup_label;
227 227
 		}
228 228
 
Please login to merge, or discard this patch.
future/includes/class-gv-settings-addon.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @return array
102 102
 	 */
103 103
 	public function modify_app_settings_menu_title( $setting_tabs ) {
104
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' );
104
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
105 105
 		return $setting_tabs;
106 106
 	}
107 107
 
@@ -304,15 +304,15 @@  discard block
 block discarded – undo
304 304
             </ul>
305 305
             <div class="gv-followup widefat">
306 306
                 <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p>
307
-                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea>
307
+                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea>
308 308
             </div>
309 309
             <div class="scale-description">
310 310
                 <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p>
311 311
                 <ul class="inline">
312 312
 					<?php
313 313
 					$i = 0;
314
-					while( $i < 11 ) {
315
-						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>';
314
+					while ( $i < 11 ) {
315
+						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>';
316 316
 						$i++;
317 317
 					}
318 318
 					?>
@@ -529,15 +529,15 @@  discard block
 block discarded – undo
529 529
 	 * @return string The HTML
530 530
 	 */
531 531
 	public function as_html( $field, $echo = true ) {
532
-		$field['type']  = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit';
532
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
533 533
 
534 534
 		$attributes    = $this->get_field_attributes( $field );
535 535
 		$default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) );
536
-		$value         = $this->get( $field['name'], $default_value );
536
+		$value         = $this->get( $field[ 'name' ], $default_value );
537 537
 
538 538
 
539
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton';
540
-		$name    = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name'];
539
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton';
540
+		$name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
541 541
 
542 542
 		if ( empty( $value ) ) {
543 543
 			$value = __( 'Update Settings', 'gravityview' );
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 		$attributes = $this->get_field_attributes( $field );
547 547
 
548 548
 		$html = '<input
549
-                    type="' . $field['type'] . '"
549
+                    type="' . $field[ 'type' ] . '"
550 550
                     name="' . esc_attr( $name ) . '"
551 551
                     value="' . $value . '" ' .
552 552
 		        implode( ' ', $attributes ) .
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 * @return bool
578 578
 	 */
579 579
 	public function is_save_postback() {
580
-		return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] );
580
+		return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] );
581 581
 	}
582 582
 
583 583
 	/**
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	 */
588 588
 	public function license_key_notice() {
589 589
 
590
-	    if( $this->is_save_postback() ) {
590
+	    if ( $this->is_save_postback() ) {
591 591
 		    $settings = $this->get_posted_settings();
592 592
 		    $license_key = \GV\Utils::get( $settings, 'license_key' );
593 593
 		    $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 		 * but didn't want to mess up the translation strings for the translators.
606 606
 		 */
607 607
 		$message = mb_substr( $message, 0, mb_strlen( $message ) - 1 );
608
-		$title = __ ( 'Inactive License', 'gravityview');
608
+		$title = __( 'Inactive License', 'gravityview' );
609 609
 		$status = '';
610 610
 		$update_below = false;
611 611
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 				$update_below = __( 'Activate your license key below.', 'gravityview' );
636 636
 				break;
637 637
 		}
638
-		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice';
638
+		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice';
639 639
 
640 640
 		// Show a different notice on settings page for inactive licenses (hide the buttons)
641 641
 		if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) {
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	public function scripts() {
678 678
 		$scripts = parent::scripts();
679 679
 
680
-		$scripts[] = array(
680
+		$scripts[ ] = array(
681 681
 			'handle'  => 'gform_tooltip_init',
682 682
 			'enqueue' => array(
683 683
                 array(
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 	public function styles() {
697 697
 		$styles = parent::styles();
698 698
 
699
-		$styles[] = array(
699
+		$styles[ ] = array(
700 700
 			'handle'  => 'gravityview_settings',
701 701
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
702 702
 			'version' => Plugin::$version,
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 		 * If multisite and not network admin, we don't want the settings to show.
728 728
 		 * @since 1.7.6
729 729
 		 */
730
-		$show_submenu = ( ! is_multisite() ) ||  is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
730
+		$show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
731 731
 
732 732
 		/**
733 733
 		 * Override whether to show the Settings menu on a per-blog basis.
@@ -775,26 +775,26 @@  discard block
 block discarded – undo
775 775
 				'label' => __( 'License Key', 'gravityview' ),
776 776
 				'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ),
777 777
 				'type' => 'edd_license',
778
-				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' )  && GRAVITYVIEW_LICENSE_KEY ),
778
+				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ),
779 779
 				'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
780
-				'default_value' => $default_settings['license_key'],
780
+				'default_value' => $default_settings[ 'license_key' ],
781 781
 				'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
782 782
 			),
783 783
 			array(
784 784
 				'name' => 'license_key_response',
785
-				'default_value' => $default_settings['license_key_response'],
785
+				'default_value' => $default_settings[ 'license_key_response' ],
786 786
 				'type' => 'hidden',
787 787
 			),
788 788
 			array(
789 789
 				'name' => 'license_key_status',
790
-				'default_value' => $default_settings['license_key_status'],
790
+				'default_value' => $default_settings[ 'license_key_status' ],
791 791
 				'type' => 'hidden',
792 792
 			),
793 793
 			array(
794 794
 				'name' => 'support-email',
795 795
 				'type' => 'text',
796 796
 				'validate' => 'email',
797
-				'default_value' => $default_settings['support-email'],
797
+				'default_value' => $default_settings[ 'support-email' ],
798 798
 				'label' => __( 'Support Email', 'gravityview' ),
799 799
 				'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
800 800
 				'class' => 'code regular-text',
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 				'name' => 'support_port',
807 807
 				'type' => 'radio',
808 808
 				'label' => __( 'Show Support Port?', 'gravityview' ),
809
-				'default_value' => $default_settings['support_port'],
809
+				'default_value' => $default_settings[ 'support_port' ],
810 810
 				'horizontal' => 1,
811 811
 				'choices' => array(
812 812
 					array(
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 				'name' => 'no-conflict-mode',
826 826
 				'type' => 'radio',
827 827
 				'label' => __( 'No-Conflict Mode', 'gravityview' ),
828
-				'default_value' => $default_settings['no-conflict-mode'],
828
+				'default_value' => $default_settings[ 'no-conflict-mode' ],
829 829
 				'horizontal' => 1,
830 830
 				'choices' => array(
831 831
 					array(
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 					'name' => 'rest_api',
848 848
 					'type' => 'radio',
849 849
 					'label' => __( 'REST API', 'gravityview' ),
850
-					'default_value' => $default_settings['rest_api'],
850
+					'default_value' => $default_settings[ 'rest_api' ],
851 851
 					'horizontal' => 1,
852 852
 					'choices' => array(
853 853
 						array(
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 				'name' => 'beta',
867 867
 				'type' => 'checkbox',
868 868
 				'label' => __( 'Become a Beta Tester', 'gravityview' ),
869
-				'default_value' => $default_settings['beta'],
869
+				'default_value' => $default_settings[ 'beta' ],
870 870
 				'horizontal' => 1,
871 871
 				'choices' => array(
872 872
 					array(
@@ -899,17 +899,17 @@  discard block
 block discarded – undo
899 899
 		 * @since 1.7.4
900 900
 		 */
901 901
 		foreach ( $fields as &$field ) {
902
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' );
903
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' );
904
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' );
905
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' );
902
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' );
903
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' );
904
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' );
905
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' );
906 906
 
907 907
 			if ( $disabled_attribute ) {
908
-				$field['disabled']  = $disabled_attribute;
908
+				$field[ 'disabled' ] = $disabled_attribute;
909 909
 			}
910 910
 
911
-			if ( empty( $field['disabled'] ) ) {
912
-				unset( $field['disabled'] );
911
+			if ( empty( $field[ 'disabled' ] ) ) {
912
+				unset( $field[ 'disabled' ] );
913 913
             }
914 914
 		}
915 915
 
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
         );
928 928
 
929 929
 		if ( $disabled_attribute ) {
930
-			$button['disabled'] = $disabled_attribute;
930
+			$button[ 'disabled' ] = $disabled_attribute;
931 931
 		}
932 932
 
933 933
         /**
@@ -946,20 +946,20 @@  discard block
 block discarded – undo
946 946
 		// If there are extensions, add a section for them
947 947
 		if ( ! empty( $extension_sections ) ) {
948 948
 
949
-			if( $disabled_attribute ) {
949
+			if ( $disabled_attribute ) {
950 950
 				foreach ( $extension_sections as &$section ) {
951
-					foreach ( $section['fields'] as &$field ) {
952
-						$field['disabled'] = $disabled_attribute;
951
+					foreach ( $section[ 'fields' ] as &$field ) {
952
+						$field[ 'disabled' ] = $disabled_attribute;
953 953
 					}
954 954
 				}
955 955
 			}
956 956
 
957
-            $k = count( $extension_sections ) - 1 ;
958
-            $extension_sections[ $k ]['fields'][] = $button;
957
+            $k = count( $extension_sections ) - 1;
958
+            $extension_sections[ $k ][ 'fields' ][ ] = $button;
959 959
 			$sections = array_merge( $sections, $extension_sections );
960 960
 		} else {
961 961
             // add the 'update settings' button to the general section
962
-            $sections[0]['fields'][] = $button;
962
+            $sections[ 0 ][ 'fields' ][ ] = $button;
963 963
         }
964 964
 
965 965
 		return $sections;
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	protected function settings_edd_license( $field, $echo = true ) {
1016 1016
 
1017 1017
 	    if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1018
-		    $field['input_type'] = 'password';
1018
+		    $field[ 'input_type' ] = 'password';
1019 1019
         }
1020 1020
 
1021 1021
 		$text = $this->settings_text( $field, false );
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
 	public function single_setting_row_html( $field ) {
1065 1065
 		?>
1066 1066
 
1067
-        <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>">
1067
+        <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>">
1068 1068
             <td colspan="2">
1069 1069
 				<?php $this->single_setting( $field ); ?>
1070 1070
             </td>
@@ -1082,10 +1082,10 @@  discard block
 block discarded – undo
1082 1082
 	 * @return string
1083 1083
 	 */
1084 1084
 	public function settings_save( $field, $echo = true ) {
1085
-		$field['type']  = 'submit';
1086
-		$field['name']  = 'gform-settings-save';
1087
-		$field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton';
1088
-		$field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1085
+		$field[ 'type' ]  = 'submit';
1086
+		$field[ 'name' ]  = 'gform-settings-save';
1087
+		$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton';
1088
+		$field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1089 1089
 
1090 1090
 		$output = $this->settings_submit( $field, false );
1091 1091
 
@@ -1116,8 +1116,8 @@  discard block
 block discarded – undo
1116 1116
      * @return void
1117 1117
 	 */
1118 1118
 	public function single_setting_row( $field ) {
1119
-		$field['gv_description'] = Utils::get( $field, 'description' );
1120
-		$field['description']    = Utils::get( $field, 'subtitle' );
1119
+		$field[ 'gv_description' ] = Utils::get( $field, 'description' );
1120
+		$field[ 'description' ]    = Utils::get( $field, 'subtitle' );
1121 1121
 		parent::single_setting_row( $field );
1122 1122
 	}
1123 1123
 
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 	public function single_setting_label( $field ) {
1130 1130
 		parent::single_setting_label( $field );
1131 1131
 		if ( $description = Utils::get( $field, 'gv_description' ) ) {
1132
-			echo '<span class="description">'. $description .'</span>';
1132
+			echo '<span class="description">' . $description . '</span>';
1133 1133
 		}
1134 1134
 	}
1135 1135
 
@@ -1166,9 +1166,9 @@  discard block
 block discarded – undo
1166 1166
 		// If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response),
1167 1167
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
1168 1168
 		if ( $local_key !== $response_key ) {
1169
-			unset( $posted_settings['license_key_response'] );
1170
-			unset( $posted_settings['license_key_status'] );
1171
-			\GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1169
+			unset( $posted_settings[ 'license_key_response' ] );
1170
+			unset( $posted_settings[ 'license_key_status' ] );
1171
+			\GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1172 1172
 		}
1173 1173
 		return $posted_settings;
1174 1174
 	}
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				'type' => 'radio',
65 65
 				'full_width' => true,
66 66
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
67
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
67
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
68 68
 				'value' => 'any',
69 69
 				'class' => 'hide-if-js',
70 70
 				'options' => array(
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
88 88
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
89
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
89
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
90 90
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
91 91
 
92 92
 			// ajax - get the searchable fields
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
225 225
 		$script_source = empty( $script_min ) ? '/source' : '';
226 226
 
227
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
227
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
228 228
 
229 229
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
230 230
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
247 247
 	 */
248 248
 	public function register_no_conflict( $allowed ) {
249
-		$allowed[] = 'gravityview_searchwidget_admin';
249
+		$allowed[ ] = 'gravityview_searchwidget_admin';
250 250
 		return $allowed;
251 251
 	}
252 252
 
@@ -259,24 +259,24 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	public static function get_searchable_fields() {
261 261
 
262
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
262
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
263 263
 			exit( '0' );
264 264
 		}
265 265
 
266 266
 		$form = '';
267 267
 
268 268
 		// Fetch the form for the current View
269
-		if ( ! empty( $_POST['view_id'] ) ) {
269
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
270 270
 
271
-			$form = gravityview_get_form_id( $_POST['view_id'] );
271
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
272 272
 
273
-		} elseif ( ! empty( $_POST['formid'] ) ) {
273
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
274 274
 
275
-			$form = (int) $_POST['formid'];
275
+			$form = (int)$_POST[ 'formid' ];
276 276
 
277
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
277
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
278 278
 
279
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
279
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
280 280
 
281 281
 		}
282 282
 
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 			),
326 326
 		);
327 327
 
328
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
329
-			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] );
328
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
329
+			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] );
330 330
 		}
331 331
 
332 332
 		// Get fields with sub-inputs and no parent
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 
349 349
 			foreach ( $fields as $id => $field ) {
350 350
 
351
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
351
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
352 352
 					continue;
353 353
 				}
354 354
 
355
-				$types = self::get_search_input_types( $id, $field['type'] );
355
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
356 356
 
357
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
357
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
358 358
 			}
359 359
 		}
360 360
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
378 378
 
379 379
 		// @todo - This needs to be improved - many fields have . including products and addresses
380
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
380
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
381 381
 			$input_type = 'boolean'; // on/off checkbox
382 382
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
383 383
 			$input_type = 'multi'; //multiselect
@@ -421,19 +421,19 @@  discard block
 block discarded – undo
421 421
 			$post_id = 0;
422 422
 
423 423
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
424
-			if ( ! empty( $widget_args['post_id'] ) ) {
425
-				$post_id = absint( $widget_args['post_id'] );
424
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
425
+				$post_id = absint( $widget_args[ 'post_id' ] );
426 426
 			}
427 427
 			// We're in the WordPress Widget context, and the base View ID should be used
428
-			else if ( ! empty( $widget_args['view_id'] ) ) {
429
-				$post_id = absint( $widget_args['view_id'] );
428
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
429
+				$post_id = absint( $widget_args[ 'view_id' ] );
430 430
 			}
431 431
 
432 432
 			$args = gravityview_get_permalink_query_args( $post_id );
433 433
 
434 434
 			// Add hidden fields to the search form
435 435
 			foreach ( $args as $key => $value ) {
436
-				$search_fields[] = array(
436
+				$search_fields[ ] = array(
437 437
 					'name'  => $key,
438 438
 					'input' => 'hidden',
439 439
 					'value' => $value,
@@ -470,22 +470,22 @@  discard block
 block discarded – undo
470 470
 		/**
471 471
 		 * Include the sidebar Widgets.
472 472
 		 */
473
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
473
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
474 474
 
475 475
 		foreach ( $widgets as $widget ) {
476
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
477
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
476
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
477
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
478 478
 					foreach ( $_fields as $field ) {
479
-						$searchable_fields [] = $field['field'];
479
+						$searchable_fields [ ] = $field[ 'field' ];
480 480
 					}
481 481
 				}
482 482
 			}
483 483
 		}
484 484
 
485 485
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
486
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
486
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
487 487
 				foreach ( $_fields as $field ) {
488
-					$searchable_fields [] = $field['field'];
488
+					$searchable_fields [ ] = $field[ 'field' ];
489 489
 				}
490 490
 			}
491 491
 		}
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 */
503 503
 	public function filter_entries( $search_criteria, $form_id = null, $args = array() ) {
504 504
 
505
-		if( 'post' === $this->search_method ) {
505
+		if ( 'post' === $this->search_method ) {
506 506
 			$get = $_POST;
507 507
 		} else {
508 508
 			$get = $_GET;
@@ -521,14 +521,14 @@  discard block
 block discarded – undo
521 521
 		$get = gv_map_deep( $get, 'rawurldecode' );
522 522
 
523 523
 		// Make sure array key is set up
524
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
524
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
525 525
 
526 526
 		$searchable_fields = $this->get_view_searchable_fields( $view );
527 527
 
528 528
 		// add free search
529
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
529
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
530 530
 
531
-			$search_all_value = trim( $get['gv_search'] );
531
+			$search_all_value = trim( $get[ 'gv_search' ] );
532 532
 
533 533
 			/**
534 534
 			 * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase?
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 			}
554 554
 
555 555
 			foreach ( $words as $word ) {
556
-				$search_criteria['field_filters'][] = array(
556
+				$search_criteria[ 'field_filters' ][ ] = array(
557 557
 					'key' => null, // The field ID to search
558 558
 					'value' => $word, // The value to search
559 559
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -563,19 +563,19 @@  discard block
 block discarded – undo
563 563
 
564 564
 		// start date & end date
565 565
 		if ( in_array( 'entry_date', $searchable_fields ) ) {
566
-			$curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : '';
567
-			$curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : '';
566
+			$curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '';
567
+			$curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : '';
568 568
 
569 569
 			if ( $view ) {
570 570
 				/**
571 571
 				 * Override start and end dates if View is limited to some already.
572 572
 				 */
573
-				if ( $start_date =$view->settings->get( 'start_date' ) ) {
573
+				if ( $start_date = $view->settings->get( 'start_date' ) ) {
574 574
 					if ( $start_timestamp = strtotime( $curr_start ) ) {
575 575
 						$curr_start = $start_timestamp < strtotime( $start_date ) ? $start_date : $curr_start;
576 576
 					}
577 577
 				}
578
-				if ( $end_date =$view->settings->get( 'end_date' ) ) {
578
+				if ( $end_date = $view->settings->get( 'end_date' ) ) {
579 579
 					if ( $end_timestamp = strtotime( $curr_end ) ) {
580 580
 						$curr_end = $end_timestamp > strtotime( $end_date ) ? $end_date : $curr_end;
581 581
 					}
@@ -596,22 +596,22 @@  discard block
 block discarded – undo
596 596
 			 */
597 597
 			if ( ! empty( $curr_start ) ) {
598 598
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
599
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
599
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
600 600
 			}
601 601
 
602 602
 			if ( ! empty( $curr_end ) ) {
603 603
 				// Fast-forward 24 hour on the end time
604 604
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
605
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
606
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
607
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
605
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
606
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
607
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
608 608
 				}
609 609
 			}
610 610
 		}
611 611
 
612 612
 		// search for a specific entry ID
613 613
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
614
-			$search_criteria['field_filters'][] = array(
614
+			$search_criteria[ 'field_filters' ][ ] = array(
615 615
 				'key' => 'id',
616 616
 				'value' => absint( $get[ 'gv_id' ] ),
617 617
 				'operator' => '=',
@@ -620,42 +620,42 @@  discard block
 block discarded – undo
620 620
 
621 621
 		// search for a specific Created_by ID
622 622
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'entry_creator', $searchable_fields ) ) {
623
-			$search_criteria['field_filters'][] = array(
623
+			$search_criteria[ 'field_filters' ][ ] = array(
624 624
 				'key' => 'created_by',
625
-				'value' => absint( $get['gv_by'] ),
625
+				'value' => absint( $get[ 'gv_by' ] ),
626 626
 				'operator' => '=',
627 627
 			);
628 628
 		}
629 629
 
630 630
 
631 631
 		// Get search mode passed in URL
632
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
632
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
633 633
 
634 634
 		// get the other search filters
635 635
 		foreach ( $get as $key => $value ) {
636 636
 
637
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
637
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
638 638
 				continue;
639 639
 			}
640 640
 
641 641
 			$filter_key = $this->convert_request_key_to_filter_key( $key );
642 642
 
643 643
 			// could return simple filter or multiple filters
644
-			if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key , $searchable_fields ) ) {
644
+			if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key, $searchable_fields ) ) {
645 645
 				continue;
646 646
 			}
647 647
 
648 648
 			$filter = $this->prepare_field_filter( $filter_key, $value, $view );
649 649
 
650
-			if ( isset( $filter[0]['value'] ) ) {
651
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
650
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
651
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
652 652
 
653 653
 				// if date range type, set search mode to ALL
654
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
654
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
655 655
 					$mode = 'all';
656 656
 				}
657
-			} elseif( !empty( $filter ) ) {
658
-				$search_criteria['field_filters'][] = $filter;
657
+			} elseif ( ! empty( $filter ) ) {
658
+				$search_criteria[ 'field_filters' ][ ] = $filter;
659 659
 			}
660 660
 		}
661 661
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 		 * @since 1.5.1
665 665
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
666 666
 		 */
667
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
667
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
668 668
 
669 669
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
670 670
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 		$field_id = str_replace( 'filter_', '', $key );
693 693
 
694 694
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
695
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
695
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
696 696
 			$field_id = str_replace( '_', '.', $field_id );
697 697
 		}
698 698
 
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 
728 728
 			case 'select':
729 729
 			case 'radio':
730
-				$filter['operator'] = 'is';
730
+				$filter[ 'operator' ] = 'is';
731 731
 				break;
732 732
 
733 733
 			case 'post_category':
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 
742 742
 				foreach ( $value as $val ) {
743 743
 					$cat = get_term( $val, 'category' );
744
-					$filter[] = array(
744
+					$filter[ ] = array(
745 745
 						'key'      => $filter_key,
746 746
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
747 747
 						'operator' => 'is',
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 				$filter = array();
761 761
 
762 762
 				foreach ( $value as $val ) {
763
-					$filter[] = array( 'key' => $filter_key, 'value' => $val );
763
+					$filter[ ] = array( 'key' => $filter_key, 'value' => $val );
764 764
 				}
765 765
 
766 766
 				break;
@@ -769,9 +769,9 @@  discard block
 block discarded – undo
769 769
 				// convert checkbox on/off into the correct search filter
770 770
 				if ( false !== strpos( $filter_key, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
771 771
 					foreach ( $form_field->inputs as $k => $input ) {
772
-						if ( $input['id'] == $filter_key ) {
773
-							$filter['value'] = $form_field->choices[ $k ]['value'];
774
-							$filter['operator'] = 'is';
772
+						if ( $input[ 'id' ] == $filter_key ) {
773
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
774
+							$filter[ 'operator' ] = 'is';
775 775
 							break;
776 776
 						}
777 777
 					}
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 					$filter = array();
782 782
 
783 783
 					foreach ( $value as $val ) {
784
-						$filter[] = array(
784
+						$filter[ ] = array(
785 785
 							'key'      => $filter_key,
786 786
 							'value'    => $val,
787 787
 							'operator' => 'is',
@@ -802,9 +802,9 @@  discard block
 block discarded – undo
802 802
 					foreach ( $words as $word ) {
803 803
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
804 804
 							// Keep the same key for each filter
805
-							$filter['value'] = $word;
805
+							$filter[ 'value' ] = $word;
806 806
 							// Add a search for the value
807
-							$filters[] = $filter;
807
+							$filters[ ] = $filter;
808 808
 						}
809 809
 					}
810 810
 
@@ -831,19 +831,19 @@  discard block
 block discarded – undo
831 831
 						 * @since 1.16.3
832 832
 						 * Safeguard until GF implements '<=' operator
833 833
 						 */
834
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
834
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
835 835
 							$operator = '<';
836 836
 							$date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) );
837 837
 						}
838 838
 
839
-						$filter[] = array(
839
+						$filter[ ] = array(
840 840
 							'key'      => $filter_key,
841 841
 							'value'    => self::get_formatted_date( $date, 'Y-m-d' ),
842 842
 							'operator' => $operator,
843 843
 						);
844 844
 					}
845 845
 				} else {
846
-					$filter['value'] = self::get_formatted_date( $value, 'Y-m-d' );
846
+					$filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' );
847 847
 				}
848 848
 
849 849
 				break;
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 			'ymd_dot' => 'Y.m.d',
875 875
 		);
876 876
 
877
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
877
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
878 878
 			$format = $datepicker[ $field->dateFormat ];
879 879
 		}
880 880
 
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
 	public function add_template_path( $file_paths ) {
906 906
 
907 907
 		// Index 100 is the default GravityView template path.
908
-		$file_paths[102] = self::$file . 'templates/';
908
+		$file_paths[ 102 ] = self::$file . 'templates/';
909 909
 
910 910
 		return $file_paths;
911 911
 	}
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 		$has_date = false;
925 925
 
926 926
 		foreach ( $search_fields as $k => $field ) {
927
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
927
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
928 928
 				$has_date = true;
929 929
 				break;
930 930
 			}
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 		}
952 952
 
953 953
 		// get configured search fields
954
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
954
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
955 955
 
956 956
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
957 957
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -966,34 +966,34 @@  discard block
 block discarded – undo
966 966
 
967 967
 			$updated_field = $this->get_search_filter_details( $updated_field );
968 968
 
969
-			switch ( $field['field'] ) {
969
+			switch ( $field[ 'field' ] ) {
970 970
 
971 971
 				case 'search_all':
972
-					$updated_field['key'] = 'search_all';
973
-					$updated_field['input'] = 'search_all';
974
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
972
+					$updated_field[ 'key' ] = 'search_all';
973
+					$updated_field[ 'input' ] = 'search_all';
974
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
975 975
 					break;
976 976
 
977 977
 				case 'entry_date':
978
-					$updated_field['key'] = 'entry_date';
979
-					$updated_field['input'] = 'entry_date';
980
-					$updated_field['value'] = array(
978
+					$updated_field[ 'key' ] = 'entry_date';
979
+					$updated_field[ 'input' ] = 'entry_date';
980
+					$updated_field[ 'value' ] = array(
981 981
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
982 982
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
983 983
 					);
984 984
 					break;
985 985
 
986 986
 				case 'entry_id':
987
-					$updated_field['key'] = 'entry_id';
988
-					$updated_field['input'] = 'entry_id';
989
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
987
+					$updated_field[ 'key' ] = 'entry_id';
988
+					$updated_field[ 'input' ] = 'entry_id';
989
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
990 990
 					break;
991 991
 
992 992
 				case 'created_by':
993
-					$updated_field['key'] = 'created_by';
994
-					$updated_field['name'] = 'gv_by';
995
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
996
-					$updated_field['choices'] = self::get_created_by_choices();
993
+					$updated_field[ 'key' ] = 'created_by';
994
+					$updated_field[ 'name' ] = 'gv_by';
995
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
996
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
997 997
 					break;
998 998
 			}
999 999
 
@@ -1012,16 +1012,16 @@  discard block
 block discarded – undo
1012 1012
 		 */
1013 1013
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context );
1014 1014
 
1015
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1015
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1016 1016
 
1017 1017
 		/** @since 1.14 */
1018
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1018
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1019 1019
 
1020
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1020
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1021 1021
 
1022 1022
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1023 1023
 
1024
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1024
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1025 1025
 
1026 1026
 		if ( $this->has_date_field( $search_fields ) ) {
1027 1027
 			// enqueue datepicker stuff only if needed!
@@ -1043,10 +1043,10 @@  discard block
 block discarded – undo
1043 1043
 	public static function get_search_class( $custom_class = '' ) {
1044 1044
 		$gravityview_view = GravityView_View::getInstance();
1045 1045
 
1046
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1046
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1047 1047
 
1048
-		if ( ! empty( $custom_class )  ) {
1049
-			$search_class .= ' '.$custom_class;
1048
+		if ( ! empty( $custom_class ) ) {
1049
+			$search_class .= ' ' . $custom_class;
1050 1050
 		}
1051 1051
 
1052 1052
 		/**
@@ -1090,9 +1090,9 @@  discard block
 block discarded – undo
1090 1090
 
1091 1091
 		if ( ! $label ) {
1092 1092
 
1093
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1093
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1094 1094
 
1095
-			switch( $field['field'] ) {
1095
+			switch ( $field[ 'field' ] ) {
1096 1096
 				case 'search_all':
1097 1097
 					$label = __( 'Search Entries:', 'gravityview' );
1098 1098
 					break;
@@ -1104,10 +1104,10 @@  discard block
 block discarded – undo
1104 1104
 					break;
1105 1105
 				default:
1106 1106
 					// If this is a field input, not a field
1107
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1107
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1108 1108
 
1109 1109
 						// Get the label for the field in question, which returns an array
1110
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1110
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1111 1111
 
1112 1112
 						// Get the item with the `label` key
1113 1113
 						$values = wp_list_pluck( $items, 'label' );
@@ -1146,32 +1146,32 @@  discard block
 block discarded – undo
1146 1146
 		$form = $gravityview_view->getForm();
1147 1147
 
1148 1148
 		// for advanced field ids (eg, first name / last name )
1149
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1149
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1150 1150
 
1151 1151
 		// get searched value from $_GET/$_POST (string or array)
1152 1152
 		$value = $this->rgget_or_rgpost( $name );
1153 1153
 
1154 1154
 		// get form field details
1155
-		$form_field = gravityview_get_field( $form, $field['field'] );
1155
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1156 1156
 
1157 1157
 		$filter = array(
1158
-			'key' => $field['field'],
1158
+			'key' => $field[ 'field' ],
1159 1159
 			'name' => $name,
1160 1160
 			'label' => self::get_field_label( $field, $form_field ),
1161
-			'input' => $field['input'],
1161
+			'input' => $field[ 'input' ],
1162 1162
 			'value' => $value,
1163
-			'type' => $form_field['type'],
1163
+			'type' => $form_field[ 'type' ],
1164 1164
 		);
1165 1165
 
1166 1166
 		// collect choices
1167
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1168
-			$filter['choices'] = gravityview_get_terms_choices();
1169
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1170
-			$filter['choices'] = $form_field['choices'];
1167
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1168
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1169
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1170
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1171 1171
 		}
1172 1172
 
1173
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1174
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1173
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1174
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1175 1175
 		}
1176 1176
 
1177 1177
 		return $filter;
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 
1196 1196
 		$choices = array();
1197 1197
 		foreach ( $users as $user ) {
1198
-			$choices[] = array(
1198
+			$choices[ ] = array(
1199 1199
 				'value' => $user->ID,
1200 1200
 				'text' => $user->display_name,
1201 1201
 			);
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
 	 */
1251 1251
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1252 1252
 
1253
-		$js_dependencies[] = 'jquery-ui-datepicker';
1253
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1254 1254
 
1255 1255
 		return $js_dependencies;
1256 1256
 	}
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
 			'isRTL'             => is_rtl(),
1295 1295
 		), $view_data );
1296 1296
 
1297
-		$localizations['datepicker'] = $datepicker_settings;
1297
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1298 1298
 
1299 1299
 		return $localizations;
1300 1300
 
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 	 * @return void
1322 1322
 	 */
1323 1323
 	private function maybe_enqueue_flexibility() {
1324
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1324
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1325 1325
 			wp_enqueue_script( 'gv-flexibility' );
1326 1326
 		}
1327 1327
 	}
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1344 1344
 
1345 1345
 		$scheme = is_ssl() ? 'https://' : 'http://';
1346
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1346
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1347 1347
 
1348 1348
 		/**
1349 1349
 		 * @filter `gravityview_search_datepicker_class`
Please login to merge, or discard this patch.
future/includes/class-gv-request.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public static function is_add_oembed_preview() {
47 47
 		/** The preview request is a parse-embed AJAX call without a type set. */
48
-		return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) );
48
+		return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
49 49
 	}
50 50
 
51 51
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return boolean
64 64
 	 */
65 65
 	public static function is_rest() {
66
-		return ! empty( $GLOBALS['wp']->query_vars['rest_route'] );
66
+		return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] );
67 67
 	}
68 68
 
69 69
 	/**
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 			$get = $_GET;
142 142
 		}
143 143
 
144
-		unset( $get['mode'] );
144
+		unset( $get[ 'mode' ] );
145 145
 
146 146
 		$get = array_filter( $get, 'gravityview_is_not_empty_string' );
147 147
 
148
-		if( $has_field_key = $this->_has_field_key( $get ) ) {
148
+		if ( $has_field_key = $this->_has_field_key( $get ) ) {
149 149
 			return true;
150 150
 		}
151 151
 
152
-		return isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] );
152
+		return isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] );
153 153
 	}
154 154
 
155 155
 	/**
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
 
173 173
 		$meta = array();
174 174
 		foreach ( $fields as $field ) {
175
-			if( empty( $field->_gf_field_class_name ) ) {
176
-				$meta[] = preg_quote( $field->name );
175
+			if ( empty( $field->_gf_field_class_name ) ) {
176
+				$meta[ ] = preg_quote( $field->name );
177 177
 			}
178 178
 		}
179 179
 
180 180
 		foreach ( $get as $key => $value ) {
181
-			if ( preg_match('/^filter_(([0-9_]+)|'. implode( '|', $meta ) .')$/sm', $key ) ) {
181
+			if ( preg_match( '/^filter_(([0-9_]+)|' . implode( '|', $meta ) . ')$/sm', $key ) ) {
182 182
 				$has_field_key = true;
183 183
 				break;
184 184
 			}
Please login to merge, or discard this patch.
future/includes/class-gv-shortcode-gravityview.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 			'detail' => null,
38 38
 		) );
39 39
 		
40
-		if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) {
41
-			if ( $atts['detail'] && $view = $request->is_view() ) {
40
+		if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) {
41
+			if ( $atts[ 'detail' ] && $view = $request->is_view() ) {
42 42
 				$view_id = $view->ID;
43 43
 			}
44 44
 		}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 			return get_the_password_form( $view->ID );
81 81
 		}
82 82
 
83
-		if ( ! $view->form  ) {
83
+		if ( ! $view->form ) {
84 84
 			gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) );
85 85
 
86 86
 			/**
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 			return __( 'You are not allowed to view this content.', 'gravityview' );
102 102
 		}
103 103
 
104
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
104
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
105 105
 
106 106
 		/**
107 107
 		 * View details.
108 108
 		 */
109
-		if ( $atts['detail'] ) {
109
+		if ( $atts[ 'detail' ] ) {
110 110
 			return $this->detail( $view, $entries, $atts );
111 111
 
112 112
 		/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 				return '';
121 121
 			}
122 122
 
123
-			if ( $entry['status'] != 'active' ) {
123
+			if ( $entry[ 'status' ] != 'active' ) {
124 124
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
125 125
 				return __( 'You are not allowed to view this content.', 'gravityview' );
126 126
 			}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 			}
132 132
 
133 133
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
134
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
134
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
135 135
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
136 136
 					return __( 'You are not allowed to view this content.', 'gravityview' );
137 137
 				}
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 				return '';
152 152
 			}
153 153
 
154
-			if ( $entry['status'] != 'active' ) {
154
+			if ( $entry[ 'status' ] != 'active' ) {
155 155
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
156 156
 				return __( 'You are not allowed to view this content.', 'gravityview' );
157 157
 			}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 			}
163 163
 
164 164
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
165
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
165
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
166 166
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
167 167
 					return __( 'You are not allowed to view this content.', 'gravityview' );
168 168
 				}
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 				
180 180
 				// Mock the request with the actual View, not the global one
181 181
 				$mock_request = new \GV\Mock_Request();
182
-				$mock_request->returns['is_view'] = $view;
183
-				$mock_request->returns['is_entry'] = $request->is_entry();
184
-				$mock_request->returns['is_edit_entry'] = $request->is_edit_entry();
185
-				$mock_request->returns['is_search'] = $request->is_search();
182
+				$mock_request->returns[ 'is_view' ] = $view;
183
+				$mock_request->returns[ 'is_entry' ] = $request->is_entry();
184
+				$mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry();
185
+				$mock_request->returns[ 'is_search' ] = $request->is_search();
186 186
 
187 187
 				$request = $mock_request;
188 188
 			}
@@ -218,16 +218,16 @@  discard block
 block discarded – undo
218 218
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
219 219
 
220 220
 		// Only keep the passed attributes after making sure that they're valid pairs
221
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
221
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
222 222
 
223 223
 		$atts = array();
224 224
 
225
-		foreach( $filtered_atts as $key => $passed_value ) {
225
+		foreach ( $filtered_atts as $key => $passed_value ) {
226 226
 
227 227
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
228 228
 			$passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value );
229 229
 
230
-			switch( $defaults[ $key ]['type'] ) {
230
+			switch ( $defaults[ $key ][ 'type' ] ) {
231 231
 
232 232
 				/**
233 233
 				 * Make sure number fields are numeric.
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
236 236
 				 */
237 237
 				case 'number':
238
-					if( is_numeric( $passed_value ) ) {
238
+					if ( is_numeric( $passed_value ) ) {
239 239
 						$atts[ $key ] = ( $passed_value + 0 );
240 240
 					}
241 241
 					break;
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 				 */
251 251
 				case 'select':
252 252
 				case 'radio':
253
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
254
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
253
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
254
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
255 255
 						$atts[ $key ] = $passed_value;
256 256
 					}
257 257
 					break;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 			}
264 264
 		}
265 265
 
266
-		$atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null );
266
+		$atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null );
267 267
 
268 268
 		return $atts;
269 269
 	}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	private function detail( $view, $entries, $atts ) {
281 281
 		$output = '';
282 282
 
283
-		switch ( $key = $atts['detail'] ):
283
+		switch ( $key = $atts[ 'detail' ] ):
284 284
 			case 'total_entries':
285 285
 				$output = number_format_i18n( $entries->total() );
286 286
 				break;
Please login to merge, or discard this patch.