Completed
Push — develop ( ace222...9d06cc )
by Zack
15:53
created
includes/class-admin-views.php 1 patch
Spacing   +194 added lines, -194 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'), 10, 2 );
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' ), 10, 2 );
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
 
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	function suggest_support_articles( $localization_data = array() ) {
72 72
 
73
-	    if( ! gravityview()->request->is_view() ) {
73
+	    if ( ! gravityview()->request->is_view() ) {
74 74
 	        return $localization_data;
75 75
         }
76 76
 
77
-		$localization_data['suggest'] = array(
77
+		$localization_data[ 'suggest' ] = array(
78 78
             '57ef23539033602e61d4a560',
79 79
             '54c67bb9e4b0512429885513',
80 80
             '54c67bb9e4b0512429885512',
@@ -103,20 +103,20 @@  discard block
 block discarded – undo
103 103
 			return;
104 104
 		}
105 105
 
106
-		if ( ! isset( $query->query_vars['post_type'] ) ) {
106
+		if ( ! isset( $query->query_vars[ 'post_type' ] ) ) {
107 107
 			return;
108 108
 		}
109 109
 
110
-		if ( 'gravityview' !== $query->query_vars['post_type'] ) {
110
+		if ( 'gravityview' !== $query->query_vars[ 'post_type' ] ) {
111 111
 			return;
112 112
 		}
113 113
 
114
-		$form_id = (int) \GV\Utils::_GET( 'gravityview_form_id' );
114
+		$form_id = (int)\GV\Utils::_GET( 'gravityview_form_id' );
115 115
 
116 116
 		$meta_query = array();
117 117
 
118 118
 		if ( $form_id ) {
119
-			$meta_query[] = array(
119
+			$meta_query[ ] = array(
120 120
 					'key'   => '_gravityview_form_id',
121 121
 					'value' => $form_id,
122 122
 			);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		$layout_id = \GV\Utils::_GET( 'gravityview_layout' );
126 126
 
127 127
 		if ( $layout_id ) {
128
-			$meta_query[] = array(
128
+			$meta_query[ ] = array(
129 129
 					'key'   => '_gravityview_directory_template',
130 130
 					'value' => esc_attr( $layout_id ),
131 131
 			);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	public function add_view_dropdown() {
143 143
 		$current_screen = get_current_screen();
144 144
 
145
-		if( 'gravityview' !== $current_screen->post_type ) {
145
+		if ( 'gravityview' !== $current_screen->post_type ) {
146 146
 			return;
147 147
 		}
148 148
 
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 		$current_form = \GV\Utils::_GET( 'gravityview_form_id' );
151 151
 
152 152
 		// If there are no forms to select, show no forms.
153
-		if( ! empty( $forms ) ) { ?>
153
+		if ( ! empty( $forms ) ) { ?>
154 154
 			<label for="gravityview_form_id" class="screen-reader-text"><?php esc_html_e( 'Filter Views by form', 'gravityview' ); ?></label>
155 155
 			<select name="gravityview_form_id" id="gravityview_form_id">
156 156
 				<option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option>
157
-				<?php foreach( $forms as $form ) { ?>
158
-					<option value="<?php echo esc_attr( $form['id'] ); ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
157
+				<?php foreach ( $forms as $form ) { ?>
158
+					<option value="<?php echo esc_attr( $form[ 'id' ] ); ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
159 159
 				<?php } ?>
160 160
 			</select>
161 161
 		<?php }
@@ -164,26 +164,26 @@  discard block
 block discarded – undo
164 164
 		$current_layout = \GV\Utils::_GET( 'gravityview_layout' );
165 165
 
166 166
 		// If there are no forms to select, show no forms.
167
-		if( ! empty( $layouts ) ) { ?>
167
+		if ( ! empty( $layouts ) ) { ?>
168 168
 			<label for="gravityview_layout_name" class="screen-reader-text"><?php esc_html_e( 'Filter Views by layout', 'gravityview' ); ?></label>
169 169
 			<select name="gravityview_layout" id="gravityview_layout_name">
170 170
 				<option value="" <?php selected( '', $current_layout, true ); ?>><?php esc_html_e( 'All layouts', 'gravityview' ); ?></option>
171 171
 				<optgroup label="<?php esc_html_e( 'Layouts', 'gravityview' ); ?>">
172
-				<?php foreach( $layouts as $layout_id => $layout ) {
173
-					if ( in_array( $layout['type'], array( 'preset', 'internal' ), true ) ) {
172
+				<?php foreach ( $layouts as $layout_id => $layout ) {
173
+					if ( in_array( $layout[ 'type' ], array( 'preset', 'internal' ), true ) ) {
174 174
 						continue;
175 175
 					}
176 176
 					?>
177
-					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option>
177
+					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option>
178 178
 				<?php } ?>
179 179
 				</optgroup>
180 180
 				<optgroup label="<?php esc_html_e( 'Form Presets', 'gravityview' ); ?>">
181
-				<?php foreach( $layouts as $layout_id => $layout ) {
182
-					if ( ! in_array( $layout['type'], array( 'preset' ), true ) ) {
181
+				<?php foreach ( $layouts as $layout_id => $layout ) {
182
+					if ( ! in_array( $layout[ 'type' ], array( 'preset' ), true ) ) {
183 183
 						continue;
184 184
 					}
185 185
 					?>
186
-					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option>
186
+					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option>
187 187
 				<?php } ?>
188 188
 				</optgroup>
189 189
 			</select>
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) {
199 199
 		_deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' );
200
-		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id );
200
+		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id );
201 201
 	}
202 202
 
203 203
 	/**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	public static function gform_toolbar_menu( $menu_items = array(), $id = NULL ) {
220 220
 
221 221
 		// Don't show on Trashed forms
222
-		if( 'trash' === rgget( 'filter') ) {
222
+		if ( 'trash' === rgget( 'filter' ) ) {
223 223
 			return $menu_items;
224 224
 		}
225 225
 
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$priority = 0;
229 229
 
230
-		if( 'form_list' === GFForms::get_page() ) {
230
+		if ( 'form_list' === GFForms::get_page() ) {
231 231
 			$priority = 790;
232 232
         }
233 233
 
234
-		if( empty( $connected_views ) ) {
234
+		if ( empty( $connected_views ) ) {
235 235
 
236
-		    $menu_items['gravityview'] = array(
236
+		    $menu_items[ 'gravityview' ] = array(
237 237
 				'label'          => esc_attr__( 'Create a View', 'gravityview' ),
238 238
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
239 239
 				'title'          => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -249,22 +249,22 @@  discard block
 block discarded – undo
249 249
 		$sub_menu_items = array();
250 250
 		foreach ( (array)$connected_views as $view ) {
251 251
 
252
-			if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
252
+			if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
253 253
 				continue;
254 254
 			}
255 255
 
256
-			$label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
256
+			$label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
257 257
 
258
-			$sub_menu_items[] = array(
258
+			$sub_menu_items[ ] = array(
259 259
 				'label' => esc_attr( $label ),
260
-				'url' => admin_url( 'post.php?action=edit&post='.$view->ID ),
260
+				'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ),
261 261
 			);
262 262
 		}
263 263
 
264 264
 		// If there were no items added, then let's create the parent menu
265
-		if( $sub_menu_items ) {
265
+		if ( $sub_menu_items ) {
266 266
 
267
-		    $sub_menu_items[] = array(
267
+		    $sub_menu_items[ ] = array(
268 268
 			    'label' => esc_attr__( 'Create a View', 'gravityview' ),
269 269
                 'link_class' => 'gv-create-view',
270 270
 			    'icon' => '<i>&nbsp;+&nbsp;</i>',
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
 			if ( ! ( 'gf_edit_forms' === rgget( 'page' ) && '' === rgget( 'view' ) ) || version_compare( '2.5-beta', GFForms::$version, '>' ) ) {
281 281
 
282 282
 				// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
283
-				$sub_menu_items[] = array(
283
+				$sub_menu_items[ ] = array(
284 284
 					'url' => '#',
285 285
 					'label' => '',
286 286
 					'menu_class' => 'hidden',
287 287
 					'capabilities' => '',
288 288
 				);
289 289
 
290
-				$menu_items['gravityview'] = array(
290
+				$menu_items[ 'gravityview' ] = array(
291 291
 					'label'          => __( 'Connected Views', 'gravityview' ),
292 292
 					'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
293 293
 					'title'          => __( 'GravityView Views using this form as a data source', 'gravityview' ),
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 			} else {
303 303
 
304
-				$menu_items[ 'gravityview'] = array(
304
+				$menu_items[ 'gravityview' ] = array(
305 305
 					'label' => __( 'Connected Views', 'gravityview' ),
306 306
 					'url'   => '#gravityview-group-heading',
307 307
 					'icon'  => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 		$add = array( 'captcha', 'page' );
338 338
 
339 339
 		// Don't allowing editing the following values:
340
-		if( $context === 'edit' ) {
341
-			$add[] = 'post_id';
340
+		if ( $context === 'edit' ) {
341
+			$add[ ] = 'post_id';
342 342
 		}
343 343
 
344 344
 		$return = array_merge( $array, $add );
@@ -361,27 +361,27 @@  discard block
 block discarded – undo
361 361
 		foreach ( $default_args as $key => $arg ) {
362 362
 
363 363
 			// If an arg has `tooltip` defined, but it's false, don't display a tooltip
364
-			if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; }
364
+			if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; }
365 365
 
366 366
 			// By default, use `tooltip` if defined.
367
-			$tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip'];
367
+			$tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ];
368 368
 
369 369
 			// If there's no tooltip set, continue
370
-			if( empty( $tooltip ) ) {
370
+			if ( empty( $tooltip ) ) {
371 371
 				continue;
372 372
 			}
373 373
 
374 374
 			// Add the tooltip
375
-			$gv_tooltips[ 'gv_'.$key ] = array(
376
-				'title'	=> $arg['label'],
375
+			$gv_tooltips[ 'gv_' . $key ] = array(
376
+				'title'	=> $arg[ 'label' ],
377 377
 				'value'	=> $tooltip,
378 378
 			);
379 379
 
380 380
 		}
381 381
 
382
-		$gv_tooltips['gv_css_merge_tags'] = array(
383
-			'title' => __('CSS Merge Tags', 'gravityview'),
384
-			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' )
382
+		$gv_tooltips[ 'gv_css_merge_tags' ] = array(
383
+			'title' => __( 'CSS Merge Tags', 'gravityview' ),
384
+			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' )
385 385
 		);
386 386
 
387 387
 		/**
@@ -399,9 +399,9 @@  discard block
 block discarded – undo
399 399
 
400 400
 		foreach ( $gv_tooltips as $key => $tooltip ) {
401 401
 
402
-			$title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>';
402
+			$title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>';
403 403
 
404
-			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) );
404
+			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) );
405 405
 		}
406 406
 
407 407
 		return $tooltips;
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	 *
416 416
 	 * @return void
417 417
 	 */
418
-	public function add_custom_column_content( $column_name = NULL, $post_id )	{
418
+	public function add_custom_column_content( $column_name = NULL, $post_id ) {
419 419
 
420 420
 		$output = '';
421 421
 
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 				// Generate backup if label doesn't exist: `example_name` => `Example Name`
438 438
 				$template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) );
439 439
 
440
-				$output = $template ? $template['label'] : $template_id_pretty;
440
+				$output = $template ? $template[ 'label' ] : $template_id_pretty;
441 441
 
442 442
 				break;
443 443
 
@@ -478,44 +478,44 @@  discard block
 block discarded – undo
478 478
 	static public function get_connected_form_links( $form, $include_form_link = true ) {
479 479
 
480 480
 		// Either the form is empty or the form ID is 0, not yet set.
481
-		if( empty( $form ) ) {
481
+		if ( empty( $form ) ) {
482 482
 			return '';
483 483
 		}
484 484
 
485 485
 		// The $form is passed as the form ID
486
-		if( !is_array( $form ) ) {
486
+		if ( ! is_array( $form ) ) {
487 487
 			$form = gravityview_get_form( $form );
488 488
 		}
489 489
 
490
-		$form_id = $form['id'];
490
+		$form_id = $form[ 'id' ];
491 491
 		$links = array();
492 492
 
493
-		if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
493
+		if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
494 494
 			$form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;id=%d', $form_id ) );
495
-			$form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>';
496
-			$links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>';
495
+			$form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>';
496
+			$links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>';
497 497
 		} else {
498
-			$form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>';
498
+			$form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>';
499 499
 		}
500 500
 
501
-		if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
501
+		if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
502 502
 			$entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&amp;id=%d', $form_id ) );
503
-			$links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>';
503
+			$links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>';
504 504
 		}
505 505
 
506
-		if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
506
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
507 507
 			$settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=%d', $form_id ) );
508
-			$links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>';
508
+			$links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>';
509 509
 		}
510 510
 
511
-		if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) {
511
+		if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) {
512 512
 			$preview_url = site_url( sprintf( '?gf_page=preview&amp;id=%d', $form_id ) );
513
-			$links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>';
513
+			$links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>';
514 514
 		}
515 515
 
516 516
 		$output = '';
517 517
 
518
-		if( !empty( $include_form_link ) ) {
518
+		if ( ! empty( $include_form_link ) ) {
519 519
 			$output .= $form_link;
520 520
 		}
521 521
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		 */
528 528
 		$links = apply_filters( 'gravityview_connected_form_links', $links, $form );
529 529
 
530
-		$output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>';
530
+		$output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>';
531 531
 
532 532
 		return $output;
533 533
 	}
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
 		// Get the date column and save it for later to add back in.
542 542
 		// This adds it after the Data Source column.
543 543
 		// This way, we don't need to do array_slice, array_merge, etc.
544
-		$date = $columns['date'];
545
-		unset( $columns['date'] );
544
+		$date = $columns[ 'date' ];
545
+		unset( $columns[ 'date' ] );
546 546
 
547 547
 		$data_source_required_caps = array(
548 548
 			'gravityforms_edit_forms',
@@ -553,14 +553,14 @@  discard block
 block discarded – undo
553 553
 			'gravityforms_preview_forms',
554 554
 		);
555 555
 
556
-		if( GVCommon::has_cap( $data_source_required_caps ) ) {
557
-			$columns['gv_connected_form'] = __( 'Data Source', 'gravityview' );
556
+		if ( GVCommon::has_cap( $data_source_required_caps ) ) {
557
+			$columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' );
558 558
 		}
559 559
 
560
-		$columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
560
+		$columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
561 561
 
562 562
 		// Add the date back in.
563
-		$columns['date'] = $date;
563
+		$columns[ 'date' ] = $date;
564 564
 
565 565
 		return $columns;
566 566
 	}
@@ -573,12 +573,12 @@  discard block
 block discarded – undo
573 573
 	 */
574 574
 	function save_postdata( $post_id ) {
575 575
 
576
-		if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
576
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
577 577
 			return;
578 578
 		}
579 579
 
580 580
 		// validate post_type
581
-		if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) {
581
+		if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) {
582 582
 			return;
583 583
 		}
584 584
 
@@ -593,63 +593,63 @@  discard block
 block discarded – undo
593 593
 		$statii = array();
594 594
 
595 595
 		// check if this is a start fresh View
596
-		if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) {
596
+		if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) {
597 597
 
598
-			$form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : '';
598
+			$form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : '';
599 599
 			// save form id
600
-			$statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
600
+			$statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
601 601
 
602 602
 		}
603 603
 
604
-		if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) {
604
+		if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) {
605 605
 			gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) );
606 606
 			return;
607 607
 		}
608 608
 
609 609
 		// Was this a start fresh?
610
-		if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) {
611
-			$statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
610
+		if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) {
611
+			$statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
612 612
 		} else {
613
-			$statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
613
+			$statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
614 614
 		}
615 615
 
616 616
 		// Check if we have a template id
617
-		if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) {
617
+		if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) {
618 618
 
619
-			$template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : '';
619
+			$template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : '';
620 620
 
621 621
 			// now save template id
622
-			$statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
622
+			$statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
623 623
 		}
624 624
 
625 625
 
626 626
 		// save View Configuration metabox
627
-		if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) {
627
+		if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) {
628 628
 
629 629
 			// template settings
630
-			if( empty( $_POST['template_settings'] ) ) {
631
-				$_POST['template_settings'] = array();
630
+			if ( empty( $_POST[ 'template_settings' ] ) ) {
631
+				$_POST[ 'template_settings' ] = array();
632 632
 			}
633
-			$statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] );
633
+			$statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] );
634 634
 
635 635
 			// guard against unloaded View configuration page
636
-			if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) {
636
+			if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) {
637 637
 				$fields = array();
638 638
 
639
-				if ( ! empty( $_POST['gv_fields'] ) ) {
639
+				if ( ! empty( $_POST[ 'gv_fields' ] ) ) {
640 640
 					$fields = _gravityview_process_posted_fields();
641 641
 				}
642 642
 
643 643
 				$fields = wp_slash( $fields );
644 644
 
645
-				$statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
645
+				$statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
646 646
 			}
647 647
 
648 648
 			// Directory Visible Widgets
649
-			if( empty( $_POST['widgets'] ) ) {
650
-				$_POST['widgets'] = array();
649
+			if ( empty( $_POST[ 'widgets' ] ) ) {
650
+				$_POST[ 'widgets' ] = array();
651 651
 			}
652
-			$statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] );
652
+			$statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] );
653 653
 
654 654
 		} // end save view configuration
655 655
 
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		 * @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.
660 660
 		 * @since 1.17.2
661 661
 		 */
662
-		do_action('gravityview_view_saved', $post_id, $statii );
662
+		do_action( 'gravityview_view_saved', $post_id, $statii );
663 663
 
664 664
 		gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) );
665 665
 	}
@@ -704,20 +704,20 @@  discard block
 block discarded – undo
704 704
 
705 705
 		$output = '';
706 706
 
707
-		if( !empty( $fields ) ) {
707
+		if ( ! empty( $fields ) ) {
708 708
 
709
-			foreach( $fields as $id => $details ) {
709
+			foreach ( $fields as $id => $details ) {
710 710
 
711
-				if( in_array( $details['type'], (array) $blacklist_field_types ) ) {
711
+				if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) {
712 712
 					continue;
713 713
 				}
714 714
 
715 715
 				// Edit mode only allows editing the parent fields, not single inputs.
716
-				if( $context === 'edit' && ! empty( $details['parent'] ) ) {
716
+				if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) {
717 717
 					continue;
718 718
 				}
719 719
 
720
-				$output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form );
720
+				$output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form );
721 721
 
722 722
 			} // End foreach
723 723
 		}
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 		echo $output;
726 726
 
727 727
 		// For the EDIT view we only want to allow the form fields.
728
-		if( $context === 'edit' ) {
728
+		if ( $context === 'edit' ) {
729 729
 			return;
730 730
 		}
731 731
 
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 		$additional_fields = array(
745 745
 			array(
746 746
 				'label_text' => '+ ' . __( 'Add All Form Fields', 'gravityview' ),
747
-				'desc' => __('Insert all the form fields at once.', 'gravityview'),
747
+				'desc' => __( 'Insert all the form fields at once.', 'gravityview' ),
748 748
 				'field_id' => 'all-fields',
749 749
 				'label_type' => 'field',
750 750
 				'input_type' => null,
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 		 */
761 761
 		$additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields );
762 762
 
763
-		foreach ( (array) $additional_fields as $item ) {
763
+		foreach ( (array)$additional_fields as $item ) {
764 764
 
765 765
 			// Prevent items from not having index set
766 766
 			$item = wp_parse_args( $item, array(
@@ -771,16 +771,16 @@  discard block
 block discarded – undo
771 771
 				'field_options' => null,
772 772
 				'settings_html'	=> null,
773 773
 				'icon' => null,
774
-			));
774
+			) );
775 775
 
776 776
 			// Backward compat.
777
-			if( !empty( $item['field_options'] ) ) {
777
+			if ( ! empty( $item[ 'field_options' ] ) ) {
778 778
 				// Use settings_html from now on.
779
-				$item['settings_html'] = $item['field_options'];
779
+				$item[ 'settings_html' ] = $item[ 'field_options' ];
780 780
 			}
781 781
 
782 782
 			// Render a label for each of them
783
-			echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form );
783
+			echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form );
784 784
 
785 785
 		}
786 786
 
@@ -792,59 +792,59 @@  discard block
 block discarded – undo
792 792
 	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
793 793
 	 * @return array
794 794
 	 */
795
-	function get_entry_default_fields($form, $zone) {
795
+	function get_entry_default_fields( $form, $zone ) {
796 796
 
797 797
 		$entry_default_fields = array();
798 798
 
799
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
799
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
800 800
 
801 801
 			$entry_default_fields = array(
802 802
 				'id' => array(
803
-					'label' => __('Entry ID', 'gravityview'),
803
+					'label' => __( 'Entry ID', 'gravityview' ),
804 804
 					'type' => 'id',
805
-					'desc'	=> __('The unique ID of the entry.', 'gravityview'),
805
+					'desc'	=> __( 'The unique ID of the entry.', 'gravityview' ),
806 806
 				),
807 807
 				'date_created' => array(
808
-					'label' => __('Entry Date', 'gravityview'),
809
-					'desc'	=> __('The date the entry was created.', 'gravityview'),
808
+					'label' => __( 'Entry Date', 'gravityview' ),
809
+					'desc'	=> __( 'The date the entry was created.', 'gravityview' ),
810 810
 					'type' => 'date_created',
811 811
 				),
812 812
 				'date_updated' => array(
813
-						'label' => __( 'Date Updated', 'gravityview'),
814
-						'desc'	=> __('The date the entry was last updated.', 'gravityview'),
813
+						'label' => __( 'Date Updated', 'gravityview' ),
814
+						'desc'	=> __( 'The date the entry was last updated.', 'gravityview' ),
815 815
 						'type' => 'date_updated',
816 816
 				),
817 817
 				'source_url' => array(
818
-					'label' => __('Source URL', 'gravityview'),
818
+					'label' => __( 'Source URL', 'gravityview' ),
819 819
 					'type' => 'source_url',
820
-					'desc'	=> __('The URL of the page where the form was submitted.', 'gravityview'),
820
+					'desc'	=> __( 'The URL of the page where the form was submitted.', 'gravityview' ),
821 821
 				),
822 822
 				'ip' => array(
823
-					'label' => __('User IP', 'gravityview'),
823
+					'label' => __( 'User IP', 'gravityview' ),
824 824
 					'type' => 'ip',
825
-					'desc'	=> __('The IP Address of the user who created the entry.', 'gravityview'),
825
+					'desc'	=> __( 'The IP Address of the user who created the entry.', 'gravityview' ),
826 826
 				),
827 827
 				'created_by' => array(
828
-					'label' => __('User', 'gravityview'),
828
+					'label' => __( 'User', 'gravityview' ),
829 829
 					'type' => 'created_by',
830
-					'desc'	=> __('Details of the logged-in user who created the entry (if any).', 'gravityview'),
830
+					'desc'	=> __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ),
831 831
 				),
832 832
 
833 833
 				/**
834 834
 				 * @since 1.7.2
835 835
 				 */
836 836
 			    'other_entries' => array(
837
-				    'label'	=> __('Other Entries', 'gravityview'),
837
+				    'label'	=> __( 'Other Entries', 'gravityview' ),
838 838
 				    'type'	=> 'other_entries',
839
-				    'desc'	=> __('Display other entries created by the entry creator.', 'gravityview'),
839
+				    'desc'	=> __( 'Display other entries created by the entry creator.', 'gravityview' ),
840 840
 			    ),
841 841
 	        );
842 842
 
843
-			if( 'single' !== $zone) {
843
+			if ( 'single' !== $zone ) {
844 844
 
845
-				$entry_default_fields['entry_link'] = array(
846
-					'label' => __('Link to Entry', 'gravityview'),
847
-					'desc'	=> __('A dedicated link to the single entry with customizable text.', 'gravityview'),
845
+				$entry_default_fields[ 'entry_link' ] = array(
846
+					'label' => __( 'Link to Entry', 'gravityview' ),
847
+					'desc'	=> __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ),
848 848
 					'type' => 'entry_link',
849 849
 				);
850 850
 			}
@@ -854,19 +854,19 @@  discard block
 block discarded – undo
854 854
 		/**
855 855
 		 * @since  1.2
856 856
 		 */
857
-		$entry_default_fields['custom']	= array(
858
-			'label'	=> __('Custom Content', 'gravityview'),
857
+		$entry_default_fields[ 'custom' ] = array(
858
+			'label'	=> __( 'Custom Content', 'gravityview' ),
859 859
 			'type'	=> 'custom',
860
-			'desc'	=> __('Insert custom text or HTML.', 'gravityview'),
860
+			'desc'	=> __( 'Insert custom text or HTML.', 'gravityview' ),
861 861
 		);
862 862
 
863 863
 		/**
864 864
 		 * @since develop
865 865
 		 */
866
-		$entry_default_fields['sequence'] = array(
867
-			'label'	=> __('Result Number', 'gravityview'),
866
+		$entry_default_fields[ 'sequence' ] = array(
867
+			'label'	=> __( 'Result Number', 'gravityview' ),
868 868
 			'type'	=> 'sequence',
869
-			'desc'	=> __('Display a sequential result number for each entry.', 'gravityview'),
869
+			'desc'	=> __( 'Display a sequential result number for each entry.', 'gravityview' ),
870 870
 		);
871 871
 
872 872
 		/**
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 		 * @param  string|array $form form_ID or form object
876 876
 		 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
877 877
 		 */
878
-		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone);
878
+		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone );
879 879
 	}
880 880
 
881 881
 	/**
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 	 */
887 887
 	function get_available_fields( $form = '', $zone = NULL ) {
888 888
 
889
-		if( empty( $form ) ) {
889
+		if ( empty( $form ) ) {
890 890
 			gravityview()->log->error( '$form is empty' );
891 891
 			return array();
892 892
 		}
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 		$fields = gravityview_get_form_fields( $form, true );
896 896
 
897 897
 		// get meta fields ( only if form was already created )
898
-		if( !is_array( $form ) ) {
898
+		if ( ! is_array( $form ) ) {
899 899
 			$meta_fields = gravityview_get_entry_meta( $form );
900 900
 		} else {
901 901
 			$meta_fields = array();
@@ -908,14 +908,14 @@  discard block
 block discarded – undo
908 908
 		$fields = $fields + $meta_fields + $default_fields;
909 909
 
910 910
 		// Move Custom Content to top
911
-		$fields = array( 'custom' => $fields['custom'] ) + $fields;
911
+		$fields = array( 'custom' => $fields[ 'custom' ] ) + $fields;
912 912
 
913 913
 		$gv_fields = GravityView_Fields::get_all();
914 914
 
915 915
 		foreach ( $fields as &$field ) {
916 916
 			foreach ( $gv_fields as $gv_field ) {
917
-				if ( $field['type'] === $gv_field->name ) {
918
-					$field['icon'] = $gv_field->icon;
917
+				if ( $field[ 'type' ] === $gv_field->name ) {
918
+					$field[ 'icon' ] = $gv_field->icon;
919 919
 				}
920 920
 			}
921 921
 		}
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
 
939 939
 		$widgets = $this->get_registered_widgets();
940 940
 
941
-		if( !empty( $widgets ) ) {
941
+		if ( ! empty( $widgets ) ) {
942 942
 
943
-			foreach( $widgets as $id => $details ) {
943
+			foreach ( $widgets as $id => $details ) {
944 944
 
945
-				echo new GravityView_Admin_View_Widget( $details['label'], $id, $details );
945
+				echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details );
946 946
 
947 947
 			}
948 948
 		}
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
 	function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
972 972
 		global $post;
973 973
 
974
-		if( $type === 'widget' ) {
974
+		if ( $type === 'widget' ) {
975 975
 			$button_label = __( 'Add Widget', 'gravityview' );
976 976
 		} else {
977 977
 			$button_label = __( 'Add Field', 'gravityview' );
@@ -997,10 +997,10 @@  discard block
 block discarded – undo
997 997
 		$form_id = null;
998 998
 
999 999
 		// if saved values, get available fields to label everyone
1000
-		if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) {
1000
+		if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) {
1001 1001
 
1002
-			if( !empty( $_POST['template_id'] ) ) {
1003
-				$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
1002
+			if ( ! empty( $_POST[ 'template_id' ] ) ) {
1003
+				$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
1004 1004
 			} else {
1005 1005
 				$form_id = $form = gravityview_get_form_id( $post->ID );
1006 1006
 			}
@@ -1018,42 +1018,42 @@  discard block
 block discarded – undo
1018 1018
 			}
1019 1019
 		}
1020 1020
 
1021
-		foreach( $rows as $row ) :
1022
-			foreach( $row as $col => $areas ) :
1023
-				$column = ($col == '2-2') ? '1-2' : $col; ?>
1021
+		foreach ( $rows as $row ) :
1022
+			foreach ( $row as $col => $areas ) :
1023
+				$column = ( $col == '2-2' ) ? '1-2' : $col; ?>
1024 1024
 
1025 1025
 				<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
1026 1026
 
1027
-					<?php foreach( $areas as $area ) : 	?>
1027
+					<?php foreach ( $areas as $area ) : 	?>
1028 1028
 
1029
-						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
1030
-							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>">
1029
+						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
1030
+							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>">
1031 1031
 								<?php // render saved fields
1032
-								if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) {
1032
+								if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) {
1033 1033
 
1034
-									foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) {
1034
+									foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) {
1035 1035
 
1036 1036
 										// Maybe has a form ID
1037
-										$form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id'];
1037
+										$form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ];
1038 1038
 
1039 1039
 										$input_type = NULL;
1040 1040
 
1041 1041
 										if ( $form_id ) {
1042
-											$original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ;
1042
+											$original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false;
1043 1043
                                         } else {
1044
-											$original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ;
1044
+											$original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false;
1045 1045
                                         }
1046 1046
 
1047
-										if ( !$original_item ) {
1048
-											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 ) ) );
1047
+										if ( ! $original_item ) {
1048
+											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 ) ) );
1049 1049
 
1050 1050
 											$original_item = $field;
1051 1051
 										} else {
1052
-											$input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL;
1052
+											$input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL;
1053 1053
 										}
1054 1054
 
1055 1055
 										// Field options dialog box
1056
-										$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 );
1056
+										$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 );
1057 1057
 
1058 1058
 										$item = array(
1059 1059
 											'input_type' => $input_type,
@@ -1066,22 +1066,22 @@  discard block
 block discarded – undo
1066 1066
 											$item = wp_parse_args( $item, $original_item );
1067 1067
 										}
1068 1068
 
1069
-										switch( $type ) {
1069
+										switch ( $type ) {
1070 1070
 											case 'widget':
1071
-												echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field );
1071
+												echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field );
1072 1072
 												break;
1073 1073
 											default:
1074
-												echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id );
1074
+												echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id );
1075 1075
 										}
1076 1076
 									}
1077 1077
 
1078 1078
 								} // End if zone is not empty ?>
1079 1079
 
1080
-								<span class="drop-message"><?php echo sprintf( esc_html__('"+ %s" or drag existing %ss here.', 'gravityview'), esc_html( $button_label ), esc_html( $type ) ); ?></span>
1080
+								<span class="drop-message"><?php echo sprintf( esc_html__( '"+ %s" or drag existing %ss here.', 'gravityview' ), esc_html( $button_label ), esc_html( $type ) ); ?></span>
1081 1081
 							</div>
1082 1082
 							<div class="gv-droppable-area-action">
1083
-								<button 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 ); ?></button>
1084
-								<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>
1083
+								<button 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 ); ?></button>
1084
+								<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>
1085 1085
 							</div>
1086 1086
 						</div>
1087 1087
 
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
 				// This is a new View, prefill the widgets
1110 1110
 				$widgets = array(
1111 1111
 					'header_top' => array(
1112
-						substr( md5( microtime( true ) ), 0, 13 ) => array (
1112
+						substr( md5( microtime( true ) ), 0, 13 ) => array(
1113 1113
 							'id' => 'search_bar',
1114 1114
 							'label' => __( 'Search Bar', 'gravityview' ),
1115 1115
 							'search_layout' => 'horizontal',
@@ -1184,12 +1184,12 @@  discard block
 block discarded – undo
1184 1184
 		if ( $post ) {
1185 1185
 			$source_form_id = gravityview_get_form_id( $post->ID );
1186 1186
 			if ( $source_form_id ) {
1187
-				$form_ids[] = $source_form_id;
1187
+				$form_ids[ ] = $source_form_id;
1188 1188
 			}
1189 1189
 
1190 1190
 			$joined_forms = \GV\View::get_joined_forms( $post->ID );
1191 1191
 			foreach ( $joined_forms as $joined_form ) {
1192
-				$form_ids[] = $joined_form->ID;
1192
+				$form_ids[ ] = $joined_form->ID;
1193 1193
 			}
1194 1194
 		}
1195 1195
 		foreach ( array_unique( $form_ids ) as $form_id ) {
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
 	 * @return string HTML of the active areas
1224 1224
 	 */
1225 1225
 	function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) {
1226
-		if( empty( $template_id ) ) {
1226
+		if ( empty( $template_id ) ) {
1227 1227
 			gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) );
1228 1228
 			return '';
1229 1229
 		}
@@ -1237,12 +1237,12 @@  discard block
 block discarded – undo
1237 1237
 		 */
1238 1238
 		$template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context );
1239 1239
 
1240
-		if( empty( $template_areas ) ) {
1240
+		if ( empty( $template_areas ) ) {
1241 1241
 
1242 1242
 			gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) );
1243 1243
 			$output = '<div>';
1244
-			$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>';
1245
-			$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>';
1244
+			$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>';
1245
+			$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>';
1246 1246
 			$output .= '</div>';
1247 1247
 		} else {
1248 1248
 
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 
1258 1258
 		}
1259 1259
 
1260
-		if( $echo ) {
1260
+		if ( $echo ) {
1261 1261
 			echo $output;
1262 1262
 		}
1263 1263
 
@@ -1285,30 +1285,30 @@  discard block
 block discarded – undo
1285 1285
 		}
1286 1286
 
1287 1287
 		// Add the GV font (with the Astronaut)
1288
-        wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version );
1288
+        wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version );
1289 1289
 		wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version );
1290 1290
 
1291
-		wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true );
1291
+		wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true );
1292 1292
 
1293
-		if( GFForms::get_page() === 'form_list' ) {
1293
+		if ( GFForms::get_page() === 'form_list' ) {
1294 1294
 			wp_enqueue_style( 'gravityview_views_styles' );
1295 1295
 			return;
1296 1296
         }
1297 1297
 
1298 1298
 		// Don't process any scripts below here if it's not a GravityView page.
1299
-		if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) {
1299
+		if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) {
1300 1300
 		    return;
1301 1301
 		}
1302 1302
 
1303 1303
         wp_enqueue_script( 'jquery-ui-datepicker' );
1304
-        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version );
1304
+        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version );
1305 1305
 
1306 1306
         // Enqueue scripts
1307 1307
         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 );
1308 1308
 
1309
-        wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1309
+        wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array(
1310 1310
             'cookiepath' => COOKIEPATH,
1311
-            'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ),
1311
+            'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ),
1312 1312
             'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1313 1313
             'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1314 1314
             'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ),
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
             'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1324 1324
             'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1325 1325
             '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' ),
1326
-        ));
1326
+        ) );
1327 1327
 
1328 1328
 		wp_enqueue_style( 'gravityview_views_styles' );
1329 1329
 
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 		);
1351 1351
 
1352 1352
 		if ( wp_is_mobile() ) {
1353
-		    $scripts[] = 'jquery-touch-punch';
1353
+		    $scripts[ ] = 'jquery-touch-punch';
1354 1354
 		}
1355 1355
 
1356 1356
 		wp_enqueue_script( $scripts );
Please login to merge, or discard this patch.