Completed
Pull Request — master (#1338)
by Zack
33:09 queued 19:53
created
includes/class-admin-views.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -27,32 +27,32 @@  discard block
 block discarded – undo
27 27
 		add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 );
28 28
 
29 29
 		// Tooltips
30
-		add_filter( 'gform_tooltips', array( $this, 'tooltips') );
30
+		add_filter( 'gform_tooltips', array( $this, 'tooltips' ) );
31 31
 
32 32
 		// adding styles and scripts
33
-		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 );
34
-		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') );
35
-		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') );
36
-		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') );
37
-		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') );
38
-
39
-		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 );
40
-		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 );
41
-		add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers') );
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 );
33
+		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 );
34
+		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) );
35
+		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) );
36
+		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) );
37
+		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
38
+
39
+		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 );
40
+		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 );
41
+		add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ) );
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
 		add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );
54 54
 
55
-		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 );
55
+		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 );
56 56
 
57 57
 		add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) );
58 58
 
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	function suggest_support_articles( $localization_data = array() ) {
73 73
 
74
-	    if( ! gravityview()->request->is_view() ) {
74
+	    if ( ! gravityview()->request->is_view() ) {
75 75
 	        return $localization_data;
76 76
         }
77 77
 
78
-		$localization_data['suggest'] = array(
78
+		$localization_data[ 'suggest' ] = array(
79 79
             '57ef23539033602e61d4a560',
80 80
             '54c67bb9e4b0512429885513',
81 81
             '54c67bb9e4b0512429885512',
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
 	public function filter_pre_get_posts_by_gravityview_form_id( &$query ) {
97 97
 		global $pagenow;
98 98
 
99
-		if ( !is_admin() ) {
99
+		if ( ! is_admin() ) {
100 100
 			return;
101 101
 		}
102 102
 
103
-		$form_id = isset( $_GET['gravityview_form_id'] ) ? (int) $_GET['gravityview_form_id'] : false;
103
+		$form_id = isset( $_GET[ 'gravityview_form_id' ] ) ? (int)$_GET[ 'gravityview_form_id' ] : false;
104 104
 
105
-		if( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) {
105
+		if ( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) {
106 106
 			return;
107 107
 		}
108 108
 
@@ -119,18 +119,18 @@  discard block
 block discarded – undo
119 119
 	function add_view_dropdown() {
120 120
 		$current_screen = get_current_screen();
121 121
 
122
-		if( 'gravityview' !== $current_screen->post_type ) {
122
+		if ( 'gravityview' !== $current_screen->post_type ) {
123 123
 			return;
124 124
 		}
125 125
 
126 126
 		$forms = gravityview_get_forms();
127 127
 		$current_form = \GV\Utils::_GET( 'gravityview_form_id' );
128 128
 		// If there are no forms to select, show no forms.
129
-		if( !empty( $forms ) ) { ?>
129
+		if ( ! empty( $forms ) ) { ?>
130 130
 			<select name="gravityview_form_id" id="gravityview_form_id">
131 131
 				<option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option>
132
-				<?php foreach( $forms as $form ) { ?>
133
-					<option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
132
+				<?php foreach ( $forms as $form ) { ?>
133
+					<option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
134 134
 				<?php } ?>
135 135
 			</select>
136 136
 		<?php }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) {
145 145
 		_deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' );
146
-		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id );
146
+		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id );
147 147
 	}
148 148
 
149 149
 	/**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	public static function gform_toolbar_menu( $menu_items = array(), $id = NULL ) {
166 166
 
167 167
 		// Don't show on Trashed forms
168
-		if( 'trash' === rgget( 'filter') ) {
168
+		if ( 'trash' === rgget( 'filter' ) ) {
169 169
 			return $menu_items;
170 170
 		}
171 171
 
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
 
174 174
 		$priority = 0;
175 175
 
176
-		if( 'form_list' === GFForms::get_page() ) {
176
+		if ( 'form_list' === GFForms::get_page() ) {
177 177
 			$priority = 790;
178 178
         }
179 179
 
180
-		if( empty( $connected_views ) ) {
180
+		if ( empty( $connected_views ) ) {
181 181
 
182
-		    $menu_items['gravityview'] = array(
182
+		    $menu_items[ 'gravityview' ] = array(
183 183
 				'label'          => esc_attr__( 'Create a View', 'gravityview' ),
184 184
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
185 185
 				'title'          => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -195,22 +195,22 @@  discard block
 block discarded – undo
195 195
 		$sub_menu_items = array();
196 196
 		foreach ( (array)$connected_views as $view ) {
197 197
 
198
-			if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
198
+			if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
199 199
 				continue;
200 200
 			}
201 201
 
202
-			$label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
202
+			$label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
203 203
 
204
-			$sub_menu_items[] = array(
204
+			$sub_menu_items[ ] = array(
205 205
 				'label' => esc_attr( $label ),
206
-				'url' => admin_url( 'post.php?action=edit&post='.$view->ID ),
206
+				'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ),
207 207
 			);
208 208
 		}
209 209
 
210 210
 		// If there were no items added, then let's create the parent menu
211
-		if( $sub_menu_items ) {
211
+		if ( $sub_menu_items ) {
212 212
 
213
-		    $sub_menu_items[] = array(
213
+		    $sub_menu_items[ ] = array(
214 214
 			    'label' => esc_attr__( 'Create a View', 'gravityview' ),
215 215
                 'link_class' => 'gv-create-view',
216 216
 			    'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -219,14 +219,14 @@  discard block
 block discarded – undo
219 219
             );
220 220
 
221 221
 			// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
222
-			$sub_menu_items[] = array(
222
+			$sub_menu_items[ ] = array(
223 223
 				'url' => '#',
224 224
 				'label' => '',
225 225
 				'menu_class' => 'hidden',
226 226
 				'capabilities' => '',
227 227
 			);
228 228
 
229
-			$menu_items['gravityview'] = array(
229
+			$menu_items[ 'gravityview' ] = array(
230 230
 				'label'          => __( 'Connected Views', 'gravityview' ),
231 231
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
232 232
 				'title'          => __( 'GravityView Views using this form as a data source', 'gravityview' ),
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
 		$add = array( 'captcha', 'page' );
256 256
 
257 257
 		// Don't allowing editing the following values:
258
-		if( $context === 'edit' ) {
259
-			$add[] = 'post_id';
258
+		if ( $context === 'edit' ) {
259
+			$add[ ] = 'post_id';
260 260
 		}
261 261
 
262 262
 		$return = array_merge( $array, $add );
@@ -279,32 +279,32 @@  discard block
 block discarded – undo
279 279
 		foreach ( $default_args as $key => $arg ) {
280 280
 
281 281
 			// If an arg has `tooltip` defined, but it's false, don't display a tooltip
282
-			if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; }
282
+			if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; }
283 283
 
284 284
 			// By default, use `tooltip` if defined.
285
-			$tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip'];
285
+			$tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ];
286 286
 
287 287
 			// Otherwise, use the description as a tooltip.
288
-			if( empty( $tooltip ) && !empty( $arg['desc'] ) ) {
289
-				$tooltip = $arg['desc'];
288
+			if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) {
289
+				$tooltip = $arg[ 'desc' ];
290 290
 			}
291 291
 
292 292
 			// If there's no tooltip set, continue
293
-			if( empty( $tooltip ) ) {
293
+			if ( empty( $tooltip ) ) {
294 294
 				continue;
295 295
 			}
296 296
 
297 297
 			// Add the tooltip
298
-			$gv_tooltips[ 'gv_'.$key ] = array(
299
-				'title'	=> $arg['label'],
298
+			$gv_tooltips[ 'gv_' . $key ] = array(
299
+				'title'	=> $arg[ 'label' ],
300 300
 				'value'	=> $tooltip,
301 301
 			);
302 302
 
303 303
 		}
304 304
 
305
-		$gv_tooltips['gv_css_merge_tags'] = array(
306
-			'title' => __('CSS Merge Tags', 'gravityview'),
307
-			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' )
305
+		$gv_tooltips[ 'gv_css_merge_tags' ] = array(
306
+			'title' => __( 'CSS Merge Tags', 'gravityview' ),
307
+			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' )
308 308
 		);
309 309
 
310 310
 		/**
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 
323 323
 		foreach ( $gv_tooltips as $key => $tooltip ) {
324 324
 
325
-			$title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>';
325
+			$title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>';
326 326
 
327
-			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) );
327
+			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) );
328 328
 		}
329 329
 
330 330
 		return $tooltips;
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	 *
339 339
 	 * @return void
340 340
 	 */
341
-	public function add_custom_column_content( $column_name = NULL, $post_id )	{
341
+	public function add_custom_column_content( $column_name = NULL, $post_id ) {
342 342
 
343 343
 		$output = '';
344 344
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 				// Generate backup if label doesn't exist: `example_name` => `Example Name`
361 361
 				$template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) );
362 362
 
363
-				$output = $template ? $template['label'] : $template_id_pretty;
363
+				$output = $template ? $template[ 'label' ] : $template_id_pretty;
364 364
 
365 365
 				break;
366 366
 
@@ -401,44 +401,44 @@  discard block
 block discarded – undo
401 401
 	static public function get_connected_form_links( $form, $include_form_link = true ) {
402 402
 
403 403
 		// Either the form is empty or the form ID is 0, not yet set.
404
-		if( empty( $form ) ) {
404
+		if ( empty( $form ) ) {
405 405
 			return '';
406 406
 		}
407 407
 
408 408
 		// The $form is passed as the form ID
409
-		if( !is_array( $form ) ) {
409
+		if ( ! is_array( $form ) ) {
410 410
 			$form = gravityview_get_form( $form );
411 411
 		}
412 412
 
413
-		$form_id = $form['id'];
413
+		$form_id = $form[ 'id' ];
414 414
 		$links = array();
415 415
 
416
-		if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
416
+		if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
417 417
 			$form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;id=%d', $form_id ) );
418
-			$form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>';
419
-			$links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>';
418
+			$form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>';
419
+			$links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>';
420 420
 		} else {
421
-			$form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>';
421
+			$form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>';
422 422
 		}
423 423
 
424
-		if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
424
+		if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
425 425
 			$entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&amp;id=%d', $form_id ) );
426
-			$links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>';
426
+			$links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>';
427 427
 		}
428 428
 
429
-		if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
429
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
430 430
 			$settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=%d', $form_id ) );
431
-			$links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>';
431
+			$links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>';
432 432
 		}
433 433
 
434
-		if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) {
434
+		if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) {
435 435
 			$preview_url = site_url( sprintf( '?gf_page=preview&amp;id=%d', $form_id ) );
436
-			$links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>';
436
+			$links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>';
437 437
 		}
438 438
 
439 439
 		$output = '';
440 440
 
441
-		if( !empty( $include_form_link ) ) {
441
+		if ( ! empty( $include_form_link ) ) {
442 442
 			$output .= $form_link;
443 443
 		}
444 444
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 		 */
451 451
 		$links = apply_filters( 'gravityview_connected_form_links', $links, $form );
452 452
 
453
-		$output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>';
453
+		$output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>';
454 454
 
455 455
 		return $output;
456 456
 	}
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
 		// Get the date column and save it for later to add back in.
465 465
 		// This adds it after the Data Source column.
466 466
 		// This way, we don't need to do array_slice, array_merge, etc.
467
-		$date = $columns['date'];
468
-		unset( $columns['date'] );
467
+		$date = $columns[ 'date' ];
468
+		unset( $columns[ 'date' ] );
469 469
 
470 470
 		$data_source_required_caps = array(
471 471
 			'gravityforms_edit_forms',
@@ -476,14 +476,14 @@  discard block
 block discarded – undo
476 476
 			'gravityforms_preview_forms',
477 477
 		);
478 478
 
479
-		if( GVCommon::has_cap( $data_source_required_caps ) ) {
480
-			$columns['gv_connected_form'] = __( 'Data Source', 'gravityview' );
479
+		if ( GVCommon::has_cap( $data_source_required_caps ) ) {
480
+			$columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' );
481 481
 		}
482 482
 
483
-		$columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
483
+		$columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
484 484
 
485 485
 		// Add the date back in.
486
-		$columns['date'] = $date;
486
+		$columns[ 'date' ] = $date;
487 487
 
488 488
 		return $columns;
489 489
 	}
@@ -497,12 +497,12 @@  discard block
 block discarded – undo
497 497
 	 */
498 498
 	function save_postdata( $post_id ) {
499 499
 
500
-		if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
500
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
501 501
 			return;
502 502
 		}
503 503
 
504 504
 		// validate post_type
505
-		if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) {
505
+		if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) {
506 506
 			return;
507 507
 		}
508 508
 
@@ -517,65 +517,65 @@  discard block
 block discarded – undo
517 517
 		$statii = array();
518 518
 
519 519
 		// check if this is a start fresh View
520
-		if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) {
520
+		if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) {
521 521
 
522
-			$form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : '';
522
+			$form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : '';
523 523
 			// save form id
524
-			$statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
524
+			$statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
525 525
 
526 526
 		}
527 527
 
528
-		if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) {
528
+		if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) {
529 529
 			gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) );
530 530
 			return;
531 531
 		}
532 532
 
533 533
 		// Was this a start fresh?
534
-		if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) {
535
-			$statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
534
+		if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) {
535
+			$statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
536 536
 		} else {
537
-			$statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
537
+			$statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
538 538
 		}
539 539
 
540 540
 		// Check if we have a template id
541
-		if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) {
541
+		if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) {
542 542
 
543
-			$template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : '';
543
+			$template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : '';
544 544
 
545 545
 			// now save template id
546
-			$statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
546
+			$statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
547 547
 		}
548 548
 
549 549
 
550 550
 		// save View Configuration metabox
551
-		if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) {
551
+		if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) {
552 552
 
553 553
 			// template settings
554
-			if( empty( $_POST['template_settings'] ) ) {
555
-				$_POST['template_settings'] = array();
554
+			if ( empty( $_POST[ 'template_settings' ] ) ) {
555
+				$_POST[ 'template_settings' ] = array();
556 556
 			}
557
-			$statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] );
557
+			$statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] );
558 558
 
559 559
 			$fields = array();
560 560
 
561 561
 			// Directory&single Visible Fields
562
-			if( !empty( $preset_fields ) ) {
562
+			if ( ! empty( $preset_fields ) ) {
563 563
 
564 564
 				$fields = $preset_fields;
565 565
 
566
-			} elseif( !empty( $_POST['gv_fields'] ) ) {
566
+			} elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) {
567 567
 				$fields = _gravityview_process_posted_fields();
568 568
 			}
569 569
 
570 570
 			$fields = wp_slash( $fields );
571 571
 
572
-			$statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
572
+			$statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
573 573
 
574 574
 			// Directory Visible Widgets
575
-			if( empty( $_POST['widgets'] ) ) {
576
-				$_POST['widgets'] = array();
575
+			if ( empty( $_POST[ 'widgets' ] ) ) {
576
+				$_POST[ 'widgets' ] = array();
577 577
 			}
578
-			$statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] );
578
+			$statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] );
579 579
 
580 580
 		} // end save view configuration
581 581
 
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 		 * @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.
586 586
 		 * @since 1.17.2
587 587
 		 */
588
-		do_action('gravityview_view_saved', $post_id, $statii );
588
+		do_action( 'gravityview_view_saved', $post_id, $statii );
589 589
 
590 590
 		gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) );
591 591
 	}
@@ -629,20 +629,20 @@  discard block
 block discarded – undo
629 629
 
630 630
 		$output = '';
631 631
 
632
-		if( !empty( $fields ) ) {
632
+		if ( ! empty( $fields ) ) {
633 633
 
634
-			foreach( $fields as $id => $details ) {
634
+			foreach ( $fields as $id => $details ) {
635 635
 
636
-				if( in_array( $details['type'], (array) $blacklist_field_types ) ) {
636
+				if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) {
637 637
 					continue;
638 638
 				}
639 639
 
640 640
 				// Edit mode only allows editing the parent fields, not single inputs.
641
-				if( $context === 'edit' && !empty( $details['parent'] ) ) {
641
+				if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) {
642 642
 					continue;
643 643
 				}
644 644
 
645
-				$output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, $settings = array(), $form );
645
+				$output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, $settings = array(), $form );
646 646
 
647 647
 			} // End foreach
648 648
 		}
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 		echo $output;
651 651
 
652 652
 		// For the EDIT view we only want to allow the form fields.
653
-		if( $context === 'edit' ) {
653
+		if ( $context === 'edit' ) {
654 654
 			return;
655 655
 		}
656 656
 
@@ -674,16 +674,16 @@  discard block
 block discarded – undo
674 674
 		$additional_fields = apply_filters( 'gravityview_additional_fields', array(
675 675
 			array(
676 676
 				'label_text' => __( '+ Add All Fields', 'gravityview' ),
677
-				'desc' => __('Add all the available fields at once.', 'gravityview'),
677
+				'desc' => __( 'Add all the available fields at once.', 'gravityview' ),
678 678
 				'field_id' => 'all-fields',
679 679
 				'label_type' => 'field',
680 680
 				'input_type' => NULL,
681 681
 				'field_options' => NULL,
682 682
 				'settings_html'	=> NULL,
683 683
 			)
684
-		));
684
+		) );
685 685
 
686
-		if( !empty( $additional_fields )) {
686
+		if ( ! empty( $additional_fields ) ) {
687 687
 			foreach ( (array)$additional_fields as $item ) {
688 688
 
689 689
 				// Prevent items from not having index set
@@ -694,16 +694,16 @@  discard block
 block discarded – undo
694 694
 					'input_type' => NULL,
695 695
 					'field_options' => NULL,
696 696
 					'settings_html'	=> NULL,
697
-				));
697
+				) );
698 698
 
699 699
 				// Backward compat.
700
-				if( !empty( $item['field_options'] ) ) {
700
+				if ( ! empty( $item[ 'field_options' ] ) ) {
701 701
 					// Use settings_html from now on.
702
-					$item['settings_html'] = $item['field_options'];
702
+					$item[ 'settings_html' ] = $item[ 'field_options' ];
703 703
 				}
704 704
 
705 705
 				// Render a label for each of them
706
-				echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form );
706
+				echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form );
707 707
 
708 708
 			}
709 709
 		}
@@ -716,54 +716,54 @@  discard block
 block discarded – undo
716 716
 	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
717 717
 	 * @return array
718 718
 	 */
719
-	function get_entry_default_fields($form, $zone) {
719
+	function get_entry_default_fields( $form, $zone ) {
720 720
 
721 721
 		$entry_default_fields = array();
722 722
 
723
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
723
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
724 724
 
725 725
 			$entry_default_fields = array(
726 726
 				'id' => array(
727
-					'label' => __('Entry ID', 'gravityview'),
727
+					'label' => __( 'Entry ID', 'gravityview' ),
728 728
 					'type' => 'id',
729
-					'desc'	=> __('The unique ID of the entry.', 'gravityview'),
729
+					'desc'	=> __( 'The unique ID of the entry.', 'gravityview' ),
730 730
 				),
731 731
 				'date_created' => array(
732
-					'label' => __('Entry Date', 'gravityview'),
733
-					'desc'	=> __('The date the entry was created.', 'gravityview'),
732
+					'label' => __( 'Entry Date', 'gravityview' ),
733
+					'desc'	=> __( 'The date the entry was created.', 'gravityview' ),
734 734
 					'type' => 'date_created',
735 735
 				),
736 736
 				'source_url' => array(
737
-					'label' => __('Source URL', 'gravityview'),
737
+					'label' => __( 'Source URL', 'gravityview' ),
738 738
 					'type' => 'source_url',
739
-					'desc'	=> __('The URL of the page where the form was submitted.', 'gravityview'),
739
+					'desc'	=> __( 'The URL of the page where the form was submitted.', 'gravityview' ),
740 740
 				),
741 741
 				'ip' => array(
742
-					'label' => __('User IP', 'gravityview'),
742
+					'label' => __( 'User IP', 'gravityview' ),
743 743
 					'type' => 'ip',
744
-					'desc'	=> __('The IP Address of the user who created the entry.', 'gravityview'),
744
+					'desc'	=> __( 'The IP Address of the user who created the entry.', 'gravityview' ),
745 745
 				),
746 746
 				'created_by' => array(
747
-					'label' => __('User', 'gravityview'),
747
+					'label' => __( 'User', 'gravityview' ),
748 748
 					'type' => 'created_by',
749
-					'desc'	=> __('Details of the logged-in user who created the entry (if any).', 'gravityview'),
749
+					'desc'	=> __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ),
750 750
 				),
751 751
 
752 752
 				/**
753 753
 				 * @since 1.7.2
754 754
 				 */
755 755
 			    'other_entries' => array(
756
-				    'label'	=> __('Other Entries', 'gravityview'),
756
+				    'label'	=> __( 'Other Entries', 'gravityview' ),
757 757
 				    'type'	=> 'other_entries',
758
-				    'desc'	=> __('Display other entries created by the entry creator.', 'gravityview'),
758
+				    'desc'	=> __( 'Display other entries created by the entry creator.', 'gravityview' ),
759 759
 			    ),
760 760
 	        );
761 761
 
762
-			if( 'single' !== $zone) {
762
+			if ( 'single' !== $zone ) {
763 763
 
764
-				$entry_default_fields['entry_link'] = array(
765
-					'label' => __('Link to Entry', 'gravityview'),
766
-					'desc'	=> __('A dedicated link to the single entry with customizable text.', 'gravityview'),
764
+				$entry_default_fields[ 'entry_link' ] = array(
765
+					'label' => __( 'Link to Entry', 'gravityview' ),
766
+					'desc'	=> __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ),
767 767
 					'type' => 'entry_link',
768 768
 				);
769 769
 			}
@@ -773,19 +773,19 @@  discard block
 block discarded – undo
773 773
 		/**
774 774
 		 * @since  1.2
775 775
 		 */
776
-		$entry_default_fields['custom']	= array(
777
-			'label'	=> __('Custom Content', 'gravityview'),
776
+		$entry_default_fields[ 'custom' ] = array(
777
+			'label'	=> __( 'Custom Content', 'gravityview' ),
778 778
 			'type'	=> 'custom',
779
-			'desc'	=> __('Insert custom text or HTML.', 'gravityview'),
779
+			'desc'	=> __( 'Insert custom text or HTML.', 'gravityview' ),
780 780
 		);
781 781
 
782 782
 		/**
783 783
 		 * @since develop
784 784
 		 */
785
-		$entry_default_fields['sequence'] = array(
786
-			'label'	=> __('Result Number', 'gravityview'),
785
+		$entry_default_fields[ 'sequence' ] = array(
786
+			'label'	=> __( 'Result Number', 'gravityview' ),
787 787
 			'type'	=> 'sequence',
788
-			'desc'	=> __('Display a sequential result number for each entry.', 'gravityview'),
788
+			'desc'	=> __( 'Display a sequential result number for each entry.', 'gravityview' ),
789 789
 		);
790 790
 
791 791
 		/**
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 		 * @param  string|array $form form_ID or form object
795 795
 		 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
796 796
 		 */
797
-		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone);
797
+		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone );
798 798
 	}
799 799
 
800 800
 	/**
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 	 */
806 806
 	function get_available_fields( $form = '', $zone = NULL ) {
807 807
 
808
-		if( empty( $form ) ) {
808
+		if ( empty( $form ) ) {
809 809
 			gravityview()->log->error( '$form is empty' );
810 810
 			return array();
811 811
 		}
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 		$fields = gravityview_get_form_fields( $form, true );
815 815
 
816 816
 		// get meta fields ( only if form was already created )
817
-		if( !is_array( $form ) ) {
817
+		if ( ! is_array( $form ) ) {
818 818
 			$meta_fields = gravityview_get_entry_meta( $form );
819 819
 		} else {
820 820
 			$meta_fields = array();
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 		$fields = $fields + $meta_fields + $default_fields;
828 828
 
829 829
 		// Move Custom Content to top
830
-		$fields = array( 'custom' => $fields['custom'] ) + $fields;
830
+		$fields = array( 'custom' => $fields[ 'custom' ] ) + $fields;
831 831
 
832 832
 		return $fields;
833 833
 	}
@@ -841,11 +841,11 @@  discard block
 block discarded – undo
841 841
 
842 842
 		$widgets = $this->get_registered_widgets();
843 843
 
844
-		if( !empty( $widgets ) ) {
844
+		if ( ! empty( $widgets ) ) {
845 845
 
846
-			foreach( $widgets as $id => $details ) {
846
+			foreach ( $widgets as $id => $details ) {
847 847
 
848
-				echo new GravityView_Admin_View_Widget( $details['label'], $id, $details );
848
+				echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details );
849 849
 
850 850
 			}
851 851
 		}
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 	function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
875 875
 		global $post;
876 876
 
877
-		if( $type === 'widget' ) {
877
+		if ( $type === 'widget' ) {
878 878
 			$button_label = __( 'Add Widget', 'gravityview' );
879 879
 		} else {
880 880
 			$button_label = __( 'Add Field', 'gravityview' );
@@ -886,10 +886,10 @@  discard block
 block discarded – undo
886 886
 		$form_id = null;
887 887
 
888 888
 		// if saved values, get available fields to label everyone
889
-		if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) {
889
+		if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) {
890 890
 
891
-			if( !empty( $_POST['template_id'] ) ) {
892
-				$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
891
+			if ( ! empty( $_POST[ 'template_id' ] ) ) {
892
+				$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
893 893
 			} else {
894 894
 				$form_id = $form = gravityview_get_form_id( $post->ID );
895 895
 			}
@@ -907,44 +907,44 @@  discard block
 block discarded – undo
907 907
 			}
908 908
 		}
909 909
 
910
-		foreach( $rows as $row ) :
911
-			foreach( $row as $col => $areas ) :
912
-				$column = ($col == '2-2') ? '1-2' : $col; ?>
910
+		foreach ( $rows as $row ) :
911
+			foreach ( $row as $col => $areas ) :
912
+				$column = ( $col == '2-2' ) ? '1-2' : $col; ?>
913 913
 
914 914
 				<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
915 915
 
916
-					<?php foreach( $areas as $area ) : 	?>
916
+					<?php foreach ( $areas as $area ) : 	?>
917 917
 
918
-						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
919
-							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>">
918
+						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
919
+							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>">
920 920
 
921 921
 								<?php // render saved fields
922 922
 
923
-								if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) {
923
+								if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) {
924 924
 
925
-									foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) {
925
+									foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) {
926 926
 
927 927
 										// Maybe has a form ID
928
-										$form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id'];
928
+										$form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ];
929 929
 
930 930
 										$input_type = NULL;
931 931
 
932 932
 										if ( $form_id ) {
933
-											$original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ;
933
+											$original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false;
934 934
                                         } else {
935
-											$original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ;
935
+											$original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false;
936 936
                                         }
937 937
 
938
-										if ( !$original_item ) {
939
-											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 ) ) );
938
+										if ( ! $original_item ) {
939
+											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 ) ) );
940 940
 
941 941
 											$original_item = $field;
942 942
 										} else {
943
-											$input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL;
943
+											$input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL;
944 944
 										}
945 945
 
946 946
 										// Field options dialog box
947
-										$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 );
947
+										$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 );
948 948
 
949 949
 										$item = array(
950 950
 											'input_type' => $input_type,
@@ -957,23 +957,23 @@  discard block
 block discarded – undo
957 957
 											$item = wp_parse_args( $item, $original_item );
958 958
 										}
959 959
 
960
-										switch( $type ) {
960
+										switch ( $type ) {
961 961
 											case 'widget':
962
-												echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field );
962
+												echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field );
963 963
 												break;
964 964
 											default:
965
-												echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id );
965
+												echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id );
966 966
 										}
967 967
 									}
968 968
 
969 969
 								} // End if zone is not empty ?>
970 970
 
971
-								<span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span>
971
+								<span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span>
972 972
 							</div>
973 973
 							<div class="gv-droppable-area-action">
974
-								<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>
974
+								<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>
975 975
 
976
-								<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>
976
+								<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>
977 977
 							</div>
978 978
 						</div>
979 979
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 		$default_widget_areas = \GV\Widget::get_default_widget_areas();
997 997
 
998 998
 		$widgets = array();
999
-		if( !empty( $post_id ) ) {
999
+		if ( ! empty( $post_id ) ) {
1000 1000
 			$widgets = gravityview_get_directory_widgets( $post_id );
1001 1001
 		}
1002 1002
 
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 		// list of available fields to be shown in the popup
1030 1030
 		$forms = gravityview_get_forms( 'any' );
1031 1031
 
1032
-		$form_ids = array_map( function ($form) { return $form['id']; }, $forms);
1032
+		$form_ids = array_map( function( $form ) { return $form[ 'id' ]; }, $forms );
1033 1033
 
1034 1034
 		foreach ( $form_ids as $form_id ) {
1035 1035
 			$filter_field_id = sprintf( 'gv-field-filter-%s-%d', $context, $form_id );
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
                 </div>
1043 1043
 
1044 1044
                 <div id="available-fields-<?php echo $filter_field_id; ?>" aria-live="polite" role="listbox">
1045
-                <?php do_action('gravityview_render_available_fields', $form_id, $context ); ?>
1045
+                <?php do_action( 'gravityview_render_available_fields', $form_id, $context ); ?>
1046 1046
                 </div>
1047 1047
 
1048 1048
                 <div class="gv-no-results hidden description"><?php esc_html_e( 'No fields were found matching the search.', 'gravityview' ); ?></div>
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 	 * @return string HTML of the active areas
1062 1062
 	 */
1063 1063
 	function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) {
1064
-		if( empty( $template_id ) ) {
1064
+		if ( empty( $template_id ) ) {
1065 1065
 			gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) );
1066 1066
 			return '';
1067 1067
 		}
@@ -1075,12 +1075,12 @@  discard block
 block discarded – undo
1075 1075
 		 */
1076 1076
 		$template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context );
1077 1077
 
1078
-		if( empty( $template_areas ) ) {
1078
+		if ( empty( $template_areas ) ) {
1079 1079
 
1080 1080
 			gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) );
1081 1081
 			$output = '<div>';
1082
-			$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>';
1083
-			$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>';
1082
+			$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>';
1083
+			$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>';
1084 1084
 			$output .= '</div>';
1085 1085
 		} else {
1086 1086
 
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 
1096 1096
 		}
1097 1097
 
1098
-		if( $echo ) {
1098
+		if ( $echo ) {
1099 1099
 			echo $output;
1100 1100
 		}
1101 1101
 
@@ -1115,32 +1115,32 @@  discard block
 block discarded – undo
1115 1115
 		$is_widgets_page = ( $pagenow === 'widgets.php' );
1116 1116
 
1117 1117
 		// Add the GV font (with the Astronaut)
1118
-        wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version );
1118
+        wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version );
1119 1119
 		wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version );
1120 1120
 
1121
-		wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true );
1121
+		wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true );
1122 1122
 
1123
-		if( GFForms::get_page() === 'form_list' ) {
1123
+		if ( GFForms::get_page() === 'form_list' ) {
1124 1124
 			wp_enqueue_style( 'gravityview_views_styles' );
1125 1125
 			return;
1126 1126
         }
1127 1127
 
1128 1128
 		// Don't process any scripts below here if it's not a GravityView page.
1129
-		if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) {
1129
+		if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) {
1130 1130
 		    return;
1131 1131
 		}
1132 1132
 
1133 1133
         wp_enqueue_script( 'jquery-ui-datepicker' );
1134
-        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version );
1134
+        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version );
1135 1135
 
1136
-        $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
1136
+        $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1137 1137
 
1138 1138
         //enqueue scripts
1139 1139
         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' ), \GV\Plugin::$version );
1140 1140
 
1141
-        wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1141
+        wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array(
1142 1142
             'cookiepath' => COOKIEPATH,
1143
-            'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ),
1143
+            'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ),
1144 1144
             'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1145 1145
             'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1146 1146
             'label_close' => __( 'Close', 'gravityview' ),
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
             'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1153 1153
             'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1154 1154
             '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' ),
1155
-        ));
1155
+        ) );
1156 1156
 
1157 1157
 		wp_enqueue_style( 'gravityview_views_styles' );
1158 1158
 
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
 		);
1180 1180
 
1181 1181
 		if ( wp_is_mobile() ) {
1182
-		    $scripts[] = 'jquery-touch-punch';
1182
+		    $scripts[ ] = 'jquery-touch-punch';
1183 1183
 		}
1184 1184
 
1185 1185
 		wp_enqueue_script( $scripts );
Please login to merge, or discard this patch.
future/includes/class-gv-view.php 1 patch
Spacing   +68 added lines, -69 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		$supports = array( 'title', 'revisions' );
126 126
 
127 127
 		if ( $is_hierarchical ) {
128
-			$supports[] = 'page-attributes';
128
+			$supports[ ] = 'page-attributes';
129 129
 		}
130 130
 
131 131
 		/**
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 		$rule = array( sprintf( '%s/([^/]+)/csv/?', $slug ), 'index.php?gravityview=$matches[1]&csv=1', 'top' );
228 228
 
229 229
 		add_filter( 'query_vars', function( $query_vars ) { 
230
-			$query_vars[] = 'csv';
230
+			$query_vars[ ] = 'csv';
231 231
 			return $query_vars;
232 232
 		} );
233 233
 
234
-		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[0] ] ) ) {
234
+		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[ 0 ] ] ) ) {
235 235
 			call_user_func_array( 'add_rewrite_rule', $rule );
236 236
 		}
237 237
 	}
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 			return $content;
301 301
 		}
302 302
 
303
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
303
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
304 304
 
305 305
 		/**
306 306
 		 * Editing a single entry.
307 307
 		 */
308 308
 		if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) {
309
-			if ( $entry['status'] != 'active' ) {
309
+			if ( $entry[ 'status' ] != 'active' ) {
310 310
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
311 311
 				return __( 'You are not allowed to view this content.', 'gravityview' );
312 312
 			}
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 			}
318 318
 
319 319
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
320
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
320
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
321 321
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
322 322
 					return __( 'You are not allowed to view this content.', 'gravityview' );
323 323
 				}
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
 			foreach ( $entryset as $e ) {
342 342
 
343
-				if ( 'active' !== $e['status'] ) {
343
+				if ( 'active' !== $e[ 'status' ] ) {
344 344
 					gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) );
345 345
 					return __( 'You are not allowed to view this content.', 'gravityview' );
346 346
 				}
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 				}
352 352
 
353 353
 				if ( $show_only_approved && ! $is_admin_and_can_view ) {
354
-					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
354
+					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
355 355
 						gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) );
356 356
 						return __( 'You are not allowed to view this content.', 'gravityview' );
357 357
 					}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 			$join_column    = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column );
527 527
 			$join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column );
528 528
 
529
-			$joins [] = new Join( $join, $join_column, $join_on, $join_on_column );
529
+			$joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column );
530 530
 		}
531 531
 
532 532
 		return $joins;
@@ -621,13 +621,13 @@  discard block
 block discarded – undo
621 621
 			}
622 622
 
623 623
 			foreach ( $_fields as $field ) {
624
-				if ( ! empty( $field['unions'] ) ) {
625
-					foreach ( $field['unions'] as $form_id => $field_id ) {
624
+				if ( ! empty( $field[ 'unions' ] ) ) {
625
+					foreach ( $field[ 'unions' ] as $form_id => $field_id ) {
626 626
 						if ( ! isset( $unions[ $form_id ] ) ) {
627 627
 							$unions[ $form_id ] = array();
628 628
 						}
629 629
 
630
-						$unions[ $form_id ][ $field['id'] ] =
630
+						$unions[ $form_id ][ $field[ 'id' ] ] =
631 631
 							is_numeric( $field_id ) ? \GV\GF_Field::by_id( \GV\GF_Form::by_id( $form_id ), $field_id ) : \GV\Internal_Field::by_id( $field_id );
632 632
 					}
633 633
 				}
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 		if ( ! $view->form ) {
677 677
 			gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array(
678 678
 				'view_id' => $view->ID,
679
-				'form_id' => $view->_gravityview_form_id ? : 0,
679
+				'form_id' => $view->_gravityview_form_id ?: 0,
680 680
 			) );
681 681
 		}
682 682
 
@@ -915,11 +915,11 @@  discard block
 block discarded – undo
915 915
 			 * Remove multiple sorting before calling legacy filters.
916 916
 			 * This allows us to fake it till we make it.
917 917
 			 */
918
-			if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) {
918
+			if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) {
919 919
 				$has_multisort = true;
920
-				$parameters['sort_field'] = reset( $parameters['sort_field'] );
921
-				if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) {
922
-					$parameters['sort_direction'] = reset( $parameters['sort_direction'] );
920
+				$parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] );
921
+				if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) {
922
+					$parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] );
923 923
 				}
924 924
 			}
925 925
 
@@ -927,34 +927,33 @@  discard block
 block discarded – undo
927 927
 			 * @todo: Stop using _frontend and use something like $request->get_search_criteria() instead
928 928
 			 */
929 929
 			$parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID );
930
-			$parameters['context_view_id'] = $this->ID;
930
+			$parameters[ 'context_view_id' ] = $this->ID;
931 931
 			$parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID );
932 932
 
933 933
 			if ( $request instanceof REST\Request ) {
934 934
 				$atts = $this->settings->as_atts();
935 935
 				$paging_parameters = wp_parse_args( $request->get_paging(), array(
936
-						'paging' => array( 'page_size' => $atts['page_size'] ),
936
+						'paging' => array( 'page_size' => $atts[ 'page_size' ] ),
937 937
 					) );
938
-				$parameters['paging'] = $paging_parameters['paging'];
938
+				$parameters[ 'paging' ] = $paging_parameters[ 'paging' ];
939 939
 			}
940 940
 
941
-			$page = Utils::get( $parameters['paging'], 'current_page' ) ?
942
-				: ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 );
941
+			$page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );
943 942
 
944 943
 			/**
945 944
 			 * Cleanup duplicate field_filter parameters to simplify the query.
946 945
 			 */
947 946
 			$unique_field_filters = array();
948
-			foreach ( $parameters['search_criteria']['field_filters'] as $key => $filter ) {
947
+			foreach ( $parameters[ 'search_criteria' ][ 'field_filters' ] as $key => $filter ) {
949 948
 				if ( 'mode' === $key ) {
950
-					$unique_field_filters['mode'] = $filter;
949
+					$unique_field_filters[ 'mode' ] = $filter;
951 950
 				} else if ( ! in_array( $filter, $unique_field_filters ) ) {
952
-					$unique_field_filters[] = $filter;
951
+					$unique_field_filters[ ] = $filter;
953 952
 				}
954 953
 			}
955
-			$parameters['search_criteria']['field_filters'] = $unique_field_filters;
954
+			$parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters;
956 955
 
957
-			if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) {
956
+			if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) {
958 957
 				gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' );
959 958
 			}
960 959
 
@@ -963,7 +962,7 @@  discard block
 block discarded – undo
963 962
 				$query_class = $this->get_query_class();
964 963
 
965 964
 				/** @var \GF_Query $query */
966
-				$query = new $query_class( $this->form->ID, $parameters['search_criteria'], $parameters['sorting'] );
965
+				$query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], $parameters[ 'sorting' ] );
967 966
 
968 967
 				/**
969 968
 				 * Apply multisort.
@@ -974,15 +973,15 @@  discard block
 block discarded – undo
974 973
 					$view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() );
975 974
 					$view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() );
976 975
 
977
-					$has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] );
976
+					$has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] );
978 977
 
979
-					if( $has_sort_query_param ) {
980
-						$has_sort_query_param = array_filter( array_values( $_GET['sort'] ) );
978
+					if ( $has_sort_query_param ) {
979
+						$has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) );
981 980
 					}
982 981
 
983 982
 					if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) {
984
-						$sort_field_ids = array_keys( $_GET['sort'] );
985
-						$sort_directions = array_values( $_GET['sort'] );
983
+						$sort_field_ids = array_keys( $_GET[ 'sort' ] );
984
+						$sort_directions = array_values( $_GET[ 'sort' ] );
986 985
 					} else {
987 986
 						$sort_field_ids = $view_setting_sort_field_ids;
988 987
 						$sort_directions = $view_setting_sort_directions;
@@ -990,7 +989,7 @@  discard block
 block discarded – undo
990 989
 
991 990
 					$skip_first = false;
992 991
 
993
-					foreach ( (array) $sort_field_ids as $key => $sort_field_id ) {
992
+					foreach ( (array)$sort_field_ids as $key => $sort_field_id ) {
994 993
 
995 994
 						if ( ! $skip_first && ! $has_sort_query_param ) {
996 995
 							$skip_first = true; // Skip the first one, it's already in the query
@@ -1011,8 +1010,8 @@  discard block
 block discarded – undo
1011 1010
 					}
1012 1011
 				}
1013 1012
 
1014
-				$query->limit( $parameters['paging']['page_size'] )
1015
-					->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) );
1013
+				$query->limit( $parameters[ 'paging' ][ 'page_size' ] )
1014
+					->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) );
1016 1015
 
1017 1016
 				/**
1018 1017
 				 * Any joins?
@@ -1035,7 +1034,7 @@  discard block
 block discarded – undo
1035 1034
 
1036 1035
 							$query_parameters = $query->_introspect();
1037 1036
 
1038
-							$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
1037
+							$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
1039 1038
 						}
1040 1039
 
1041 1040
 						/**
@@ -1069,7 +1068,7 @@  discard block
 block discarded – undo
1069 1068
 						}
1070 1069
 
1071 1070
 						$q = $query->_introspect();
1072
-						$query->where( \GF_Query_Condition::_and( $q['where'], $condition ) );
1071
+						$query->where( \GF_Query_Condition::_and( $q[ 'where' ], $condition ) );
1073 1072
 
1074 1073
 						if ( $this->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
1075 1074
 
@@ -1094,7 +1093,7 @@  discard block
 block discarded – undo
1094 1093
 
1095 1094
 							$query_parameters = $query->_introspect();
1096 1095
 
1097
-							$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
1096
+							$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
1098 1097
 						}
1099 1098
 					}
1100 1099
 				
@@ -1118,7 +1117,7 @@  discard block
 block discarded – undo
1118 1117
 							$conditions = array();
1119 1118
 
1120 1119
 							foreach ( $condition->expressions as $_condition ) {
1121
-								$conditions[] = $recurse( $_condition, $fields, $recurse );
1120
+								$conditions[ ] = $recurse( $_condition, $fields, $recurse );
1122 1121
 							}
1123 1122
 
1124 1123
 							return call_user_func_array(
@@ -1147,10 +1146,10 @@  discard block
 block discarded – undo
1147 1146
 						$q = new $query_class( $form_id );
1148 1147
 
1149 1148
 						// Copy the WHERE clauses but substitute the field_ids to the respective ones
1150
-						$q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) );
1149
+						$q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) );
1151 1150
 
1152 1151
 						// Copy the ORDER clause and substitute the field_ids to the respective ones
1153
-						foreach ( $query_parameters['order'] as $order ) {
1152
+						foreach ( $query_parameters[ 'order' ] as $order ) {
1154 1153
 							list( $column, $_order ) = $order;
1155 1154
 
1156 1155
 							if ( $column && $column instanceof \GF_Query_Column ) {
@@ -1164,15 +1163,15 @@  discard block
 block discarded – undo
1164 1163
 
1165 1164
 						add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) {
1166 1165
 							// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1167
-							$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1166
+							$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1168 1167
 
1169 1168
 							// Record the SQL
1170
-							$unions_sql[] = array(
1169
+							$unions_sql[ ] = array(
1171 1170
 								// Remove columns, we'll rebuild them
1172 1171
 								'select'  => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ),
1173
-								'from'    => $sql['from'],
1174
-								'join'    => $sql['join'],
1175
-								'where'   => $sql['where'],
1172
+								'from'    => $sql[ 'from' ],
1173
+								'join'    => $sql[ 'join' ],
1174
+								'where'   => $sql[ 'where' ],
1176 1175
 								// Remove order and limit
1177 1176
 							);
1178 1177
 
@@ -1189,11 +1188,11 @@  discard block
 block discarded – undo
1189 1188
 
1190 1189
 					add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) {
1191 1190
 						// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1192
-						$sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1191
+						$sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1193 1192
 
1194 1193
 						// Remove columns, we'll rebuild them
1195
-						preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match );
1196
-						$sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] );
1194
+						preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match );
1195
+						$sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] );
1197 1196
 
1198 1197
 						$unions = array();
1199 1198
 
@@ -1204,30 +1203,30 @@  discard block
 block discarded – undo
1204 1203
 						};
1205 1204
 
1206 1205
 						// Add all the order columns into the selects, so we can order by the whole union group
1207
-						preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches );
1206
+						preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches );
1208 1207
 						
1209 1208
 						$columns = array(
1210
-							sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) )
1209
+							sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) )
1211 1210
 						);
1212 1211
 
1213 1212
 						foreach ( array_slice( $order_matches, 1 ) as $match ) {
1214
-							$columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) );
1213
+							$columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) );
1215 1214
 
1216 1215
 							// Rewrite the order columns to the shared aliases
1217
-							$sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] );
1216
+							$sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] );
1218 1217
 						}
1219 1218
 
1220 1219
 						$columns = array_unique( $columns );
1221 1220
 
1222 1221
 						// Add the columns to every UNION
1223 1222
 						foreach ( $unions_sql as $union_sql ) {
1224
-							$union_sql['select'] .= implode( ', ', $columns );
1225
-							$unions []= implode( ' ', $union_sql );
1223
+							$union_sql[ 'select' ] .= implode( ', ', $columns );
1224
+							$unions [ ] = implode( ' ', $union_sql );
1226 1225
 						}
1227 1226
 
1228 1227
 						// Add the columns to the main SELECT, but only grab the entry id column
1229
-						$sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns );
1230
-						$sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order'];
1228
+						$sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns );
1229
+						$sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ];
1231 1230
 
1232 1231
 						return $sql;
1233 1232
 					} );
@@ -1268,20 +1267,20 @@  discard block
 block discarded – undo
1268 1267
 				} );
1269 1268
 			} else {
1270 1269
 				$entries = $this->form->entries
1271
-					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) )
1270
+					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) )
1272 1271
 					->offset( $this->settings->get( 'offset' ) )
1273
-					->limit( $parameters['paging']['page_size'] )
1272
+					->limit( $parameters[ 'paging' ][ 'page_size' ] )
1274 1273
 					->page( $page );
1275 1274
 
1276
-				if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) {
1275
+				if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) {
1277 1276
 					// Pluck off multisort arrays
1278
-					$parameters['sorting'] = $parameters['sorting'][0];
1277
+					$parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ];
1279 1278
 				}
1280 1279
 
1281
-				if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) {
1280
+				if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) {
1282 1281
 					$field = new \GV\Field();
1283
-					$field->ID = $parameters['sorting']['key'];
1284
-					$direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1282
+					$field->ID = $parameters[ 'sorting' ][ 'key' ];
1283
+					$direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1285 1284
 					$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
1286 1285
 				}
1287 1286
 			}
@@ -1356,7 +1355,7 @@  discard block
 block discarded – undo
1356 1355
 		$allowed = $headers = array();
1357 1356
 
1358 1357
 		foreach ( $view->fields->by_position( "directory_*" )->by_visible()->all() as $id => $field ) {
1359
-			$allowed[] = $field;
1358
+			$allowed[ ] = $field;
1360 1359
 		}
1361 1360
 
1362 1361
 		$renderer = new Field_Renderer();
@@ -1378,17 +1377,17 @@  discard block
 block discarded – undo
1378 1377
 			} );
1379 1378
 
1380 1379
 			foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) {
1381
-				$allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
1380
+				$allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
1382 1381
 			}
1383 1382
 
1384 1383
 			foreach ( $allowed as $field ) {
1385 1384
 				$source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source();
1386 1385
 
1387
-				$return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' );
1386
+				$return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' );
1388 1387
 
1389 1388
 				if ( ! $headers_done ) {
1390 1389
 					$label = $field->get_label( $view, $source, $entry );
1391
-					$headers[] = $label ? $label : $field->ID;
1390
+					$headers[ ] = $label ? $label : $field->ID;
1392 1391
 				}
1393 1392
 			}
1394 1393
 
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
 		/** @var \GV\GF_Field|\GV\Internal_Field $field_class 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 ];
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 * @return boolean Whether this $key is set or not.
369 369
 	 */
370 370
 	public function __isset( $key ) {
371
-		switch( $key ) {
371
+		switch ( $key ) {
372 372
 			default:
373 373
 				return isset( $this->configuration[ $key ] );
374 374
 		}
Please login to merge, or discard this patch.
includes/class-frontend-views.php 1 patch
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	private function __construct() {}
86 86
 
87 87
 	private function initialize() {
88
-		add_action( 'wp', array( $this, 'parse_content'), 11 );
88
+		add_action( 'wp', array( $this, 'parse_content' ), 11 );
89 89
 		add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 );
90
-		add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 );
90
+		add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 );
91 91
 
92 92
 		// Enqueue scripts and styles after GravityView_Template::register_styles()
93 93
 		add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 );
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 
237 237
 			$this->context_view_id = $view_id;
238 238
 
239
-		} elseif ( isset( $_GET['gvid'] ) && $multiple_views ) {
239
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) {
240 240
 			/**
241 241
 			 * used on a has_multiple_views context
242 242
 			 * @see GravityView_API::entry_link
243 243
 			 */
244
-			$this->context_view_id = $_GET['gvid'];
244
+			$this->context_view_id = $_GET[ 'gvid' ];
245 245
 
246 246
 		} elseif ( ! $multiple_views ) {
247 247
 			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
@@ -278,25 +278,25 @@  discard block
 block discarded – undo
278 278
 		global $wp_rewrite;
279 279
 
280 280
 		$is_front_page = ( $query->is_home || $query->is_page );
281
-		$show_on_front = ( 'page' === get_option('show_on_front') );
282
-		$front_page_id = get_option('page_on_front');
281
+		$show_on_front = ( 'page' === get_option( 'show_on_front' ) );
282
+		$front_page_id = get_option( 'page_on_front' );
283 283
 
284
-		if (  $is_front_page && $show_on_front && $front_page_id ) {
284
+		if ( $is_front_page && $show_on_front && $front_page_id ) {
285 285
 
286 286
 			// Force to be an array, potentially a query string ( entry=16 )
287 287
 			$_query = wp_parse_args( $query->query );
288 288
 
289 289
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
290
-			if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) {
291
-				unset( $_query['pagename'] );
290
+			if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) {
291
+				unset( $_query[ 'pagename' ] );
292 292
 			}
293 293
 
294 294
 			// this is where will break from core wordpress
295 295
 			/** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */
296 296
 			$ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query );
297 297
 			$endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' );
298
-			foreach ( (array) $endpoints as $endpoint ) {
299
-				$ignore[] = $endpoint[1];
298
+			foreach ( (array)$endpoints as $endpoint ) {
299
+				$ignore[ ] = $endpoint[ 1 ];
300 300
 			}
301 301
 			unset( $endpoints );
302 302
 
@@ -306,21 +306,21 @@  discard block
 block discarded – undo
306 306
 			// - The query includes keys that are associated with registered endpoints. `entry`, for example.
307 307
 			if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) {
308 308
 
309
-				$qv =& $query->query_vars;
309
+				$qv = & $query->query_vars;
310 310
 
311 311
 				// Prevent redirect when on the single entry endpoint
312
-				if( self::is_single_entry() ) {
312
+				if ( self::is_single_entry() ) {
313 313
 					add_filter( 'redirect_canonical', '__return_false' );
314 314
 				}
315 315
 
316 316
 				$query->is_page = true;
317 317
 				$query->is_home = false;
318
-				$qv['page_id']  = $front_page_id;
318
+				$qv[ 'page_id' ]  = $front_page_id;
319 319
 
320 320
 				// Correct <!--nextpage--> for page_on_front
321
-				if ( ! empty( $qv['paged'] ) ) {
322
-					$qv['page'] = $qv['paged'];
323
-					unset( $qv['paged'] );
321
+				if ( ! empty( $qv[ 'paged' ] ) ) {
322
+					$qv[ 'page' ] = $qv[ 'paged' ];
323
+					unset( $qv[ 'paged' ] );
324 324
 				}
325 325
 			}
326 326
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' );
352 352
 
353
-		$post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null );
353
+		$post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null );
354 354
 		$this->setPostId( $post_id );
355 355
 		$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false;
356 356
 		$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) );
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 		$search_method = GravityView_Widget_Search::getInstance()->get_search_method();
388 388
 
389
-		if( 'post' === $search_method ) {
389
+		if ( 'post' === $search_method ) {
390 390
 			$get = $_POST;
391 391
 		} else {
392 392
 			$get = $_GET;
@@ -443,20 +443,20 @@  discard block
 block discarded – undo
443 443
 		 * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop
444 444
 		 * @param array $entry Current entry
445 445
 		 */
446
-		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry );
446
+		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry );
447 447
 
448 448
 		if ( ! $apply_outside_loop ) {
449 449
 			return $title;
450 450
 		}
451 451
 
452 452
 		// User reported WooCommerce doesn't pass two args.
453
-		if ( empty( $passed_post_id ) )  {
453
+		if ( empty( $passed_post_id ) ) {
454 454
 			return $title;
455 455
 		}
456 456
 
457 457
 		// Don't modify the title for anything other than the current view/post.
458 458
 		// This is true for embedded shortcodes and Views.
459
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
459
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
460 460
 			return $title;
461 461
 		}
462 462
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 			$view_meta = $this->getGvOutputData()->get_view( $context_view_id );
469 469
 		} else {
470 470
 			foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
471
-				if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) {
471
+				if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) {
472 472
 					$view_meta = $view_data;
473 473
 					break;
474 474
 				}
@@ -476,12 +476,12 @@  discard block
 block discarded – undo
476 476
 		}
477 477
 
478 478
 		/** Deprecated stuff in the future. See the branch above. */
479
-		if ( ! empty( $view_meta['atts']['single_title'] ) ) {
479
+		if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) {
480 480
 
481
-			$title = $view_meta['atts']['single_title'];
481
+			$title = $view_meta[ 'atts' ][ 'single_title' ];
482 482
 
483 483
 			// We are allowing HTML in the fields, so no escaping the output
484
-			$title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry );
484
+			$title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry );
485 485
 
486 486
 			$title = do_shortcode( $title );
487 487
 		}
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
 		$context = GravityView_View::getInstance()->getContext();
554 554
 
555
-		switch( $context ) {
555
+		switch ( $context ) {
556 556
 			case 'directory':
557 557
 				$tab = __( 'Multiple Entries', 'gravityview' );
558 558
 				break;
@@ -566,12 +566,12 @@  discard block
 block discarded – undo
566 566
 		}
567 567
 
568 568
 
569
-		$title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
569
+		$title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
570 570
 		$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) );
571
-		$action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab );
571
+		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
572 572
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
573 573
 
574
-		$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
574
+		$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
575 575
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
576 576
 
577 577
 		echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id );
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 		$direct_access = apply_filters( 'gravityview_direct_access', true, $view->ID );
620 620
 		$embed_only = $view->settings->get( 'embed_only' );
621 621
 
622
-		if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
622
+		if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
623 623
 			return __( 'You are not allowed to view this content.', 'gravityview' );
624 624
 		}
625 625
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 				$datetime_format = 'Y-m-d H:i:s';
667 667
 				$search_is_outside_view_bounds = false;
668 668
 
669
-				if( ! empty( $search_criteria[ $key ] ) ) {
669
+				if ( ! empty( $search_criteria[ $key ] ) ) {
670 670
 
671 671
 					$search_date = strtotime( $search_criteria[ $key ] );
672 672
 
@@ -694,14 +694,14 @@  discard block
 block discarded – undo
694 694
 				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
695 695
 
696 696
 					// Then we override the search and re-set the start date
697
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
697
+					$return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true );
698 698
 				}
699 699
 			}
700 700
 		}
701 701
 
702
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
702
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
703 703
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
704
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
704
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
705 705
 				gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) );
706 706
 			}
707 707
 		}
@@ -720,19 +720,19 @@  discard block
 block discarded – undo
720 720
 	public static function process_search_only_approved( $args, $search_criteria ) {
721 721
 
722 722
 		/** @since 1.19 */
723
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
723
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
724 724
 			gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' );
725 725
 			return $search_criteria;
726 726
 		}
727 727
 
728
-		if ( ! empty( $args['show_only_approved'] ) ) {
728
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
729 729
 
730
-			$search_criteria['field_filters'][] = array(
730
+			$search_criteria[ 'field_filters' ][ ] = array(
731 731
 				'key' => GravityView_Entry_Approval::meta_key,
732 732
 				'value' => GravityView_Entry_Approval_Status::APPROVED
733 733
 			);
734 734
 
735
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
735
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
736 736
 
737 737
 			gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) );
738 738
 		}
@@ -759,18 +759,18 @@  discard block
 block discarded – undo
759 759
 	 */
760 760
 	public static function is_entry_approved( $entry, $args = array() ) {
761 761
 
762
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
762
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
763 763
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
764 764
 			return true;
765 765
 		}
766 766
 
767 767
 		/** @since 1.19 */
768
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
768
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
769 769
 			gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' );
770 770
 			return true;
771 771
 		}
772 772
 
773
-		$is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key );
773
+		$is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key );
774 774
 
775 775
 		return GravityView_Entry_Approval_Status::is_approved( $is_approved );
776 776
 	}
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 		 * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`.
795 795
 		 */
796 796
 		$criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) );
797
-		$search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() );
797
+		$search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() );
798 798
 
799 799
 		/**
800 800
 		 * @filter `gravityview_fe_search_criteria` Modify the search criteria
@@ -810,29 +810,29 @@  discard block
 block discarded – undo
810 810
 		gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' =>$search_criteria ) );
811 811
 
812 812
 		// implicity search
813
-		if ( ! empty( $args['search_value'] ) ) {
813
+		if ( ! empty( $args[ 'search_value' ] ) ) {
814 814
 
815 815
 			// Search operator options. Options: `is` or `contains`
816
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
816
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
817 817
 
818
-			$search_criteria['field_filters'][] = array(
818
+			$search_criteria[ 'field_filters' ][ ] = array(
819 819
 				'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search
820
-				'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes.
820
+				'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes.
821 821
 				'operator' => $operator,
822 822
 			);
823 823
 
824 824
 			// Lock search mode to "all" with implicit presearch filter.
825
-			$search_criteria['field_filters']['mode'] = 'all';
825
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all';
826 826
 		}
827 827
 
828
-		if( $search_criteria !== $original_search_criteria ) {
828
+		if ( $search_criteria !== $original_search_criteria ) {
829 829
 			gravityview()->log->debug( '[get_search_criteria] Search Criteria after implicity search: ', array( 'data' => $search_criteria ) );
830 830
 		}
831 831
 
832 832
 		// Handle setting date range
833 833
 		$search_criteria = self::process_search_dates( $args, $search_criteria );
834 834
 
835
-		if( $search_criteria !== $original_search_criteria ) {
835
+		if ( $search_criteria !== $original_search_criteria ) {
836 836
 			gravityview()->log->debug( '[get_search_criteria] Search Criteria after date params: ', array( 'data' => $search_criteria ) );
837 837
 		}
838 838
 
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
844 844
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
845 845
 		 */
846
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
846
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
847 847
 
848 848
 		return $search_criteria;
849 849
 	}
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			'search_criteria' => $search_criteria,
957 957
 			'sorting' => self::updateViewSorting( $args, $form_id ),
958 958
 			'paging' => $paging,
959
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
959
+			'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
960 960
 		);
961 961
 
962 962
 		/**
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
982 982
 		 * @param array $args View configuration args.
983 983
 		 */
984
-		$parameters = apply_filters( 'gravityview_get_entries_'.\GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id );
984
+		$parameters = apply_filters( 'gravityview_get_entries_' . \GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id );
985 985
 
986 986
 		gravityview()->log->debug( '$parameters passed to gravityview_get_entries(): ', array( 'data' => $parameters ) );
987 987
 
@@ -1006,17 +1006,17 @@  discard block
 block discarded – undo
1006 1006
 		$default_page_size = apply_filters( 'gravityview_default_page_size', 25 );
1007 1007
 
1008 1008
 		// Paging & offset
1009
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size;
1009
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size;
1010 1010
 
1011 1011
 		if ( -1 === $page_size ) {
1012 1012
 			$page_size = PHP_INT_MAX;
1013 1013
 		}
1014 1014
 
1015
-		$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
1015
+		$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
1016 1016
 		$offset = ( $curr_page - 1 ) * $page_size;
1017 1017
 
1018
-		if ( ! empty( $args['offset'] ) ) {
1019
-			$offset += intval( $args['offset'] );
1018
+		if ( ! empty( $args[ 'offset' ] ) ) {
1019
+			$offset += intval( $args[ 'offset' ] );
1020 1020
 		}
1021 1021
 
1022 1022
 		$paging = array(
@@ -1041,14 +1041,14 @@  discard block
 block discarded – undo
1041 1041
 	public static function updateViewSorting( $args, $form_id ) {
1042 1042
 		$sorting = array();
1043 1043
 
1044
-		$has_values = isset( $_GET['sort'] );
1044
+		$has_values = isset( $_GET[ 'sort' ] );
1045 1045
 
1046
-		if ( $has_values && is_array( $_GET['sort'] ) ) {
1047
-			$has_values = array_filter( array_values( $_GET['sort'] ) );
1046
+		if ( $has_values && is_array( $_GET[ 'sort' ] ) ) {
1047
+			$has_values = array_filter( array_values( $_GET[ 'sort' ] ) );
1048 1048
 		}
1049 1049
 
1050
-		$sort_field_id = $has_values ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' );
1051
-		$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' );
1050
+		$sort_field_id = $has_values ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' );
1051
+		$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' );
1052 1052
 
1053 1053
 		if ( is_array( $sort_field_id ) ) {
1054 1054
 			$sort_field_id = array_pop( $sort_field_id );
@@ -1079,10 +1079,10 @@  discard block
 block discarded – undo
1079 1079
 				$form = GFAPI::get_form( $form_id );
1080 1080
 
1081 1081
 				// Get the first GF_Field field ID, set as the key for entry randomization
1082
-				if ( ! empty( $form['fields'] ) ) {
1082
+				if ( ! empty( $form[ 'fields' ] ) ) {
1083 1083
 
1084 1084
 					/** @var GF_Field $field */
1085
-					foreach ( $form['fields'] as $field ) {
1085
+					foreach ( $form[ 'fields' ] as $field ) {
1086 1086
 						if ( ! is_a( $field, 'GF_Field' ) ) {
1087 1087
 							continue;
1088 1088
 						}
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 		if ( is_array( $sort_field_id ) ) {
1128 1128
 			$modified_ids = array();
1129 1129
 			foreach ( $sort_field_id as $_sort_field_id ) {
1130
-				$modified_ids []= self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id );
1130
+				$modified_ids [ ] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id );
1131 1131
 			}
1132 1132
 			return $modified_ids;
1133 1133
 		}
@@ -1136,11 +1136,11 @@  discard block
 block discarded – undo
1136 1136
 
1137 1137
 		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1138 1138
 
1139
-		if( ! $sort_field ) {
1139
+		if ( ! $sort_field ) {
1140 1140
 			return $sort_field_id;
1141 1141
 		}
1142 1142
 
1143
-		switch ( $sort_field['type'] ) {
1143
+		switch ( $sort_field[ 'type' ] ) {
1144 1144
 
1145 1145
 			case 'address':
1146 1146
 				// Sorting by full address
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 					 */
1158 1158
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1159 1159
 
1160
-					switch( strtolower( $address_part ) ){
1160
+					switch ( strtolower( $address_part ) ) {
1161 1161
 						case 'street':
1162 1162
 							$sort_field_id .= '.1';
1163 1163
 							break;
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 		if ( ! class_exists( '\GV\Entry' ) ) {
1231 1231
 
1232 1232
 			// Not using gravityview()->log->error(), since that may not exist yet either!
1233
-			do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary()  );
1233
+			do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary() );
1234 1234
 
1235 1235
 			return null;
1236 1236
 		}
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
 		 */
1248 1248
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1249 1249
 
1250
-		if ( empty( $single_entry ) ){
1250
+		if ( empty( $single_entry ) ) {
1251 1251
 			return false;
1252 1252
 		} else {
1253 1253
 			return $single_entry;
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
 			$views = $this->getGvOutputData()->get_views();
1270 1270
 
1271 1271
 			foreach ( $views as $view_id => $data ) {
1272
-				$view = \GV\View::by_id( $data['id'] );
1272
+				$view = \GV\View::by_id( $data[ 'id' ] );
1273 1273
 				$view_id = $view->ID;
1274 1274
 				$template_id = gravityview_get_template_id( $view->ID );
1275 1275
 				$data = $view->as_data();
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1279 1279
 				 * @since 1.15
1280 1280
 				 */
1281
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1281
+				if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1282 1282
 					continue;
1283 1283
 				}
1284 1284
 
@@ -1295,13 +1295,13 @@  discard block
 block discarded – undo
1295 1295
 					 * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox`
1296 1296
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of it here.
1297 1297
 					 */
1298
-					$js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1298
+					$js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1299 1299
 
1300 1300
 					/**
1301 1301
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
1302 1302
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here.
1303 1303
 					 */
1304
-					$css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1304
+					$css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1305 1305
 				}
1306 1306
 
1307 1307
 				/**
@@ -1309,19 +1309,19 @@  discard block
 block discarded – undo
1309 1309
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1310 1310
 				 * @since 1.15
1311 1311
 				 */
1312
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1313
-					$css_dependencies[] = 'dashicons';
1312
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1313
+					$css_dependencies[ ] = 'dashicons';
1314 1314
 				}
1315 1315
 
1316 1316
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1317 1317
 
1318 1318
 				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1319 1319
 
1320
-				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true );
1320
+				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true );
1321 1321
 
1322 1322
 				wp_enqueue_script( 'gravityview-fe-view' );
1323 1323
 
1324
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1324
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1325 1325
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1326 1326
 				}
1327 1327
 
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 	public static function add_style( $template_id ) {
1385 1385
 
1386 1386
 		if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) {
1387
-			gravityview()->log->debug(  'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) );
1387
+			gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) );
1388 1388
 			wp_enqueue_style( 'gravityview_style_' . $template_id );
1389 1389
 		} elseif ( empty( $template_id ) ) {
1390 1390
 			gravityview()->log->error( 'Cannot add template style; template_id is empty' );
@@ -1415,11 +1415,11 @@  discard block
 block discarded – undo
1415 1415
 		 * Not a table-based template; don't add sort icons
1416 1416
 		 * @since 1.12
1417 1417
 		 */
1418
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1418
+		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1419 1419
 			return $label;
1420 1420
 		}
1421 1421
 
1422
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1422
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1423 1423
 			return $label;
1424 1424
 		}
1425 1425
 
@@ -1427,29 +1427,29 @@  discard block
 block discarded – undo
1427 1427
 
1428 1428
 		$class = 'gv-sort';
1429 1429
 
1430
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1430
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1431 1431
 
1432 1432
 		$sort_args = array(
1433
-			'sort' => $field['id'],
1433
+			'sort' => $field[ 'id' ],
1434 1434
 			'dir' => 'asc',
1435 1435
 		);
1436 1436
 
1437
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1437
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1438 1438
 			//toggle sorting direction.
1439
-			if ( 'asc' === $sorting['direction'] ) {
1440
-				$sort_args['dir'] = 'desc';
1439
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1440
+				$sort_args[ 'dir' ] = 'desc';
1441 1441
 				$class .= ' gv-icon-sort-desc';
1442 1442
 			} else {
1443
-				$sort_args['dir'] = 'asc';
1443
+				$sort_args[ 'dir' ] = 'asc';
1444 1444
 				$class .= ' gv-icon-sort-asc';
1445 1445
 			}
1446 1446
 		} else {
1447 1447
 			$class .= ' gv-icon-caret-up-down';
1448 1448
 		}
1449 1449
 
1450
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1450
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
1451 1451
 
1452
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1452
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $label;
1453 1453
 
1454 1454
 	}
1455 1455
 
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
 
1468 1468
 		$field_type = $field_id;
1469 1469
 
1470
-		if( is_numeric( $field_id ) ) {
1470
+		if ( is_numeric( $field_id ) ) {
1471 1471
 			$field = GFFormsModel::get_field( $form, $field_id );
1472 1472
 			$field_type = $field ? $field->type : $field_id;
1473 1473
 		}
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
 			return false;
1491 1491
 		}
1492 1492
 
1493
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1493
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1494 1494
 
1495 1495
 	}
1496 1496
 
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +163 added lines, -163 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
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
231 231
 		$script_source = empty( $script_min ) ? '/source' : '';
232 232
 
233
-		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 );
233
+		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 );
234 234
 
235 235
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
236 236
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
253 253
 	 */
254 254
 	public function register_no_conflict( $allowed ) {
255
-		$allowed[] = 'gravityview_searchwidget_admin';
255
+		$allowed[ ] = 'gravityview_searchwidget_admin';
256 256
 		return $allowed;
257 257
 	}
258 258
 
@@ -265,24 +265,24 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	public static function get_searchable_fields() {
267 267
 
268
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
268
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
269 269
 			exit( '0' );
270 270
 		}
271 271
 
272 272
 		$form = '';
273 273
 
274 274
 		// Fetch the form for the current View
275
-		if ( ! empty( $_POST['view_id'] ) ) {
275
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
276 276
 
277
-			$form = gravityview_get_form_id( $_POST['view_id'] );
277
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
278 278
 
279
-		} elseif ( ! empty( $_POST['formid'] ) ) {
279
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
280 280
 
281
-			$form = (int) $_POST['formid'];
281
+			$form = (int)$_POST[ 'formid' ];
282 282
 
283
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
283
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
284 284
 
285
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
285
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
286 286
 
287 287
 		}
288 288
 
@@ -332,14 +332,14 @@  discard block
 block discarded – undo
332 332
 		);
333 333
 
334 334
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
335
-			$custom_fields['is_approved'] = array(
335
+			$custom_fields[ 'is_approved' ] = array(
336 336
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
337 337
 				'type' => 'multi',
338 338
 			);
339 339
 		}
340 340
 
341
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
342
-			$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'] );
341
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
342
+			$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' ] );
343 343
 		}
344 344
 
345 345
 		// Get fields with sub-inputs and no parent
@@ -361,13 +361,13 @@  discard block
 block discarded – undo
361 361
 
362 362
 			foreach ( $fields as $id => $field ) {
363 363
 
364
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
364
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
365 365
 					continue;
366 366
 				}
367 367
 
368
-				$types = self::get_search_input_types( $id, $field['type'] );
368
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
369 369
 
370
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
370
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
371 371
 			}
372 372
 		}
373 373
 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
391 391
 
392 392
 		// @todo - This needs to be improved - many fields have . including products and addresses
393
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
393
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
394 394
 			$input_type = 'boolean'; // on/off checkbox
395 395
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
396 396
 			$input_type = 'multi'; //multiselect
@@ -436,19 +436,19 @@  discard block
 block discarded – undo
436 436
 			$post_id = 0;
437 437
 
438 438
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
439
-			if ( ! empty( $widget_args['post_id'] ) ) {
440
-				$post_id = absint( $widget_args['post_id'] );
439
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
440
+				$post_id = absint( $widget_args[ 'post_id' ] );
441 441
 			}
442 442
 			// We're in the WordPress Widget context, and the base View ID should be used
443
-			else if ( ! empty( $widget_args['view_id'] ) ) {
444
-				$post_id = absint( $widget_args['view_id'] );
443
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
444
+				$post_id = absint( $widget_args[ 'view_id' ] );
445 445
 			}
446 446
 
447 447
 			$args = gravityview_get_permalink_query_args( $post_id );
448 448
 
449 449
 			// Add hidden fields to the search form
450 450
 			foreach ( $args as $key => $value ) {
451
-				$search_fields[] = array(
451
+				$search_fields[ ] = array(
452 452
 					'name'  => $key,
453 453
 					'input' => 'hidden',
454 454
 					'value' => $value,
@@ -487,28 +487,28 @@  discard block
 block discarded – undo
487 487
 		/**
488 488
 		 * Include the sidebar Widgets.
489 489
 		 */
490
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
490
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
491 491
 
492 492
 		foreach ( $widgets as $widget ) {
493
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
494
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
493
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
494
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
495 495
 					foreach ( $_fields as $field ) {
496
-						if ( empty( $field['form_id'] ) ) {
497
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
496
+						if ( empty( $field[ 'form_id' ] ) ) {
497
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
498 498
 						}
499
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
499
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
500 500
 					}
501 501
 				}
502 502
 			}
503 503
 		}
504 504
 
505 505
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
506
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
506
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
507 507
 				foreach ( $_fields as $field ) {
508
-					if ( empty( $field['form_id'] ) ) {
509
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
508
+					if ( empty( $field[ 'form_id' ] ) ) {
509
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
510 510
 					}
511
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
511
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
512 512
 				}
513 513
 			}
514 514
 		}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
539 539
 		}
540 540
 
541
-		if( 'post' === $this->search_method ) {
541
+		if ( 'post' === $this->search_method ) {
542 542
 			$get = $_POST;
543 543
 		} else {
544 544
 			$get = $_GET;
@@ -557,15 +557,15 @@  discard block
 block discarded – undo
557 557
 		$get = gv_map_deep( $get, 'rawurldecode' );
558 558
 
559 559
 		// Make sure array key is set up
560
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
560
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
561 561
 
562 562
 		$searchable_fields = $this->get_view_searchable_fields( $view );
563 563
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
564 564
 
565 565
 		// add free search
566
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
566
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
567 567
 
568
-			$search_all_value = trim( $get['gv_search'] );
568
+			$search_all_value = trim( $get[ 'gv_search' ] );
569 569
 
570 570
 			/**
571 571
 			 * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase?
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 			}
591 591
 
592 592
 			foreach ( $words as $word ) {
593
-				$search_criteria['field_filters'][] = array(
593
+				$search_criteria[ 'field_filters' ][ ] = array(
594 594
 					'key' => null, // The field ID to search
595 595
 					'value' => $word, // The value to search
596 596
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -603,14 +603,14 @@  discard block
 block discarded – undo
603 603
 			/**
604 604
 			 * Get and normalize the dates according to the input format.
605 605
 			 */
606
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
607
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
606
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
607
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
608 608
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
609 609
 				}
610 610
 			}
611 611
 
612
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
613
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
612
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
613
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
614 614
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
615 615
 				}
616 616
 			}
@@ -645,22 +645,22 @@  discard block
 block discarded – undo
645 645
 			 */
646 646
 			if ( ! empty( $curr_start ) ) {
647 647
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
648
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
648
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
649 649
 			}
650 650
 
651 651
 			if ( ! empty( $curr_end ) ) {
652 652
 				// Fast-forward 24 hour on the end time
653 653
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
654
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
655
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
656
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
654
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
655
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
656
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
657 657
 				}
658 658
 			}
659 659
 		}
660 660
 
661 661
 		// search for a specific entry ID
662 662
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
663
-			$search_criteria['field_filters'][] = array(
663
+			$search_criteria[ 'field_filters' ][ ] = array(
664 664
 				'key' => 'id',
665 665
 				'value' => absint( $get[ 'gv_id' ] ),
666 666
 				'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ),
@@ -669,20 +669,20 @@  discard block
 block discarded – undo
669 669
 
670 670
 		// search for a specific Created_by ID
671 671
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
672
-			$search_criteria['field_filters'][] = array(
672
+			$search_criteria[ 'field_filters' ][ ] = array(
673 673
 				'key' => 'created_by',
674
-				'value' => $get['gv_by'],
674
+				'value' => $get[ 'gv_by' ],
675 675
 				'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ),
676 676
 			);
677 677
 		}
678 678
 
679 679
 		// Get search mode passed in URL
680
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
680
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
681 681
 
682 682
 		// get the other search filters
683 683
 		foreach ( $get as $key => $value ) {
684 684
 
685
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
685
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
686 686
 				continue; // Not a filter, or empty
687 687
 			}
688 688
 
@@ -696,19 +696,19 @@  discard block
 block discarded – undo
696 696
 				continue;
697 697
 			}
698 698
 
699
-			if ( ! isset( $filter['operator'] ) ) {
700
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
699
+			if ( ! isset( $filter[ 'operator' ] ) ) {
700
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
701 701
 			}
702 702
 
703
-			if ( isset( $filter[0]['value'] ) ) {
704
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
703
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
704
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
705 705
 
706 706
 				// if date range type, set search mode to ALL
707
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
707
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
708 708
 					$mode = 'all';
709 709
 				}
710
-			} elseif( !empty( $filter ) ) {
711
-				$search_criteria['field_filters'][] = $filter;
710
+			} elseif ( ! empty( $filter ) ) {
711
+				$search_criteria[ 'field_filters' ][ ] = $filter;
712 712
 			}
713 713
 		}
714 714
 
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 		 * @since 1.5.1
718 718
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
719 719
 		 */
720
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
720
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
721 721
 
722 722
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
723 723
 
@@ -751,19 +751,19 @@  discard block
 block discarded – undo
751 751
 
752 752
 		$query_class = $view->get_query_class();
753 753
 
754
-		if ( empty( $search_criteria['field_filters'] ) ) {
754
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
755 755
 			return;
756 756
 		}
757 757
 
758 758
 		$widgets = $view->widgets->by_id( $this->widget_id );
759 759
 		if ( $widgets->count() ) {
760 760
 			$widgets = $widgets->all();
761
-			$widget  = $widgets[0];
761
+			$widget  = $widgets[ 0 ];
762 762
 
763 763
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
764 764
 
765
-			foreach ( (array) $search_fields as $search_field ) {
766
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
765
+			foreach ( (array)$search_fields as $search_field ) {
766
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
767 767
 					$created_by_text_mode = true;
768 768
 				}
769 769
 			}
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 		$extra_conditions = array();
773 773
 		$mode = 'any';
774 774
 
775
-		foreach ( $search_criteria['field_filters'] as &$filter ) {
775
+		foreach ( $search_criteria[ 'field_filters' ] as &$filter ) {
776 776
 			if ( ! is_array( $filter ) ) {
777 777
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
778 778
 					$mode = $filter;
@@ -781,13 +781,13 @@  discard block
 block discarded – undo
781 781
 			}
782 782
 
783 783
 			// Construct a manual query for unapproved statuses
784
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
785
-				$_tmp_query       = new $query_class( $view->form->ID, array(
784
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
785
+				$_tmp_query = new $query_class( $view->form->ID, array(
786 786
 					'field_filters' => array(
787 787
 						array(
788 788
 							'operator' => 'in',
789 789
 							'key'      => 'is_approved',
790
-							'value'    => (array) $filter['value'],
790
+							'value'    => (array)$filter[ 'value' ],
791 791
 						),
792 792
 						array(
793 793
 							'operator' => 'is',
@@ -799,30 +799,30 @@  discard block
 block discarded – undo
799 799
 				) );
800 800
 				$_tmp_query_parts = $_tmp_query->_introspect();
801 801
 
802
-				$extra_conditions[] = $_tmp_query_parts['where'];
802
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
803 803
 
804 804
 				$filter = false;
805 805
 				continue;
806 806
 			}
807 807
 
808 808
 			// Construct manual query for text mode creator search
809
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
810
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
809
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
810
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
811 811
 				$filter = false;
812 812
 				continue;
813 813
 			}
814 814
 
815 815
 			// By default, we want searches to be wildcard for each field.
816
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
816
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
817 817
 
818 818
 			// For multichoice, let's have an in (OR) search.
819
-			if ( is_array( $filter['value'] ) ) {
820
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
819
+			if ( is_array( $filter[ 'value' ] ) ) {
820
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
821 821
 			}
822 822
 
823 823
 			// Default form with joins functionality
824
-			if ( empty( $filter['form_id'] ) ) {
825
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
824
+			if ( empty( $filter[ 'form_id' ] ) ) {
825
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
826 826
 			}
827 827
 
828 828
 			/**
@@ -832,28 +832,28 @@  discard block
 block discarded – undo
832 832
 			 * @since develop
833 833
 			 * @param \GV\View $view The View we're operating on.
834 834
 			 */
835
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );
835
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view );
836 836
 		}
837 837
 
838
-		if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) {
838
+		if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) {
839 839
 			$date_criteria = array();
840 840
 
841
-			if ( isset( $search_criteria['start_date'] ) ) {
842
-				$date_criteria['start_date'] = $search_criteria['start_date'];
841
+			if ( isset( $search_criteria[ 'start_date' ] ) ) {
842
+				$date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ];
843 843
 			}
844 844
 
845
-			if ( isset( $search_criteria['end_date'] ) ) {
846
-				$date_criteria['end_date'] = $search_criteria['end_date'];
845
+			if ( isset( $search_criteria[ 'end_date' ] ) ) {
846
+				$date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ];
847 847
 			}
848 848
 
849 849
 			$_tmp_query         = new $query_class( $view->form->ID, $date_criteria );
850 850
 			$_tmp_query_parts   = $_tmp_query->_introspect();
851
-			$extra_conditions[] = $_tmp_query_parts['where'];
851
+			$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
852 852
 		}
853 853
 
854 854
 		$search_conditions = array();
855 855
 
856
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
856
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
857 857
 
858 858
 			foreach ( $filters as $filter ) {
859 859
 				if ( ! is_array( $filter ) ) {
@@ -866,20 +866,20 @@  discard block
 block discarded – undo
866 866
 				 * code by reusing what's inside GF_Query already as they
867 867
 				 * take care of many small things like forcing numeric, etc.
868 868
 				 */
869
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
869
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
870 870
 				$_tmp_query_parts = $_tmp_query->_introspect();
871
-				$search_condition = $_tmp_query_parts['where'];
871
+				$search_condition = $_tmp_query_parts[ 'where' ];
872 872
 
873
-				if ( empty( $filter['key'] ) && $search_condition->expressions ) {
874
-					$search_conditions[] = $search_condition;
873
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
874
+					$search_conditions[ ] = $search_condition;
875 875
 				} else {
876 876
 					$left = $search_condition->left;
877 877
 					$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
878 878
 
879 879
 					if ( $view->joins && $left->field_id == GF_Query_Column::META ) {
880
-						$search_conditions[] = $search_condition;
880
+						$search_conditions[ ] = $search_condition;
881 881
 					} else {
882
-						$search_conditions[] = new GF_Query_Condition(
882
+						$search_conditions[ ] = new GF_Query_Condition(
883 883
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
884 884
 							$search_condition->operator,
885 885
 							$search_condition->right
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 		/**
902 902
 		 * Combine the parts as a new WHERE clause.
903 903
 		 */
904
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
904
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
905 905
 		$query->where( $where );
906 906
 	}
907 907
 
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 		$field_id = str_replace( 'filter_', '', $key );
925 925
 
926 926
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
927
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
927
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
928 928
 			$field_id = str_replace( '_', '.', $field_id );
929 929
 		}
930 930
 
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 			// form is in searchable fields
982 982
 			$found = false;
983 983
 			foreach ( $searchable_fields as $field ) {
984
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
984
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
985 985
 					$found = true;
986 986
 					break;
987 987
 				}
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 
1018 1018
 			case 'select':
1019 1019
 			case 'radio':
1020
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1020
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1021 1021
 				break;
1022 1022
 
1023 1023
 			case 'post_category':
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 
1032 1032
 				foreach ( $value as $val ) {
1033 1033
 					$cat = get_term( $val, 'category' );
1034
-					$filter[] = array(
1034
+					$filter[ ] = array(
1035 1035
 						'key'      => $field_id,
1036 1036
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
1037 1037
 						'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 				$filter = array();
1051 1051
 
1052 1052
 				foreach ( $value as $val ) {
1053
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1053
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1054 1054
 				}
1055 1055
 
1056 1056
 				break;
@@ -1059,9 +1059,9 @@  discard block
 block discarded – undo
1059 1059
 				// convert checkbox on/off into the correct search filter
1060 1060
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1061 1061
 					foreach ( $form_field->inputs as $k => $input ) {
1062
-						if ( $input['id'] == $field_id ) {
1063
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1064
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1062
+						if ( $input[ 'id' ] == $field_id ) {
1063
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1064
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1065 1065
 							break;
1066 1066
 						}
1067 1067
 					}
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 					$filter = array();
1072 1072
 
1073 1073
 					foreach ( $value as $val ) {
1074
-						$filter[] = array(
1074
+						$filter[ ] = array(
1075 1075
 							'key'      => $field_id,
1076 1076
 							'value'    => $val,
1077 1077
 							'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1092,9 +1092,9 @@  discard block
 block discarded – undo
1092 1092
 					foreach ( $words as $word ) {
1093 1093
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1094 1094
 							// Keep the same key for each filter
1095
-							$filter['value'] = $word;
1095
+							$filter[ 'value' ] = $word;
1096 1096
 							// Add a search for the value
1097
-							$filters[] = $filter;
1097
+							$filters[ ] = $filter;
1098 1098
 						}
1099 1099
 					}
1100 1100
 
@@ -1108,19 +1108,19 @@  discard block
 block discarded – undo
1108 1108
 
1109 1109
 					foreach ( $searchable_fields as $searchable_field ) {
1110 1110
 
1111
-						if( $form_field->ID !== $searchable_field['field'] ) {
1111
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1112 1112
 							continue;
1113 1113
 						}
1114 1114
 
1115 1115
 						// Only exact-match dropdowns, not text search
1116
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1116
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1117 1117
 							continue;
1118 1118
 						}
1119 1119
 
1120 1120
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1121 1121
 
1122 1122
 						if ( 4 === $input_id ) {
1123
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1123
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1124 1124
 						};
1125 1125
 					}
1126 1126
 				}
@@ -1147,12 +1147,12 @@  discard block
 block discarded – undo
1147 1147
 						 * @since 1.16.3
1148 1148
 						 * Safeguard until GF implements '<=' operator
1149 1149
 						 */
1150
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1150
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1151 1151
 							$operator = '<';
1152 1152
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1153 1153
 						}
1154 1154
 
1155
-						$filter[] = array(
1155
+						$filter[ ] = array(
1156 1156
 							'key'      => $field_id,
1157 1157
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1158 1158
 							'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ),
@@ -1160,8 +1160,8 @@  discard block
 block discarded – undo
1160 1160
 					}
1161 1161
 				} else {
1162 1162
 					$date = $value;
1163
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1164
-					$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1163
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1164
+					$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1165 1165
 				}
1166 1166
 
1167 1167
 				break;
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 			'ymd_dot' => 'Y.m.d',
1193 1193
 		);
1194 1194
 
1195
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1195
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1196 1196
 			$format = $datepicker[ $field->dateFormat ];
1197 1197
 		}
1198 1198
 
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 	public function add_template_path( $file_paths ) {
1230 1230
 
1231 1231
 		// Index 100 is the default GravityView template path.
1232
-		$file_paths[102] = self::$file . 'templates/';
1232
+		$file_paths[ 102 ] = self::$file . 'templates/';
1233 1233
 
1234 1234
 		return $file_paths;
1235 1235
 	}
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 		$has_date = false;
1249 1249
 
1250 1250
 		foreach ( $search_fields as $k => $field ) {
1251
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1251
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1252 1252
 				$has_date = true;
1253 1253
 				break;
1254 1254
 			}
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
 		}
1276 1276
 
1277 1277
 		// get configured search fields
1278
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1278
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1279 1279
 
1280 1280
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1281 1281
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1291,40 +1291,40 @@  discard block
 block discarded – undo
1291 1291
 
1292 1292
 			$updated_field = $this->get_search_filter_details( $updated_field );
1293 1293
 
1294
-			switch ( $field['field'] ) {
1294
+			switch ( $field[ 'field' ] ) {
1295 1295
 
1296 1296
 				case 'search_all':
1297
-					$updated_field['key'] = 'search_all';
1298
-					$updated_field['input'] = 'search_all';
1299
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1297
+					$updated_field[ 'key' ] = 'search_all';
1298
+					$updated_field[ 'input' ] = 'search_all';
1299
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1300 1300
 					break;
1301 1301
 
1302 1302
 				case 'entry_date':
1303
-					$updated_field['key'] = 'entry_date';
1304
-					$updated_field['input'] = 'entry_date';
1305
-					$updated_field['value'] = array(
1303
+					$updated_field[ 'key' ] = 'entry_date';
1304
+					$updated_field[ 'input' ] = 'entry_date';
1305
+					$updated_field[ 'value' ] = array(
1306 1306
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1307 1307
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1308 1308
 					);
1309 1309
 					break;
1310 1310
 
1311 1311
 				case 'entry_id':
1312
-					$updated_field['key'] = 'entry_id';
1313
-					$updated_field['input'] = 'entry_id';
1314
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1312
+					$updated_field[ 'key' ] = 'entry_id';
1313
+					$updated_field[ 'input' ] = 'entry_id';
1314
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1315 1315
 					break;
1316 1316
 
1317 1317
 				case 'created_by':
1318
-					$updated_field['key'] = 'created_by';
1319
-					$updated_field['name'] = 'gv_by';
1320
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1321
-					$updated_field['choices'] = self::get_created_by_choices( $view );
1318
+					$updated_field[ 'key' ] = 'created_by';
1319
+					$updated_field[ 'name' ] = 'gv_by';
1320
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1321
+					$updated_field[ 'choices' ] = self::get_created_by_choices( $view );
1322 1322
 					break;
1323 1323
 				
1324 1324
 				case 'is_approved':
1325
-					$updated_field['key'] = 'is_approved';
1326
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1327
-					$updated_field['choices'] = self::get_is_approved_choices();
1325
+					$updated_field[ 'key' ] = 'is_approved';
1326
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1327
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1328 1328
 					break;
1329 1329
 			}
1330 1330
 
@@ -1343,16 +1343,16 @@  discard block
 block discarded – undo
1343 1343
 		 */
1344 1344
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context );
1345 1345
 
1346
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1346
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1347 1347
 
1348 1348
 		/** @since 1.14 */
1349
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1349
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1350 1350
 
1351
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1351
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1352 1352
 
1353 1353
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1354 1354
 
1355
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1355
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1356 1356
 
1357 1357
 		if ( $this->has_date_field( $search_fields ) ) {
1358 1358
 			// enqueue datepicker stuff only if needed!
@@ -1374,10 +1374,10 @@  discard block
 block discarded – undo
1374 1374
 	public static function get_search_class( $custom_class = '' ) {
1375 1375
 		$gravityview_view = GravityView_View::getInstance();
1376 1376
 
1377
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1377
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1378 1378
 
1379
-		if ( ! empty( $custom_class )  ) {
1380
-			$search_class .= ' '.$custom_class;
1379
+		if ( ! empty( $custom_class ) ) {
1380
+			$search_class .= ' ' . $custom_class;
1381 1381
 		}
1382 1382
 
1383 1383
 		/**
@@ -1421,9 +1421,9 @@  discard block
 block discarded – undo
1421 1421
 
1422 1422
 		if ( ! $label ) {
1423 1423
 
1424
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1424
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1425 1425
 
1426
-			switch( $field['field'] ) {
1426
+			switch ( $field[ 'field' ] ) {
1427 1427
 				case 'search_all':
1428 1428
 					$label = __( 'Search Entries:', 'gravityview' );
1429 1429
 					break;
@@ -1435,10 +1435,10 @@  discard block
 block discarded – undo
1435 1435
 					break;
1436 1436
 				default:
1437 1437
 					// If this is a field input, not a field
1438
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1438
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1439 1439
 
1440 1440
 						// Get the label for the field in question, which returns an array
1441
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1441
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1442 1442
 
1443 1443
 						// Get the item with the `label` key
1444 1444
 						$values = wp_list_pluck( $items, 'label' );
@@ -1477,32 +1477,32 @@  discard block
 block discarded – undo
1477 1477
 		$form = $gravityview_view->getForm();
1478 1478
 
1479 1479
 		// for advanced field ids (eg, first name / last name )
1480
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1480
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1481 1481
 
1482 1482
 		// get searched value from $_GET/$_POST (string or array)
1483 1483
 		$value = $this->rgget_or_rgpost( $name );
1484 1484
 
1485 1485
 		// get form field details
1486
-		$form_field = gravityview_get_field( $form, $field['field'] );
1486
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1487 1487
 
1488 1488
 		$filter = array(
1489
-			'key' => $field['field'],
1489
+			'key' => $field[ 'field' ],
1490 1490
 			'name' => $name,
1491 1491
 			'label' => self::get_field_label( $field, $form_field ),
1492
-			'input' => $field['input'],
1492
+			'input' => $field[ 'input' ],
1493 1493
 			'value' => $value,
1494
-			'type' => $form_field['type'],
1494
+			'type' => $form_field[ 'type' ],
1495 1495
 		);
1496 1496
 
1497 1497
 		// collect choices
1498
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1499
-			$filter['choices'] = gravityview_get_terms_choices();
1500
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1501
-			$filter['choices'] = $form_field['choices'];
1498
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1499
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1500
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1501
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1502 1502
 		}
1503 1503
 
1504
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1505
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1504
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1505
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1506 1506
 		}
1507 1507
 
1508 1508
 		return $filter;
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 			 * @param \GV\View $view The view.
1538 1538
 			 */
1539 1539
 			$text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view );
1540
-			$choices[] = array(
1540
+			$choices[ ] = array(
1541 1541
 				'value' => $user->ID,
1542 1542
 				'text' => $text,
1543 1543
 			);
@@ -1557,9 +1557,9 @@  discard block
 block discarded – undo
1557 1557
 
1558 1558
 		$choices = array();
1559 1559
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1560
-			$choices[] = array(
1561
-				'value' => $status['value'],
1562
-				'text' => $status['label'],
1560
+			$choices[ ] = array(
1561
+				'value' => $status[ 'value' ],
1562
+				'text' => $status[ 'label' ],
1563 1563
 			);
1564 1564
 		}
1565 1565
 
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 	 */
1612 1612
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1613 1613
 
1614
-		$js_dependencies[] = 'jquery-ui-datepicker';
1614
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1615 1615
 
1616 1616
 		return $js_dependencies;
1617 1617
 	}
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 			'isRTL'             => is_rtl(),
1656 1656
 		), $view_data );
1657 1657
 
1658
-		$localizations['datepicker'] = $datepicker_settings;
1658
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1659 1659
 
1660 1660
 		return $localizations;
1661 1661
 
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 	 * @return void
1683 1683
 	 */
1684 1684
 	private function maybe_enqueue_flexibility() {
1685
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1685
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1686 1686
 			wp_enqueue_script( 'gv-flexibility' );
1687 1687
 		}
1688 1688
 	}
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1705 1705
 
1706 1706
 		$scheme = is_ssl() ? 'https://' : 'http://';
1707
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1707
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1708 1708
 
1709 1709
 		/**
1710 1710
 		 * @filter `gravityview_search_datepicker_class`
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
 	public function add_preview_inputs() {
1784 1784
 		global $wp;
1785 1785
 
1786
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
1786
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
1787 1787
 			return;
1788 1788
 		}
1789 1789
 
@@ -1835,7 +1835,7 @@  discard block
 block discarded – undo
1835 1835
  */
1836 1836
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
1837 1837
 	public function __construct( $filter, $view ) {
1838
-		$this->value = $filter['value'];
1838
+		$this->value = $filter[ 'value' ];
1839 1839
 		$this->view = $view;
1840 1840
 	}
1841 1841
 
@@ -1867,11 +1867,11 @@  discard block
 block discarded – undo
1867 1867
 		$conditions = array();
1868 1868
 
1869 1869
 		foreach ( $user_fields as $user_field ) {
1870
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
1870
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
1871 1871
 		}
1872 1872
 
1873 1873
 		foreach ( $user_meta_fields as $meta_field ) {
1874
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
1874
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
1875 1875
 		}
1876 1876
 
1877 1877
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
Please login to merge, or discard this patch.