Completed
Push — master ( af77e8...7d9d07 )
by Zack
11s
created
includes/class-admin-approve-entries.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		/** gf_entries page - entries table screen */
45 45
 
46 46
 		// capture bulk actions
47
-		add_action( 'gform_loaded', array( $this, 'process_bulk_action') );
47
+		add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) );
48 48
 
49 49
 		// add hidden field with approve status
50 50
 		add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
53 53
 
54 54
 		// adding styles and scripts
55
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
55
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
56 56
 		// bypass Gravity Forms no-conflict mode
57 57
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
58 58
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		 * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them.
82 82
 		 * @param array $form GF Form object of current form
83 83
 		 */
84
-		if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
84
+		if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
85 85
 			return $filter_links;
86 86
 		}
87 87
 
@@ -102,19 +102,19 @@  discard block
 block discarded – undo
102 102
 		$approved_count = $disapproved_count = 0;
103 103
 
104 104
 		// Only count if necessary
105
-		if( $include_counts ) {
106
-			$approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
107
-			$disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
105
+		if ( $include_counts ) {
106
+			$approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
107
+			$disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
108 108
 		}
109 109
 
110
-		$filter_links[] = array(
110
+		$filter_links[ ] = array(
111 111
 			'id'            => 'gv_approved',
112 112
 			'field_filters' => $field_filters_approved,
113 113
 			'count'         => $approved_count,
114 114
 			'label'         => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ),
115 115
 		);
116 116
 
117
-		$filter_links[] = array(
117
+		$filter_links[ ] = array(
118 118
 			'id'            => 'gv_disapproved',
119 119
 			'field_filters' => $field_filters_disapproved,
120 120
 			'count'         => $disapproved_count,
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	function tooltips( $tooltips ) {
135 135
 
136
-		$tooltips['form_gravityview_fields'] = array(
137
-			'title' => __('GravityView Fields', 'gravityview'),
138
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
136
+		$tooltips[ 'form_gravityview_fields' ] = array(
137
+			'title' => __( 'GravityView Fields', 'gravityview' ),
138
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
139 139
 		);
140 140
 
141 141
 		return $tooltips;
@@ -246,15 +246,15 @@  discard block
 block discarded – undo
246 246
 
247 247
 		$gv_bulk_action = false;
248 248
 
249
-		if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
250
-			$bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2');
249
+		if ( version_compare( GFForms::$version, '2.0', '>=' ) ) {
250
+			$bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' );
251 251
 		} else {
252 252
 			// GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
253
-			$bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2');
253
+			$bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' );
254 254
 		}
255 255
 
256 256
 		// Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
257
-		if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
257
+		if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) {
258 258
 			$gv_bulk_action = $bulk_action;
259 259
 		}
260 260
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		
280 280
 		// gforms_entry_list is the nonce that confirms we're on the right page
281 281
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
282
-		if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) {
282
+		if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
283 283
 
284 284
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
285 285
 
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
 			}
298 298
 
299 299
 			// All entries are set to be updated, not just the visible ones
300
-			if ( ! empty( $_POST['all_entries'] ) ) {
300
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
301 301
 
302 302
 				// Convert the current entry search into GF-formatted search criteria
303 303
 				$search = array(
304
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
305
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
306
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
304
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
305
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
306
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
307 307
 				);
308 308
 
309 309
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 			} else {
315 315
 
316 316
 				// Changed from 'lead' to 'entry' in 2.0
317
-				$entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
317
+				$entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ];
318 318
 
319 319
 			}
320 320
 
@@ -326,15 +326,15 @@  discard block
 block discarded – undo
326 326
 			$entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
327 327
 
328 328
 			switch ( $approved_status ) {
329
-				case $this->bulk_action_prefixes['approve']:
329
+				case $this->bulk_action_prefixes[ 'approve' ]:
330 330
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id );
331 331
 					$this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
332 332
 					break;
333
-				case $this->bulk_action_prefixes['unapprove']:
333
+				case $this->bulk_action_prefixes[ 'unapprove' ]:
334 334
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id );
335 335
 					$this->bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count );
336 336
 					break;
337
-				case $this->bulk_action_prefixes['disapprove']:
337
+				case $this->bulk_action_prefixes[ 'disapprove' ]:
338 338
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id );
339 339
 					$this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
340 340
 					break;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
      *
357 357
 	 * @return boolean True: It worked; False: it failed
358 358
 	 */
359
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
359
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
360 360
 		return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn );
361 361
 	}
362 362
 
@@ -386,20 +386,20 @@  discard block
 block discarded – undo
386 386
 	 *
387 387
 	 * @return void
388 388
 	 */
389
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
389
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
390 390
 
391
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
391
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
392 392
 			return;
393 393
 		}
394 394
 
395
-		if( empty( $entry['id'] ) ) {
395
+		if ( empty( $entry[ 'id' ] ) ) {
396 396
 			return;
397 397
 		}
398 398
 
399 399
 		$status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' );
400 400
 
401
-		if( $status_value ) {
402
-			echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />';
401
+		if ( $status_value ) {
402
+			echo '<input type="hidden" class="entry_approval" id="entry_approved_' . $entry[ 'id' ] . '" value="' . esc_attr( $status_value ) . '" />';
403 403
 		}
404 404
 	}
405 405
 
@@ -412,10 +412,10 @@  discard block
 block discarded – undo
412 412
 	 */
413 413
 	private function get_form_id() {
414 414
 
415
-		$form_id = GFForms::get('id');
415
+		$form_id = GFForms::get( 'id' );
416 416
 
417 417
 		// If there are no forms identified, use the first form. That's how GF does it.
418
-		if( empty( $form_id ) && class_exists('RGFormsModel') ) {
418
+		if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
419 419
 			$form_id = $this->get_first_form_id();
420 420
 		}
421 421
 
@@ -435,14 +435,14 @@  discard block
 block discarded – undo
435 435
 
436 436
 		$forms = RGFormsModel::get_forms( null, 'title' );
437 437
 
438
-		if( ! isset( $forms[0] ) ) {
438
+		if ( ! isset( $forms[ 0 ] ) ) {
439 439
 			do_action( 'gravityview_log_error', __METHOD__ . ': No forms were found' );
440 440
 			return 0;
441 441
 		}
442 442
 
443
-		$first_form = $forms[0];
443
+		$first_form = $forms[ 0 ];
444 444
 
445
-		$form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id'];
445
+		$form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ];
446 446
 
447 447
 		return intval( $form_id );
448 448
 	}
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 
451 451
 	function add_scripts_and_styles( $hook ) {
452 452
 
453
-		if( ! class_exists( 'GFForms' ) ) {
453
+		if ( ! class_exists( 'GFForms' ) ) {
454 454
 
455 455
 			do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] GFForms does not exist.' );
456 456
 
@@ -459,26 +459,26 @@  discard block
 block discarded – undo
459 459
 
460 460
 		// enqueue styles & scripts gf_entries
461 461
 		// But only if we're on the main Entries page, not on reports pages
462
-		if( GFForms::get_page() !== 'entry_list' ) {
462
+		if ( GFForms::get_page() !== 'entry_list' ) {
463 463
 			return;
464 464
 		}
465 465
 
466 466
 		$form_id = $this->get_form_id();
467 467
 
468 468
 		// Things are broken; no forms were found
469
-		if( empty( $form_id ) ) {
469
+		if ( empty( $form_id ) ) {
470 470
 			return;
471 471
 		}
472 472
 
473
-		wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
473
+		wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
474 474
 
475
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
475
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
476 476
 
477
-		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
477
+		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
478 478
 
479 479
 		wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
480
-			'nonce' => wp_create_nonce( 'gravityview_entry_approval'),
481
-			'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval'),
480
+			'nonce' => wp_create_nonce( 'gravityview_entry_approval' ),
481
+			'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval' ),
482 482
 			'form_id' => $form_id,
483 483
 			'show_column' => (int)$this->show_approve_entry_column( $form_id ),
484 484
 			'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
@@ -487,10 +487,10 @@  discard block
 block discarded – undo
487 487
 			'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED,
488 488
 			'bulk_actions' => $this->get_bulk_actions( $form_id ),
489 489
 			'bulk_message' => $this->bulk_update_message,
490
-			'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'),
491
-            'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'),
492
-			'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'),
493
-			'column_title' => __( 'Show entry in directory view?', 'gravityview'),
490
+			'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'unapproved' ),
491
+            'approve_title' => GravityView_Entry_Approval_Status::get_title_attr( 'disapproved' ),
492
+			'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'approved' ),
493
+			'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
494 494
 			'column_link' => esc_url( $this->get_sort_link( $form_id ) ),
495 495
 		) );
496 496
 
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
 
511 511
 		$approved_column_id = self::get_approved_column( $form_id );
512 512
 
513
-		if( ! $approved_column_id ) {
513
+		if ( ! $approved_column_id ) {
514 514
 		    return '';
515 515
         }
516 516
 
517
-	    $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc';
517
+	    $order = ( 'desc' === rgget( 'order' ) ) ? 'asc' : 'desc';
518 518
 
519 519
 	    $args = array(
520 520
 		    'orderby' => $approved_column_id,
@@ -540,16 +540,16 @@  discard block
 block discarded – undo
540 540
 		$bulk_actions = array(
541 541
 			'GravityView' => array(
542 542
 				array(
543
-					'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'),
544
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ),
543
+					'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ),
544
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ),
545 545
 				),
546 546
 				array(
547
-					'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'),
548
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['disapprove'], $form_id ),
547
+					'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ),
548
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'disapprove' ], $form_id ),
549 549
 				),
550 550
 				array(
551
-					'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'),
552
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ),
551
+					'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ),
552
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ),
553 553
 				),
554 554
 			),
555 555
 		);
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 		// Sanitize the values, just to be sure.
567 567
 		foreach ( $bulk_actions as $key => $group ) {
568 568
 			foreach ( $group as $i => $action ) {
569
-				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
570
-				$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
569
+				$bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] );
570
+				$bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] );
571 571
 			}
572 572
 		}
573 573
 
@@ -592,13 +592,13 @@  discard block
 block discarded – undo
592 592
 		 * @since 1.7.2
593 593
 		 * @param boolean $hide_if_no_connections
594 594
 		 */
595
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
595
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
596 596
 
597
-		if( $hide_if_no_connections ) {
597
+		if ( $hide_if_no_connections ) {
598 598
 
599 599
 			$connected_views = gravityview_get_connected_views( $form_id );
600 600
 
601
-			if( empty( $connected_views ) ) {
601
+			if ( empty( $connected_views ) ) {
602 602
 				$show_approve_column = false;
603 603
 			}
604 604
 		}
@@ -608,18 +608,18 @@  discard block
 block discarded – undo
608 608
 		 * @param boolean $show_approve_column Whether the column will be shown
609 609
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
610 610
 		 */
611
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
611
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
612 612
 
613 613
 		return $show_approve_column;
614 614
 	}
615 615
 
616 616
 	function register_gform_noconflict_script( $scripts ) {
617
-		$scripts[] = 'gravityview_gf_entries_scripts';
617
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
618 618
 		return $scripts;
619 619
 	}
620 620
 
621 621
 	function register_gform_noconflict_style( $styles ) {
622
-		$styles[] = 'gravityview_entries_list';
622
+		$styles[ ] = 'gravityview_entries_list';
623 623
 		return $styles;
624 624
 	}
625 625
 
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 				'type' => 'radio',
64 64
 				'full_width' => true,
65 65
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
66
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
66
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
67 67
 				'value' => 'any',
68 68
 				'class' => 'hide-if-js',
69 69
 				'options' => array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 		// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
87 87
 		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
88
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
88
+		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
89 89
 		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
90 90
 
91 91
 		// ajax - get the searchable fields
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
222 222
 		$script_source = empty( $script_min ) ? '/source' : '';
223 223
 
224
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version );
224
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version );
225 225
 
226 226
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
227 227
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
244 244
 	 */
245 245
 	public function register_no_conflict( $allowed ) {
246
-		$allowed[] = 'gravityview_searchwidget_admin';
246
+		$allowed[ ] = 'gravityview_searchwidget_admin';
247 247
 		return $allowed;
248 248
 	}
249 249
 
@@ -256,24 +256,24 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	public static function get_searchable_fields() {
258 258
 
259
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
259
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
260 260
 			exit( '0' );
261 261
 		}
262 262
 
263 263
 		$form = '';
264 264
 
265 265
 		// Fetch the form for the current View
266
-		if ( ! empty( $_POST['view_id'] ) ) {
266
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
267 267
 
268
-			$form = gravityview_get_form_id( $_POST['view_id'] );
268
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
269 269
 
270
-		} elseif ( ! empty( $_POST['formid'] ) ) {
270
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
271 271
 
272
-			$form = (int) $_POST['formid'];
272
+			$form = (int)$_POST[ 'formid' ];
273 273
 
274
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
274
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
275 275
 
276
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
276
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
277 277
 
278 278
 		}
279 279
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 			)
319 319
 		);
320 320
 
321
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
322
-			$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'] );
321
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
322
+			$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' ] );
323 323
 		}
324 324
 
325 325
 		// Get fields with sub-inputs and no parent
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
 
342 342
 			foreach ( $fields as $id => $field ) {
343 343
 
344
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
344
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
345 345
 					continue;
346 346
 				}
347 347
 
348
-				$types = self::get_search_input_types( $id, $field['type'] );
348
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
349 349
 
350
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
350
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
351 351
 			}
352 352
 		}
353 353
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
371 371
 
372 372
 		// @todo - This needs to be improved - many fields have . including products and addresses
373
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
373
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
374 374
 			$input_type = 'boolean'; // on/off checkbox
375 375
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
376 376
 			$input_type = 'multi'; //multiselect
@@ -414,19 +414,19 @@  discard block
 block discarded – undo
414 414
 			$post_id = 0;
415 415
 
416 416
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
417
-			if ( ! empty( $widget_args['post_id'] ) ) {
418
-				$post_id = absint( $widget_args['post_id'] );
417
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
418
+				$post_id = absint( $widget_args[ 'post_id' ] );
419 419
 			}
420 420
 			// We're in the WordPress Widget context, and the base View ID should be used
421
-			else if ( ! empty( $widget_args['view_id'] ) ) {
422
-				$post_id = absint( $widget_args['view_id'] );
421
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
422
+				$post_id = absint( $widget_args[ 'view_id' ] );
423 423
 			}
424 424
 
425 425
 			$args = gravityview_get_permalink_query_args( $post_id );
426 426
 
427 427
 			// Add hidden fields to the search form
428 428
 			foreach ( $args as $key => $value ) {
429
-				$search_fields[] = array(
429
+				$search_fields[ ] = array(
430 430
 					'name'  => $key,
431 431
 					'input' => 'hidden',
432 432
 					'value' => $value,
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	public function filter_entries( $search_criteria ) {
449 449
 
450
-		if( 'post' === $this->search_method ) {
450
+		if ( 'post' === $this->search_method ) {
451 451
 			$get = $_POST;
452 452
 		} else {
453 453
 			$get = $_GET;
@@ -464,12 +464,12 @@  discard block
 block discarded – undo
464 464
 		$get = gv_map_deep( $get, 'rawurldecode' );
465 465
 
466 466
 		// Make sure array key is set up
467
-		$search_criteria['field_filters'] = rgar( $search_criteria, 'field_filters', array() );
467
+		$search_criteria[ 'field_filters' ] = rgar( $search_criteria, 'field_filters', array() );
468 468
 
469 469
 		// add free search
470
-		if ( ! empty( $get['gv_search'] ) ) {
470
+		if ( ! empty( $get[ 'gv_search' ] ) ) {
471 471
 
472
-			$search_all_value = trim( $get['gv_search'] );
472
+			$search_all_value = trim( $get[ 'gv_search' ] );
473 473
 
474 474
 			/**
475 475
 			 * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase?
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 			 */
479 479
 			$split_words = apply_filters( 'gravityview/search-all-split-words', true );
480 480
 
481
-			if( $split_words ) {
481
+			if ( $split_words ) {
482 482
 
483 483
 				// Search for a piece
484 484
 				$words = explode( ' ', $search_all_value );
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 			}
495 495
 
496 496
 			foreach ( $words as $word ) {
497
-				$search_criteria['field_filters'][] = array(
497
+				$search_criteria[ 'field_filters' ][ ] = array(
498 498
 					'key' => null, // The field ID to search
499 499
 					'value' => $word, // The value to search
500 500
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
 		}
504 504
 
505 505
 		//start date & end date
506
-		$curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : '';
507
-		$curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : '';
506
+		$curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '';
507
+		$curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : '';
508 508
 
509 509
 		/**
510 510
 		 * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n
@@ -519,16 +519,16 @@  discard block
 block discarded – undo
519 519
 		/**
520 520
 		 * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries)
521 521
 		 */
522
-		if( !empty( $curr_start ) ) {
523
-			$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
522
+		if ( ! empty( $curr_start ) ) {
523
+			$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
524 524
 		}
525
-		if( !empty( $curr_end ) ) {
526
-			$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
525
+		if ( ! empty( $curr_end ) ) {
526
+			$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
527 527
 		}
528 528
 
529 529
 		// search for a specific entry ID
530 530
 		if ( ! empty( $get[ 'gv_id' ] ) ) {
531
-			$search_criteria['field_filters'][] = array(
531
+			$search_criteria[ 'field_filters' ][ ] = array(
532 532
 				'key' => 'id',
533 533
 				'value' => absint( $get[ 'gv_id' ] ),
534 534
 				'operator' => '=',
@@ -537,36 +537,36 @@  discard block
 block discarded – undo
537 537
 
538 538
 		// search for a specific Created_by ID
539 539
 		if ( ! empty( $get[ 'gv_by' ] ) ) {
540
-			$search_criteria['field_filters'][] = array(
540
+			$search_criteria[ 'field_filters' ][ ] = array(
541 541
 				'key' => 'created_by',
542
-				'value' => absint( $get['gv_by'] ),
542
+				'value' => absint( $get[ 'gv_by' ] ),
543 543
 				'operator' => '=',
544 544
 			);
545 545
 		}
546 546
 
547 547
 
548 548
 		// Get search mode passed in URL
549
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
549
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
550 550
 
551 551
 		// get the other search filters
552 552
 		foreach ( $get as $key => $value ) {
553 553
 
554
-			if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) {
554
+			if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) {
555 555
 				continue;
556 556
 			}
557 557
 
558 558
 			// could return simple filter or multiple filters
559 559
 			$filter = $this->prepare_field_filter( $key, $value );
560 560
 
561
-			if ( isset( $filter[0]['value'] ) ) {
562
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
561
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
562
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
563 563
 
564 564
 				// if date range type, set search mode to ALL
565
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
565
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
566 566
 					$mode = 'all';
567 567
 				}
568
-			} elseif( !empty( $filter ) ) {
569
-				$search_criteria['field_filters'][] = $filter;
568
+			} elseif ( ! empty( $filter ) ) {
569
+				$search_criteria[ 'field_filters' ][ ] = $filter;
570 570
 			}
571 571
 		}
572 572
 
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		 * @since 1.5.1
576 576
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
577 577
 		 */
578
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
578
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
579 579
 
580 580
 		do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria );
581 581
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		$field_id = str_replace( 'filter_', '', $key );
602 602
 
603 603
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
604
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
604
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
605 605
 			$field_id = str_replace( '_', '.', $field_id );
606 606
 		}
607 607
 
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
 			'value' => $value,
616 616
 		);
617 617
 
618
-		switch ( $form_field['type'] ) {
618
+		switch ( $form_field[ 'type' ] ) {
619 619
 
620 620
 			case 'select':
621 621
 			case 'radio':
622
-				$filter['operator'] = 'is';
622
+				$filter[ 'operator' ] = 'is';
623 623
 				break;
624 624
 
625 625
 			case 'post_category':
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
 				foreach ( $value as $val ) {
635 635
 					$cat = get_term( $val, 'category' );
636
-					$filter[] = array(
636
+					$filter[ ] = array(
637 637
 						'key' => $field_id,
638 638
 						'value' => esc_attr( $cat->name ) . ':' . $val,
639 639
 						'operator' => 'is',
@@ -652,18 +652,18 @@  discard block
 block discarded – undo
652 652
 				$filter = array();
653 653
 
654 654
 				foreach ( $value as $val ) {
655
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
655
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
656 656
 				}
657 657
 
658 658
 				break;
659 659
 
660 660
 			case 'checkbox':
661 661
 				// convert checkbox on/off into the correct search filter
662
-				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) {
663
-					foreach ( $form_field['inputs'] as $k => $input ) {
664
-						if ( $input['id'] == $field_id ) {
665
-							$filter['value'] = $form_field['choices'][ $k ]['value'];
666
-							$filter['operator'] = 'is';
662
+				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) {
663
+					foreach ( $form_field[ 'inputs' ] as $k => $input ) {
664
+						if ( $input[ 'id' ] == $field_id ) {
665
+							$filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ];
666
+							$filter[ 'operator' ] = 'is';
667 667
 							break;
668 668
 						}
669 669
 					}
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 					$filter = array();
674 674
 
675 675
 					foreach ( $value as $val ) {
676
-						$filter[] = array(
676
+						$filter[ ] = array(
677 677
 							'key'   => $field_id,
678 678
 							'value' => $val,
679 679
 							'operator' => 'is',
@@ -694,9 +694,9 @@  discard block
 block discarded – undo
694 694
 					foreach ( $words as $word ) {
695 695
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
696 696
 							// Keep the same key for each filter
697
-							$filter['value'] = $word;
697
+							$filter[ 'value' ] = $word;
698 698
 							// Add a search for the value
699
-							$filters[] = $filter;
699
+							$filters[ ] = $filter;
700 700
 						}
701 701
 					}
702 702
 
@@ -723,19 +723,19 @@  discard block
 block discarded – undo
723 723
 						 * @since 1.16.3
724 724
 						 * Safeguard until GF implements '<=' operator
725 725
 						 */
726
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
726
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
727 727
 							$operator = '<';
728 728
 							$date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) );
729 729
 						}
730 730
 
731
-						$filter[] = array(
731
+						$filter[ ] = array(
732 732
 							'key' => $field_id,
733 733
 							'value' => self::get_formatted_date( $date, 'Y-m-d' ),
734 734
 							'operator' => $operator,
735 735
 						);
736 736
 					}
737 737
 				} else {
738
-					$filter['value'] = self::get_formatted_date( $value, 'Y-m-d' );
738
+					$filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' );
739 739
 				}
740 740
 
741 741
 				break;
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 			'ymd_dot' => 'Y.m.d',
767 767
 		);
768 768
 
769
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
769
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
770 770
 			$format = $datepicker[ $field->dateFormat ];
771 771
 		}
772 772
 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	public function add_template_path( $file_paths ) {
798 798
 
799 799
 		// Index 100 is the default GravityView template path.
800
-		$file_paths[102] = self::$file . 'templates/';
800
+		$file_paths[ 102 ] = self::$file . 'templates/';
801 801
 
802 802
 		return $file_paths;
803 803
 	}
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 		$has_date = false;
817 817
 
818 818
 		foreach ( $search_fields as $k => $field ) {
819
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
819
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
820 820
 				$has_date = true;
821 821
 				break;
822 822
 			}
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 		}
844 844
 
845 845
 		// get configured search fields
846
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
846
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
847 847
 
848 848
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
849 849
 			do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args );
@@ -858,34 +858,34 @@  discard block
 block discarded – undo
858 858
 
859 859
 			$updated_field = $this->get_search_filter_details( $updated_field );
860 860
 
861
-			switch ( $field['field'] ) {
861
+			switch ( $field[ 'field' ] ) {
862 862
 
863 863
 				case 'search_all':
864
-					$updated_field['key'] = 'search_all';
865
-					$updated_field['input'] = 'search_all';
866
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
864
+					$updated_field[ 'key' ] = 'search_all';
865
+					$updated_field[ 'input' ] = 'search_all';
866
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
867 867
 					break;
868 868
 
869 869
 				case 'entry_date':
870
-					$updated_field['key'] = 'entry_date';
871
-					$updated_field['input'] = 'entry_date';
872
-					$updated_field['value'] = array(
870
+					$updated_field[ 'key' ] = 'entry_date';
871
+					$updated_field[ 'input' ] = 'entry_date';
872
+					$updated_field[ 'value' ] = array(
873 873
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
874 874
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
875 875
 					);
876 876
 					break;
877 877
 
878 878
 				case 'entry_id':
879
-					$updated_field['key'] = 'entry_id';
880
-					$updated_field['input'] = 'entry_id';
881
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
879
+					$updated_field[ 'key' ] = 'entry_id';
880
+					$updated_field[ 'input' ] = 'entry_id';
881
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
882 882
 					break;
883 883
 
884 884
 				case 'created_by':
885
-					$updated_field['key'] = 'created_by';
886
-					$updated_field['name'] = 'gv_by';
887
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
888
-					$updated_field['choices'] = self::get_created_by_choices();
885
+					$updated_field[ 'key' ] = 'created_by';
886
+					$updated_field[ 'name' ] = 'gv_by';
887
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
888
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
889 889
 					break;
890 890
 			}
891 891
 
@@ -903,16 +903,16 @@  discard block
 block discarded – undo
903 903
 		 */
904 904
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args );
905 905
 
906
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
906
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
907 907
 
908 908
 		/** @since 1.14 */
909
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
909
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
910 910
 
911
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
911
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
912 912
 
913 913
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
914 914
 
915
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
915
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
916 916
 
917 917
 		if ( $this->has_date_field( $search_fields ) ) {
918 918
 			// enqueue datepicker stuff only if needed!
@@ -934,10 +934,10 @@  discard block
 block discarded – undo
934 934
 	public static function get_search_class( $custom_class = '' ) {
935 935
 		$gravityview_view = GravityView_View::getInstance();
936 936
 
937
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
937
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
938 938
 
939
-		if ( ! empty( $custom_class )  ) {
940
-			$search_class .= ' '.$custom_class;
939
+		if ( ! empty( $custom_class ) ) {
940
+			$search_class .= ' ' . $custom_class;
941 941
 		}
942 942
 
943 943
 		/**
@@ -979,11 +979,11 @@  discard block
 block discarded – undo
979 979
 
980 980
 		$label = rgget( 'label', $field );
981 981
 
982
-		if( '' === $label ) {
982
+		if ( '' === $label ) {
983 983
 
984
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
984
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
985 985
 
986
-			switch( $field['field'] ) {
986
+			switch ( $field[ 'field' ] ) {
987 987
 				case 'search_all':
988 988
 					$label = __( 'Search Entries:', 'gravityview' );
989 989
 					break;
@@ -995,10 +995,10 @@  discard block
 block discarded – undo
995 995
 					break;
996 996
 				default:
997 997
 					// If this is a field input, not a field
998
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
998
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
999 999
 
1000 1000
 						// Get the label for the field in question, which returns an array
1001
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1001
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1002 1002
 
1003 1003
 						// Get the item with the `label` key
1004 1004
 						$values = wp_list_pluck( $items, 'label' );
@@ -1037,32 +1037,32 @@  discard block
 block discarded – undo
1037 1037
 		$form = $gravityview_view->getForm();
1038 1038
 
1039 1039
 		// for advanced field ids (eg, first name / last name )
1040
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1040
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1041 1041
 
1042 1042
 		// get searched value from $_GET/$_POST (string or array)
1043 1043
 		$value = $this->rgget_or_rgpost( $name );
1044 1044
 
1045 1045
 		// get form field details
1046
-		$form_field = gravityview_get_field( $form, $field['field'] );
1046
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1047 1047
 
1048 1048
 		$filter = array(
1049
-			'key' => $field['field'],
1049
+			'key' => $field[ 'field' ],
1050 1050
 			'name' => $name,
1051 1051
 			'label' => self::get_field_label( $field, $form_field ),
1052
-			'input' => $field['input'],
1052
+			'input' => $field[ 'input' ],
1053 1053
 			'value' => $value,
1054
-			'type' => $form_field['type'],
1054
+			'type' => $form_field[ 'type' ],
1055 1055
 		);
1056 1056
 
1057 1057
 		// collect choices
1058
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1059
-			$filter['choices'] = gravityview_get_terms_choices();
1060
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1061
-			$filter['choices'] = $form_field['choices'];
1058
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1059
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1060
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1061
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1062 1062
 		}
1063 1063
 
1064
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1065
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1064
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1065
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1066 1066
 		}
1067 1067
 
1068 1068
 		return $filter;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
 		$choices = array();
1088 1088
 		foreach ( $users as $user ) {
1089
-			$choices[] = array(
1089
+			$choices[ ] = array(
1090 1090
 				'value' => $user->ID,
1091 1091
 				'text' => $user->display_name,
1092 1092
 			);
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 	 */
1142 1142
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1143 1143
 
1144
-		$js_dependencies[] = 'jquery-ui-datepicker';
1144
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1145 1145
 
1146 1146
 		return $js_dependencies;
1147 1147
 	}
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 			'isRTL'             => is_rtl(),
1186 1186
 		), $view_data );
1187 1187
 
1188
-		$localizations['datepicker'] = $datepicker_settings;
1188
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1189 1189
 
1190 1190
 		return $localizations;
1191 1191
 
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 	 * @return void
1215 1215
 	 */
1216 1216
 	private function maybe_enqueue_flexibility() {
1217
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1217
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1218 1218
 			wp_enqueue_script( 'gv-flexibility' );
1219 1219
 		}
1220 1220
 	}
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1237 1237
 
1238 1238
 		$scheme = is_ssl() ? 'https://' : 'http://';
1239
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1239
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1240 1240
 
1241 1241
 		/**
1242 1242
 		 * @filter `gravityview_search_datepicker_class`
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry.php 2 patches
Indentation   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -18,80 +18,80 @@  discard block
 block discarded – undo
18 18
 
19 19
 class GravityView_Edit_Entry {
20 20
 
21
-    /**
22
-     * @var string
23
-     */
21
+	/**
22
+	 * @var string
23
+	 */
24 24
 	static $file;
25 25
 
26 26
 	static $instance;
27 27
 
28
-    /**
29
-     * Component instances.
30
-     * @var array
31
-     */
32
-    public $instances = array();
28
+	/**
29
+	 * Component instances.
30
+	 * @var array
31
+	 */
32
+	public $instances = array();
33 33
 
34 34
 
35 35
 	function __construct() {
36 36
 
37
-        self::$file = plugin_dir_path( __FILE__ );
37
+		self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
40
-            $this->load_components( 'admin' );
41
-        }
39
+		if( is_admin() ) {
40
+			$this->load_components( 'admin' );
41
+		}
42 42
 
43 43
 
44
-        $this->load_components( 'render' );
44
+		$this->load_components( 'render' );
45 45
 
46
-        // If GF User Registration Add-on exists
47
-        $this->load_components( 'user-registration' );
46
+		// If GF User Registration Add-on exists
47
+		$this->load_components( 'user-registration' );
48 48
 
49
-        $this->add_hooks();
49
+		$this->add_hooks();
50 50
 
51 51
 		// Process hooks for addons that may or may not be present
52 52
 		$this->addon_specific_hooks();
53 53
 	}
54 54
 
55 55
 
56
-    static function getInstance() {
56
+	static function getInstance() {
57 57
 
58
-        if( empty( self::$instance ) ) {
59
-            self::$instance = new GravityView_Edit_Entry;
60
-        }
58
+		if( empty( self::$instance ) ) {
59
+			self::$instance = new GravityView_Edit_Entry;
60
+		}
61 61
 
62
-        return self::$instance;
63
-    }
62
+		return self::$instance;
63
+	}
64 64
 
65 65
 
66
-    private function load_components( $component ) {
66
+	private function load_components( $component ) {
67 67
 
68
-        $dir = trailingslashit( self::$file );
68
+		$dir = trailingslashit( self::$file );
69 69
 
70
-        $filename  = $dir . 'class-edit-entry-' . $component . '.php';
71
-        $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
70
+		$filename  = $dir . 'class-edit-entry-' . $component . '.php';
71
+		$classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
72 72
 
73
-        // Loads component and pass extension's instance so that component can
74
-        // talk each other.
75
-        require_once $filename;
76
-        $this->instances[ $component ] = new $classname( $this );
77
-        $this->instances[ $component ]->load();
73
+		// Loads component and pass extension's instance so that component can
74
+		// talk each other.
75
+		require_once $filename;
76
+		$this->instances[ $component ] = new $classname( $this );
77
+		$this->instances[ $component ]->load();
78 78
 
79
-    }
79
+	}
80 80
 
81
-    private function add_hooks() {
81
+	private function add_hooks() {
82 82
 
83
-        // Add front-end access to Gravity Forms delete file action
84
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
83
+		// Add front-end access to Gravity Forms delete file action
84
+		add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
85 85
 
86
-        // Make sure this hook is run for non-admins
87
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
86
+		// Make sure this hook is run for non-admins
87
+		add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
88 88
 
89
-        add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
89
+		add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
90 90
 
91
-        // add template path to check for field
92
-        add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
91
+		// add template path to check for field
92
+		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
93 93
 
94
-    }
94
+	}
95 95
 
96 96
 	/**
97 97
 	 * Trigger hooks that are normally run in the admin for Addons, but need to be triggered manually because we're not in the admin
@@ -105,73 +105,73 @@  discard block
 block discarded – undo
105 105
 
106 106
 	}
107 107
 
108
-    /**
109
-     * Include this extension templates path
110
-     * @param array $file_paths List of template paths ordered
111
-     */
112
-    public function add_template_path( $file_paths ) {
113
-
114
-        // Index 100 is the default GravityView template path.
115
-        $file_paths[ 110 ] = self::$file;
116
-
117
-        return $file_paths;
118
-    }
119
-
120
-    /**
121
-     *
122
-     * Return a well formatted nonce key according to GravityView Edit Entry protocol
123
-     *
124
-     * @param $view_id int GravityView view id
125
-     * @param $form_id int Gravity Forms form id
126
-     * @param $entry_id int Gravity Forms entry id
127
-     * @return string
128
-     */
129
-    public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
130
-        return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
131
-    }
132
-
133
-
134
-    /**
135
-     * The edit entry link creates a secure link with a nonce
136
-     *
137
-     * It also mimics the URL structure Gravity Forms expects to have so that
138
-     * it formats the display of the edit form like it does in the backend, like
139
-     * "You can edit this post from the post page" fields, for example.
140
-     *
141
-     * @param $entry array Gravity Forms entry object
142
-     * @param $view_id int GravityView view id
143
-     * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
144
-     * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
145
-     * @return string
146
-     */
147
-    public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
148
-
149
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
150
-
151
-        $base = gv_entry_link( $entry, $post_id );
152
-
153
-        $url = add_query_arg( array(
154
-            'edit' => wp_create_nonce( $nonce_key )
155
-        ), $base );
156
-
157
-	    /**
158
-	     * Allow passing params to dynamically populate entry with values
159
-	     * @since 1.9.2
160
-	     */
161
-	    if( !empty( $field_values ) ) {
162
-
163
-		    if( is_array( $field_values ) ) {
164
-			    // If already an array, no parse_str() needed
165
-			    $params = $field_values;
166
-		    } else {
167
-			    parse_str( $field_values, $params );
168
-		    }
169
-
170
-		    $url = add_query_arg( $params, $url );
171
-	    }
172
-
173
-        return $url;
174
-    }
108
+	/**
109
+	 * Include this extension templates path
110
+	 * @param array $file_paths List of template paths ordered
111
+	 */
112
+	public function add_template_path( $file_paths ) {
113
+
114
+		// Index 100 is the default GravityView template path.
115
+		$file_paths[ 110 ] = self::$file;
116
+
117
+		return $file_paths;
118
+	}
119
+
120
+	/**
121
+	 *
122
+	 * Return a well formatted nonce key according to GravityView Edit Entry protocol
123
+	 *
124
+	 * @param $view_id int GravityView view id
125
+	 * @param $form_id int Gravity Forms form id
126
+	 * @param $entry_id int Gravity Forms entry id
127
+	 * @return string
128
+	 */
129
+	public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
130
+		return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
131
+	}
132
+
133
+
134
+	/**
135
+	 * The edit entry link creates a secure link with a nonce
136
+	 *
137
+	 * It also mimics the URL structure Gravity Forms expects to have so that
138
+	 * it formats the display of the edit form like it does in the backend, like
139
+	 * "You can edit this post from the post page" fields, for example.
140
+	 *
141
+	 * @param $entry array Gravity Forms entry object
142
+	 * @param $view_id int GravityView view id
143
+	 * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
144
+	 * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
145
+	 * @return string
146
+	 */
147
+	public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
148
+
149
+		$nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
150
+
151
+		$base = gv_entry_link( $entry, $post_id );
152
+
153
+		$url = add_query_arg( array(
154
+			'edit' => wp_create_nonce( $nonce_key )
155
+		), $base );
156
+
157
+		/**
158
+		 * Allow passing params to dynamically populate entry with values
159
+		 * @since 1.9.2
160
+		 */
161
+		if( !empty( $field_values ) ) {
162
+
163
+			if( is_array( $field_values ) ) {
164
+				// If already an array, no parse_str() needed
165
+				$params = $field_values;
166
+			} else {
167
+				parse_str( $field_values, $params );
168
+			}
169
+
170
+			$url = add_query_arg( $params, $url );
171
+		}
172
+
173
+		return $url;
174
+	}
175 175
 
176 176
 	/**
177 177
 	 * Edit mode doesn't allow certain field types.
@@ -225,81 +225,81 @@  discard block
 block discarded – undo
225 225
 	}
226 226
 
227 227
 
228
-    /**
229
-     * checks if user has permissions to edit a specific entry
230
-     *
231
-     * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
232
-     *
233
-     * @param  array $entry Gravity Forms entry array
234
-     * @param int $view_id ID of the view you want to check visibility against {@since 1.9.2}
235
-     * @return bool
236
-     */
237
-    public static function check_user_cap_edit_entry( $entry, $view_id = 0 ) {
228
+	/**
229
+	 * checks if user has permissions to edit a specific entry
230
+	 *
231
+	 * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
232
+	 *
233
+	 * @param  array $entry Gravity Forms entry array
234
+	 * @param int $view_id ID of the view you want to check visibility against {@since 1.9.2}
235
+	 * @return bool
236
+	 */
237
+	public static function check_user_cap_edit_entry( $entry, $view_id = 0 ) {
238 238
 
239
-        // No permission by default
240
-        $user_can_edit = false;
239
+		// No permission by default
240
+		$user_can_edit = false;
241 241
 
242
-        // If they can edit any entries (as defined in Gravity Forms)
243
-        // Or if they can edit other people's entries
244
-        // Then we're good.
245
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
242
+		// If they can edit any entries (as defined in Gravity Forms)
243
+		// Or if they can edit other people's entries
244
+		// Then we're good.
245
+		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
246 246
 
247
-            do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.');
247
+			do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.');
248 248
 
249
-            $user_can_edit = true;
249
+			$user_can_edit = true;
250 250
 
251
-        } else if( !isset( $entry['created_by'] ) ) {
251
+		} else if( !isset( $entry['created_by'] ) ) {
252 252
 
253
-            do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.');
253
+			do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.');
254 254
 
255
-            $user_can_edit = false;
255
+			$user_can_edit = false;
256 256
 
257
-        } else {
257
+		} else {
258 258
 
259
-            // get user_edit setting
260
-            if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) {
261
-                // if View ID not specified or is the current view
262
-                $user_edit = GravityView_View::getInstance()->getAtts('user_edit');
263
-            } else {
264
-                // in case is specified and not the current view
265
-                $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
266
-            }
259
+			// get user_edit setting
260
+			if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) {
261
+				// if View ID not specified or is the current view
262
+				$user_edit = GravityView_View::getInstance()->getAtts('user_edit');
263
+			} else {
264
+				// in case is specified and not the current view
265
+				$user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
266
+			}
267 267
 
268
-            $current_user = wp_get_current_user();
268
+			$current_user = wp_get_current_user();
269 269
 
270
-            // User edit is disabled
271
-            if( empty( $user_edit ) ) {
270
+			// User edit is disabled
271
+			if( empty( $user_edit ) ) {
272 272
 
273
-                do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' );
273
+				do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' );
274 274
 
275
-                $user_can_edit = false;
276
-            }
275
+				$user_can_edit = false;
276
+			}
277 277
 
278
-            // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
279
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
278
+			// User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
279
+			else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
280 280
 
281
-                do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) );
281
+				do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) );
282 282
 
283
-                $user_can_edit = true;
283
+				$user_can_edit = true;
284 284
 
285
-            } else if( ! is_user_logged_in() ) {
285
+			} else if( ! is_user_logged_in() ) {
286 286
 
287
-                do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' );
288
-            }
287
+				do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' );
288
+			}
289 289
 
290
-        }
290
+		}
291 291
 
292
-        /**
293
-         * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
294
-         * @since 1.15 Added `$entry` and `$view_id` parameters
295
-         * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
296
-         * @param[in] array $entry Gravity Forms entry array {@since 1.15}
297
-         * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
298
-         */
299
-        $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
292
+		/**
293
+		 * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
294
+		 * @since 1.15 Added `$entry` and `$view_id` parameters
295
+		 * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
296
+		 * @param[in] array $entry Gravity Forms entry array {@since 1.15}
297
+		 * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
298
+		 */
299
+		$user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
300 300
 
301
-        return (bool)$user_can_edit;
302
-    }
301
+		return (bool)$user_can_edit;
302
+	}
303 303
 
304 304
 
305 305
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
39
+        if ( is_admin() ) {
40 40
             $this->load_components( 'admin' );
41 41
         }
42 42
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     static function getInstance() {
57 57
 
58
-        if( empty( self::$instance ) ) {
58
+        if ( empty( self::$instance ) ) {
59 59
             self::$instance = new GravityView_Edit_Entry;
60 60
         }
61 61
 
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
     private function add_hooks() {
82 82
 
83 83
         // Add front-end access to Gravity Forms delete file action
84
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
84
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) );
85 85
 
86 86
         // Make sure this hook is run for non-admins
87
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
87
+        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) );
88 88
 
89 89
         add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
90 90
 
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	private function addon_specific_hooks() {
101 101
 
102
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
103
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
102
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
103
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
104 104
 		}
105 105
 
106 106
 	}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
148 148
 
149
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
149
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
150 150
 
151 151
         $base = gv_entry_link( $entry, $post_id );
152 152
 
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
 	     * Allow passing params to dynamically populate entry with values
159 159
 	     * @since 1.9.2
160 160
 	     */
161
-	    if( !empty( $field_values ) ) {
161
+	    if ( ! empty( $field_values ) ) {
162 162
 
163
-		    if( is_array( $field_values ) ) {
163
+		    if ( is_array( $field_values ) ) {
164 164
 			    // If already an array, no parse_str() needed
165 165
 			    $params = $field_values;
166 166
 		    } else {
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function modify_field_blacklist( $fields = array(), $context = NULL ) {
183 183
 
184
-		if( empty( $context ) || $context !== 'edit' ) {
184
+		if ( empty( $context ) || $context !== 'edit' ) {
185 185
 			return $fields;
186 186
 		}
187 187
 
@@ -242,24 +242,24 @@  discard block
 block discarded – undo
242 242
         // If they can edit any entries (as defined in Gravity Forms)
243 243
         // Or if they can edit other people's entries
244 244
         // Then we're good.
245
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
245
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
246 246
 
247
-            do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.');
247
+            do_action( 'gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.' );
248 248
 
249 249
             $user_can_edit = true;
250 250
 
251
-        } else if( !isset( $entry['created_by'] ) ) {
251
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
252 252
 
253
-            do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.');
253
+            do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.' );
254 254
 
255 255
             $user_can_edit = false;
256 256
 
257 257
         } else {
258 258
 
259 259
             // get user_edit setting
260
-            if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) {
260
+            if ( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) {
261 261
                 // if View ID not specified or is the current view
262
-                $user_edit = GravityView_View::getInstance()->getAtts('user_edit');
262
+                $user_edit = GravityView_View::getInstance()->getAtts( 'user_edit' );
263 263
             } else {
264 264
                 // in case is specified and not the current view
265 265
                 $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
@@ -268,21 +268,21 @@  discard block
 block discarded – undo
268 268
             $current_user = wp_get_current_user();
269 269
 
270 270
             // User edit is disabled
271
-            if( empty( $user_edit ) ) {
271
+            if ( empty( $user_edit ) ) {
272 272
 
273
-                do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' );
273
+                do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' );
274 274
 
275 275
                 $user_can_edit = false;
276 276
             }
277 277
 
278 278
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
279
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
279
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
280 280
 
281
-                do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) );
281
+                do_action( 'gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) );
282 282
 
283 283
                 $user_can_edit = true;
284 284
 
285
-            } else if( ! is_user_logged_in() ) {
285
+            } else if ( ! is_user_logged_in() ) {
286 286
 
287 287
                 do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' );
288 288
             }
Please login to merge, or discard this patch.
future/includes/class-gv-collection-entry.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -313,6 +313,7 @@
 block discarded – undo
313 313
 	 * Add a callback for lazy loading/counting.
314 314
 	 *
315 315
 	 * @param callable $callback The callback to call when needed.
316
+	 * @param string $type
316 317
 	 *
317 318
 	 * @return void
318 319
 	 */
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 
104 104
 		/** Call all lazy callbacks. */
105 105
 		foreach ( $this->callbacks as $callback ) {
106
-			if ( $callback[0] != 'count' ) {
106
+			if ( $callback[ 0 ] != 'count' ) {
107 107
 				continue;
108 108
 			}
109 109
 
110
-			$total += $callback[1]( $this->filters );
110
+			$total += $callback[ 1 ]( $this->filters );
111 111
 		}
112 112
 
113 113
 		return $total - $this->offset;
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
 
162 162
 		/** Call all lazy callbacks. */
163 163
 		foreach ( $this->callbacks as $i => $callback ) {
164
-			if ( $callback[0] != 'fetch' ) {
164
+			if ( $callback[ 0 ] != 'fetch' ) {
165 165
 				continue;
166 166
 			}
167 167
 
168
-			$this->merge( $callback[1]( $this->filters, $this->sorts, $offset ) );
168
+			$this->merge( $callback[ 1 ]( $this->filters, $this->sorts, $offset ) );
169 169
 		}
170 170
 
171 171
 		$this->fetched = $this->count();
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 			return;
322 322
 		}
323 323
 
324
-		$this->callbacks []= array( $type, $callback );
324
+		$this->callbacks [ ] = array( $type, $callback );
325 325
 	}
326 326
 
327 327
 	/**
Please login to merge, or discard this patch.
future/includes/class-gv-context.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,6 @@
 block discarded – undo
38 38
 	 * Set an setting.
39 39
 	 *
40 40
 	 * @param mixed $key The key in this setting to retrieve.
41
-	 * @param mixed $default A default in case the key is not set. 
42 41
 	 *
43 42
 	 * @api
44 43
 	 * @since future
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @return void
32 32
 	 */
33 33
 	public function __set( $key, $value ) {
34
-		$this->_context[$key] = $value;
34
+		$this->_context[ $key ] = $value;
35 35
 	}
36 36
 
37 37
 	/**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @return mixed|null
46 46
 	 */
47 47
 	public function __get( $key ) {
48
-		return isset( $this->_context[$key] ) ? $this->_context[$key] : null;
48
+		return isset( $this->_context[ $key ] ) ? $this->_context[ $key ] : null;
49 49
 	}
50 50
 }
51 51
 
Please login to merge, or discard this patch.
future/includes/class-gv-entry-gravityforms.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 	 *
39 39
 	 * @api
40 40
 	 * @since future
41
-	 * @return \GV\Entry|null An instance of this entry or null if not found.
41
+	 * @return null|GF_Entry An instance of this entry or null if not found.
42 42
 	 */
43 43
 	public static function by_id( $entry_id ) {
44 44
 		$entry = \GFAPI::get_entry( $entry_id );
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public static function by_id( $entry_id ) {
44 44
 		$entry = \GFAPI::get_entry( $entry_id );
45
-		if ( !$entry ) {
45
+		if ( ! $entry ) {
46 46
 			return null;
47 47
 		}
48 48
 
49 49
 		$self = new self();
50 50
 		$self->entry = $entry;
51 51
 
52
-		$self->ID = $self->entry['id'];
52
+		$self->ID = $self->entry[ 'id' ];
53 53
 
54 54
 		return $self;
55 55
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return bool Whether the offset exists or not.
64 64
 	 */
65 65
 	public function offsetExists( $offset ) {
66
-		return isset( $this->entry[$offset] );
66
+		return isset( $this->entry[ $offset ] );
67 67
 	}
68 68
 
69 69
 	/**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @return mixed The value of the requested entry data.
81 81
 	 */
82 82
 	public function offsetGet( $offset ) {
83
-		return $this->entry[$offset];
83
+		return $this->entry[ $offset ];
84 84
 	}
85 85
 
86 86
 	/**
Please login to merge, or discard this patch.
future/includes/class-gv-view.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -298,7 +298,7 @@
 block discarded – undo
298 298
 	/**
299 299
 	 * Determines if a view exists to begin with.
300 300
 	 *
301
-	 * @param int|\WP_Post|null $view_id The WordPress post ID, a \WP_Post object or null for global $post;
301
+	 * @param int|\WP_Post|null $view The WordPress post ID, a \WP_Post object or null for global $post;
302 302
 	 *
303 303
 	 * @api
304 304
 	 * @since future
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -202,12 +202,12 @@
 block discarded – undo
202 202
 		}
203 203
 
204 204
 		/**
205
-		* @filter `gravityview/configuration/fields` Filter the View fields' configuration array
206
-		* @since 1.6.5
207
-		*
208
-		* @param $fields array Multi-array of fields with first level being the field zones
209
-		* @param $view_id int The View the fields are being pulled for
210
-		*/
205
+		 * @filter `gravityview/configuration/fields` Filter the View fields' configuration array
206
+		 * @since 1.6.5
207
+		 *
208
+		 * @param $fields array Multi-array of fields with first level being the field zones
209
+		 * @param $view_id int The View the fields are being pulled for
210
+		 */
211 211
 		$configuration = apply_filters( 'gravityview/configuration/fields', (array)$view->_gravityview_directory_fields, $view->ID );
212 212
 
213 213
 		/** Get all fields. */
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		$supports = array( 'title', 'revisions' );
87 87
 
88 88
 		if ( $is_hierarchical ) {
89
-			$supports[] = 'page-attributes';
89
+			$supports[ ] = 'page-attributes';
90 90
 		}
91 91
 
92 92
 		/**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		if ( ! $view->form ) {
198 198
 			gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array(
199 199
 				'view_id' => $view->ID,
200
-				'form_id' => $view->_gravityview_form_id ? : 0,
200
+				'form_id' => $view->_gravityview_form_id ?: 0,
201 201
 			) );
202 202
 		}
203 203
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 				 * Add the other keys as they are moved out to ensure we're not using them in core.
349 349
 				 */
350 350
 
351
-			} else if ( ! empty( $GLOBALS['GRAVITYVIEW_TESTS_VIEW_ARRAY_ACCESS_OVERRIDE'] ) ) {
351
+			} else if ( ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_VIEW_ARRAY_ACCESS_OVERRIDE' ] ) ) {
352 352
 				/**
353 353
 				 * Suppress exception if specifically testing for array acess.
354 354
 				 */
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 			}
362 362
 		}
363 363
 
364
-		if ( ! isset( $this[$offset] ) ) {
364
+		if ( ! isset( $this[ $offset ] ) ) {
365 365
 			return null;
366 366
 		}
367 367
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 				return $this->template ? $this->template->ID : null;
380 380
 			default:
381 381
 				/** @todo move the rest out and get rid of _data completely! */
382
-				return $this->_data[$offset];
382
+				return $this->_data[ $offset ];
383 383
 		}
384 384
 	}
385 385
 
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 			array( 'form' => $this->form ? gravityview_get_form( $this->form->ID ) : null ),
431 431
 			array( 'atts' => $this->settings->as_atts() ),
432 432
 			array( 'fields' => $this->fields->by_visible()->as_configuration() ),
433
-			array( 'template_id' => $this->template? $this->template->ID : null ),
433
+			array( 'template_id' => $this->template ? $this->template->ID : null ),
434 434
 			$this->_data
435 435
 		);
436 436
 	}
Please login to merge, or discard this patch.
includes/class-frontend-views.php 3 patches
Doc Comments   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 	/**
155 155
 	 * Sets the single entry ID and also the entry
156
-	 * @param bool|int|string $single_entry
156
+	 * @param boolean|string $single_entry
157 157
 	 */
158 158
 	public function setSingleEntry( $single_entry ) {
159 159
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
 	/**
172 172
 	 * Set the current entry
173
-	 * @param array|int $entry Entry array or entry slug or ID
173
+	 * @param boolean|string $entry Entry array or entry slug or ID
174 174
 	 */
175 175
 	public function setEntry( $entry ) {
176 176
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 *
229 229
 	 *
230 230
 	 *
231
-	 * @param null $view_id
231
+	 * @param string $view_id
232 232
 	 */
233 233
 	public function set_context_view_id( $view_id = null ) {
234 234
 		$multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : ( $this->getGvOutputData() && $this->getGvOutputData()->has_multiple_views() );
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 	 *
1214 1214
 	 * @uses  gravityview_get_entries()
1215 1215
 	 * @access public
1216
-	 * @param array $args\n
1216
+	 * @param array $args
1217 1217
 	 *   - $id - View id
1218 1218
 	 *   - $page_size - Page
1219 1219
 	 *   - $sort_field - form field id to sort
@@ -1370,7 +1370,6 @@  discard block
 block discarded – undo
1370 1370
 	 * @since 1.19.5
1371 1371
 	 *
1372 1372
 	 * @param $args
1373
-	 * @param int $form_id
1374 1373
 	 */
1375 1374
 	public static function get_search_criteria_paging( $args ) {
1376 1375
 
@@ -1785,7 +1784,7 @@  discard block
 block discarded – undo
1785 1784
 	/**
1786 1785
 	 * Checks if field (column) is sortable
1787 1786
 	 *
1788
-	 * @param string $field Field settings
1787
+	 * @param string $field_id Field settings
1789 1788
 	 * @param array $form Gravity Forms form array
1790 1789
 	 *
1791 1790
 	 * @since 1.7
Please login to merge, or discard this patch.
Spacing   +120 added lines, -120 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 );
@@ -237,12 +237,12 @@  discard block
 block discarded – undo
237 237
 
238 238
 			$this->context_view_id = $view_id;
239 239
 
240
-		} elseif ( isset( $_GET['gvid'] ) && $multiple_views ) {
240
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) {
241 241
 			/**
242 242
 			 * used on a has_multiple_views context
243 243
 			 * @see GravityView_API::entry_link
244 244
 			 */
245
-			$this->context_view_id = $_GET['gvid'];
245
+			$this->context_view_id = $_GET[ 'gvid' ];
246 246
 
247 247
 		} elseif ( ! $multiple_views ) {
248 248
 			if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
@@ -285,24 +285,24 @@  discard block
 block discarded – undo
285 285
 		global $wp_rewrite;
286 286
 
287 287
 		$is_front_page = ( $query->is_home || $query->is_page );
288
-		$show_on_front = ( 'page' === get_option('show_on_front') );
289
-		$front_page_id = get_option('page_on_front');
288
+		$show_on_front = ( 'page' === get_option( 'show_on_front' ) );
289
+		$front_page_id = get_option( 'page_on_front' );
290 290
 
291
-		if (  $is_front_page && $show_on_front && $front_page_id ) {
291
+		if ( $is_front_page && $show_on_front && $front_page_id ) {
292 292
 
293 293
 			// Force to be an array, potentially a query string ( entry=16 )
294 294
 			$_query = wp_parse_args( $query->query );
295 295
 
296 296
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
297
-			if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) {
298
-				unset( $_query['pagename'] );
297
+			if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) {
298
+				unset( $_query[ 'pagename' ] );
299 299
 			}
300 300
 
301 301
 			// this is where will break from core wordpress
302 302
 			$ignore = array( 'preview', 'page', 'paged', 'cpage' );
303 303
 			$endpoints = rgobj( $wp_rewrite, 'endpoints' );
304
-			foreach ( (array) $endpoints as $endpoint ) {
305
-				$ignore[] = $endpoint[1];
304
+			foreach ( (array)$endpoints as $endpoint ) {
305
+				$ignore[ ] = $endpoint[ 1 ];
306 306
 			}
307 307
 			unset( $endpoints );
308 308
 
@@ -312,21 +312,21 @@  discard block
 block discarded – undo
312 312
 			// - The query includes keys that are associated with registered endpoints. `entry`, for example.
313 313
 			if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) {
314 314
 
315
-				$qv =& $query->query_vars;
315
+				$qv = & $query->query_vars;
316 316
 
317 317
 				// Prevent redirect when on the single entry endpoint
318
-				if( self::is_single_entry() ) {
318
+				if ( self::is_single_entry() ) {
319 319
 					add_filter( 'redirect_canonical', '__return_false' );
320 320
 				}
321 321
 
322 322
 				$query->is_page = true;
323 323
 				$query->is_home = false;
324
-				$qv['page_id']  = $front_page_id;
324
+				$qv[ 'page_id' ]  = $front_page_id;
325 325
 
326 326
 				// Correct <!--nextpage--> for page_on_front
327
-				if ( ! empty( $qv['paged'] ) ) {
328
-					$qv['page'] = $qv['paged'];
329
-					unset( $qv['paged'] );
327
+				if ( ! empty( $qv[ 'paged' ] ) ) {
328
+					$qv[ 'page' ] = $qv[ 'paged' ];
329
+					unset( $qv[ 'paged' ] );
330 330
 				}
331 331
 			}
332 332
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 		$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' );
361 361
 
362
-		$post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null );
362
+		$post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null );
363 363
 		$this->setPostId( $post_id );
364 364
 		$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false;
365 365
 		$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) );
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 
396 396
 		$search_method = GravityView_Widget_Search::getInstance()->get_search_method();
397 397
 
398
-		if( 'post' === $search_method ) {
398
+		if ( 'post' === $search_method ) {
399 399
 			$get = $_POST;
400 400
 		} else {
401 401
 			$get = $_GET;
@@ -451,20 +451,20 @@  discard block
 block discarded – undo
451 451
 		 * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop
452 452
 		 * @param array $entry Current entry
453 453
 		 */
454
-		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry );
454
+		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry );
455 455
 
456 456
 		if ( ! $apply_outside_loop ) {
457 457
 			return $title;
458 458
 		}
459 459
 
460 460
 		// User reported WooCommerce doesn't pass two args.
461
-		if ( empty( $passed_post_id ) )  {
461
+		if ( empty( $passed_post_id ) ) {
462 462
 			return $title;
463 463
 		}
464 464
 
465 465
 		// Don't modify the title for anything other than the current view/post.
466 466
 		// This is true for embedded shortcodes and Views.
467
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
467
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
468 468
 			return $title;
469 469
 		}
470 470
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 		} else {
488 488
 			if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
489 489
 				foreach ( gravityview()->views->all() as $_view ) {
490
-					if ( intval( $_view->form->ID ) === intval( $entry['form_id'] ) ) {
490
+					if ( intval( $_view->form->ID ) === intval( $entry[ 'form_id' ] ) ) {
491 491
 						$view = $_view;
492 492
 						break;
493 493
 					}
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 			} else {
500 500
 				/** Deprecated. Use gravityview()->views->all() or gravityview()->request->all() */
501 501
 				foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
502
-					if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) {
502
+					if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) {
503 503
 						$view_meta = $view_data;
504 504
 						break;
505 505
 					}
@@ -514,12 +514,12 @@  discard block
 block discarded – undo
514 514
 			}
515 515
 		} else {
516 516
 			/** Deprecated stuff in the future. See the branch above. */
517
-			if ( ! empty( $view_meta['atts']['single_title'] ) ) {
517
+			if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) {
518 518
 
519
-				$title = $view_meta['atts']['single_title'];
519
+				$title = $view_meta[ 'atts' ][ 'single_title' ];
520 520
 
521 521
 				// We are allowing HTML in the fields, so no escaping the output
522
-				$title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry );
522
+				$title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry );
523 523
 
524 524
 				$title = do_shortcode( $title );
525 525
 			}
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		}
558 558
 
559 559
 		// Only render in the loop. Fixes issues with the_content filter being applied in places like the sidebar
560
-		if( ! in_the_loop() ) {
560
+		if ( ! in_the_loop() ) {
561 561
 			return $content;
562 562
 		}
563 563
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 
633 633
 		$context = GravityView_View::getInstance()->getContext();
634 634
 
635
-		switch( $context ) {
635
+		switch ( $context ) {
636 636
 			case 'directory':
637 637
 				$tab = __( 'Multiple Entries', 'gravityview' );
638 638
 				break;
@@ -646,9 +646,9 @@  discard block
 block discarded – undo
646 646
 		}
647 647
 
648 648
 
649
-		$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 );
649
+		$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 );
650 650
 		$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) );
651
-		$action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab );
651
+		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
652 652
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
653 653
 
654 654
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	public function render_view( $passed_args ) {
682 682
 
683 683
 		// validate attributes
684
-		if ( empty( $passed_args['id'] ) ) {
684
+		if ( empty( $passed_args[ 'id' ] ) ) {
685 685
 			do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args );
686 686
 			return null;
687 687
 		}
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 			return null;
704 704
 		}
705 705
 
706
-		$view_id = $passed_args['id'];
706
+		$view_id = $passed_args[ 'id' ];
707 707
 
708 708
 		if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
709 709
 			$view = gravityview()->views->get( $view_id );
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 			$passed_args = array_filter( $passed_args, 'strlen' );
729 729
 
730 730
 			//Override shortcode args over View template settings
731
-			$atts = wp_parse_args( $passed_args, $view_data['atts'] );
731
+			$atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] );
732 732
 
733 733
 			do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts );
734 734
 		}
@@ -752,14 +752,14 @@  discard block
 block discarded – undo
752 752
 		 * @since 1.15
753 753
 		 * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out.
754 754
 		 */
755
-		if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
755
+		if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
756 756
 
757 757
 			do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) );
758 758
 
759 759
 			return null;
760 760
 		}
761 761
 
762
-		if( $this->isGravityviewPostType() ) {
762
+		if ( $this->isGravityviewPostType() ) {
763 763
 
764 764
 			/**
765 765
 			 * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode?
@@ -775,10 +775,10 @@  discard block
 block discarded – undo
775 775
 				$embed_only = $view->settings->get( 'embed_only' );
776 776
 			} else {
777 777
 				/** Deprecated. View attributes moved to \GV\View::$settings. */
778
-				$embed_only = ! empty( $atts['embed_only'] );
778
+				$embed_only = ! empty( $atts[ 'embed_only' ] );
779 779
 			}
780 780
 
781
-			if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
781
+			if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
782 782
 				return __( 'You are not allowed to view this content.', 'gravityview' );
783 783
 			}
784 784
 		}
@@ -794,13 +794,13 @@  discard block
 block discarded – undo
794 794
 		if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
795 795
 			$view_data = $view->as_data();
796 796
 			$gravityview_view = new GravityView_View( $view_data );
797
-			$post_id = intval( $view->settings->get( 'post_id' ) ? : get_the_ID() );
797
+			$post_id = intval( $view->settings->get( 'post_id' ) ?: get_the_ID() );
798 798
 			$template_id = $view->template ? $view->template->ID : null;
799 799
 		} else {
800 800
 			/** These constructs are deprecated. Use the new gravityview() wrapper. */
801 801
 			$gravityview_view = new GravityView_View( $view_data );
802
-			$post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : get_the_ID();
803
-			$template_id = $view_data['template_id'];
802
+			$post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : get_the_ID();
803
+			$template_id = $view_data[ 'template_id' ];
804 804
 		}
805 805
 
806 806
 		$gravityview_view->setPostId( $post_id );
@@ -811,20 +811,20 @@  discard block
 block discarded – undo
811 811
 			do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' );
812 812
 
813 813
 			//fetch template and slug
814
-			$view_slug = apply_filters( 'gravityview_template_slug_'. $template_id, 'table', 'directory' );
814
+			$view_slug = apply_filters( 'gravityview_template_slug_' . $template_id, 'table', 'directory' );
815 815
 
816 816
 			do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug );
817 817
 
818 818
 			/**
819 819
 			 * Disable fetching initial entries for views that don't need it (DataTables)
820 820
 			 */
821
-			$get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true );
821
+			$get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true );
822 822
 
823 823
 			if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
824 824
 				$hide_until_searched = $view->settings->get( 'hide_until_searched' );
825 825
 			} else {
826 826
 				/** $atts is deprecated, use \GV\View:$settings */
827
-				$hide_until_searched = ! empty( $atts['hide_until_searched'] );
827
+				$hide_until_searched = ! empty( $atts[ 'hide_until_searched' ] );
828 828
 			}
829 829
 
830 830
 			/**
@@ -842,12 +842,12 @@  discard block
 block discarded – undo
842 842
 					$sort_columns = $view->settings->get( 'sort_columns' );
843 843
 				} else {
844 844
 					/** $atts is deprecated, use \GV\View:$settings */
845
-					$sort_columns = ! empty( $atts['sort_columns'] );
845
+					$sort_columns = ! empty( $atts[ 'sort_columns' ] );
846 846
 				}
847 847
 
848 848
 				if ( $sort_columns ) {
849 849
 					// add filter to enable column sorting
850
-					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 );
850
+					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 );
851 851
 				}
852 852
 
853 853
 				if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
@@ -855,19 +855,19 @@  discard block
 block discarded – undo
855 855
 				} else {
856 856
 					/** $atts is deprecated, use \GV\View:$settings */
857 857
 					/** $view_data is depreacted, use \GV\View properties */
858
-					$view_entries = self::get_view_entries( $atts, $view_data['form_id'] );
858
+					$view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] );
859 859
 				}
860 860
 
861
-				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) );
861
+				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) );
862 862
 
863 863
 			} else {
864 864
 
865 865
 				$view_entries = array( 'count' => null, 'entries' => null, 'paging' => null );
866 866
 
867
-				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' );
867
+				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' );
868 868
 			}
869 869
 
870
-			$gravityview_view->setPaging( $view_entries['paging'] );
870
+			$gravityview_view->setPaging( $view_entries[ 'paging' ] );
871 871
 			$gravityview_view->setContext( 'directory' );
872 872
 			$sections = array( 'header', 'body', 'footer' );
873 873
 
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 				do_action( 'gravityview_render_entry_' . $view->ID );
885 885
 			} else {
886 886
 				/** $view_data is depreacted, use \GV\View properties */
887
-				do_action( 'gravityview_render_entry_'.$view_data['id'] );
887
+				do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] );
888 888
 			}
889 889
 
890 890
 			$entry = $this->getEntry();
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 				do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' );
896 896
 
897 897
 				// Only display warning once when multiple Views are embedded
898
-				if( $view_id !== (int) GravityView_frontend::get_context_view_id() ) {
898
+				if ( $view_id !== (int)GravityView_frontend::get_context_view_id() ) {
899 899
 					ob_end_clean();
900 900
 					return null;
901 901
 				}
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 			// important: do not remove this as it prevents fake attempts of displaying entries from other views/forms
921 921
 			$multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : $this->getGvOutputData()->has_multiple_views();
922 922
 			if ( $multiple_views && $view_id != $this->get_context_view_id() ) {
923
-				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id );
923
+				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id );
924 924
 				ob_end_clean();
925 925
 				return null;
926 926
 			}
@@ -930,14 +930,14 @@  discard block
 block discarded – undo
930 930
 			do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug );
931 931
 
932 932
 			//fetch entry detail
933
-			$view_entries['count'] = 1;
934
-			$view_entries['entries'][] = $entry;
935
-			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] );
933
+			$view_entries[ 'count' ] = 1;
934
+			$view_entries[ 'entries' ][ ] = $entry;
935
+			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] );
936 936
 
937 937
 			if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
938 938
 				$back_link_label = $view->settings->get( 'back_link_label', null );
939 939
 			} else {
940
-				$back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null;
940
+				$back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null;
941 941
 			}
942 942
 
943 943
 			// set back link label
@@ -951,8 +951,8 @@  discard block
 block discarded – undo
951 951
 		self::add_style( $template_id );
952 952
 
953 953
 		// Prepare to render view and set vars
954
-		$gravityview_view->setEntries( $view_entries['entries'] );
955
-		$gravityview_view->setTotalEntries( $view_entries['count'] );
954
+		$gravityview_view->setEntries( $view_entries[ 'entries' ] );
955
+		$gravityview_view->setTotalEntries( $view_entries[ 'count' ] );
956 956
 
957 957
 		// If Edit
958 958
 		if ( 'edit' === gravityview_get_context() ) {
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 
970 970
 			do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections );
971 971
 			foreach ( $sections as $section ) {
972
-				do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' );
972
+				do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' );
973 973
 				$gravityview_view->render( $view_slug, $section, false );
974 974
 			}
975 975
 		}
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 				$datetime_format = 'Y-m-d H:i:s';
1024 1024
 				$search_is_outside_view_bounds = false;
1025 1025
 
1026
-				if( ! empty( $search_criteria[ $key ] ) ) {
1026
+				if ( ! empty( $search_criteria[ $key ] ) ) {
1027 1027
 
1028 1028
 					$search_date = strtotime( $search_criteria[ $key ] );
1029 1029
 
@@ -1051,14 +1051,14 @@  discard block
 block discarded – undo
1051 1051
 				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
1052 1052
 
1053 1053
 					// Then we override the search and re-set the start date
1054
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
1054
+					$return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true );
1055 1055
 				}
1056 1056
 			}
1057 1057
 		}
1058 1058
 
1059
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
1059
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
1060 1060
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
1061
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
1061
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
1062 1062
 				do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria );
1063 1063
 			}
1064 1064
 		}
@@ -1077,19 +1077,19 @@  discard block
 block discarded – undo
1077 1077
 	public static function process_search_only_approved( $args, $search_criteria ) {
1078 1078
 
1079 1079
 		/** @since 1.19 */
1080
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
1080
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
1081 1081
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' );
1082 1082
 			return $search_criteria;
1083 1083
 		}
1084 1084
 
1085
-		if ( ! empty( $args['show_only_approved'] ) ) {
1085
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
1086 1086
 
1087
-			$search_criteria['field_filters'][] = array(
1087
+			$search_criteria[ 'field_filters' ][ ] = array(
1088 1088
 				'key' => GravityView_Entry_Approval::meta_key,
1089 1089
 				'value' => GravityView_Entry_Approval_Status::APPROVED
1090 1090
 			);
1091 1091
 
1092
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
1092
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
1093 1093
 
1094 1094
 			do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria );
1095 1095
 		}
@@ -1116,18 +1116,18 @@  discard block
 block discarded – undo
1116 1116
 	 */
1117 1117
 	public static function is_entry_approved( $entry, $args = array() ) {
1118 1118
 
1119
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
1119
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
1120 1120
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
1121 1121
 			return true;
1122 1122
 		}
1123 1123
 
1124 1124
 		/** @since 1.19 */
1125
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
1125
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
1126 1126
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' );
1127 1127
 			return true;
1128 1128
 		}
1129 1129
 
1130
-		$is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key );
1130
+		$is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key );
1131 1131
 
1132 1132
 		return GravityView_Entry_Approval_Status::is_approved( $is_approved );
1133 1133
 	}
@@ -1161,26 +1161,26 @@  discard block
 block discarded – undo
1161 1161
 		do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria );
1162 1162
 
1163 1163
 		// implicity search
1164
-		if ( ! empty( $args['search_value'] ) ) {
1164
+		if ( ! empty( $args[ 'search_value' ] ) ) {
1165 1165
 
1166 1166
 			// Search operator options. Options: `is` or `contains`
1167
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
1167
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
1168 1168
 
1169
-			$search_criteria['field_filters'][] = array(
1169
+			$search_criteria[ 'field_filters' ][ ] = array(
1170 1170
 				'key' => rgget( 'search_field', $args ), // The field ID to search
1171
-				'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes.
1171
+				'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes.
1172 1172
 				'operator' => $operator,
1173 1173
 			);
1174 1174
 		}
1175 1175
 
1176
-		if( $search_criteria !== $original_search_criteria ) {
1176
+		if ( $search_criteria !== $original_search_criteria ) {
1177 1177
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria );
1178 1178
 		}
1179 1179
 
1180 1180
 		// Handle setting date range
1181 1181
 		$search_criteria = self::process_search_dates( $args, $search_criteria );
1182 1182
 
1183
-		if( $search_criteria !== $original_search_criteria ) {
1183
+		if ( $search_criteria !== $original_search_criteria ) {
1184 1184
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria );
1185 1185
 		}
1186 1186
 
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
1192 1192
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
1193 1193
 		 */
1194
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
1194
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
1195 1195
 
1196 1196
 		return $search_criteria;
1197 1197
 	}
@@ -1240,19 +1240,19 @@  discard block
 block discarded – undo
1240 1240
 			$form = \GV\GF_Form::by_id( $form_id );
1241 1241
 
1242 1242
 			$entries = $form->entries
1243
-				->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) )
1244
-				->offset( $args['offset'] )
1245
-				->limit( $parameters['paging']['page_size'] )
1246
-				->page( ( ( $parameters['paging']['offset'] - $args['offset'] ) / $parameters['paging']['page_size'] ) + 1 );
1243
+				->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) )
1244
+				->offset( $args[ 'offset' ] )
1245
+				->limit( $parameters[ 'paging' ][ 'page_size' ] )
1246
+				->page( ( ( $parameters[ 'paging' ][ 'offset' ] - $args[ 'offset' ] ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );
1247 1247
 
1248
-			if ( ! empty( $parameters['sorting'] ) ) {
1248
+			if ( ! empty( $parameters[ 'sorting' ] ) ) {
1249 1249
 				$field = new \GV\Field();
1250
-				$field->ID = $parameters['sorting']['key'];
1251
-				$direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1250
+				$field->ID = $parameters[ 'sorting' ][ 'key' ];
1251
+				$direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1252 1252
 				$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
1253 1253
 			}
1254 1254
 
1255
-			$parameters['paging'] = array(
1255
+			$parameters[ 'paging' ] = array(
1256 1256
 				'offset' => ( $entries->current_page - 1 ) * $entries->limit,
1257 1257
 				'page_size' => $entries->limit,
1258 1258
 			);
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
 			'search_criteria' => $search_criteria,
1333 1333
 			'sorting' => self::updateViewSorting( $args, $form_id ),
1334 1334
 			'paging' => $paging,
1335
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
1335
+			'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
1336 1336
 		);
1337 1337
 
1338 1338
 		/**
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
1358 1358
 		 * @param array $args View configuration args.
1359 1359
 		 */
1360
-		$parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id );
1360
+		$parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id );
1361 1361
 
1362 1362
 		do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters );
1363 1363
 
@@ -1382,17 +1382,17 @@  discard block
 block discarded – undo
1382 1382
 		$default_page_size = apply_filters( 'gravityview_default_page_size', 25 );
1383 1383
 
1384 1384
 		// Paging & offset
1385
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size;
1385
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size;
1386 1386
 
1387 1387
 		if ( -1 === $page_size ) {
1388 1388
 			$page_size = PHP_INT_MAX;
1389 1389
 		}
1390 1390
 
1391
-		$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
1391
+		$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
1392 1392
 		$offset = ( $curr_page - 1 ) * $page_size;
1393 1393
 
1394
-		if ( ! empty( $args['offset'] ) ) {
1395
-			$offset += intval( $args['offset'] );
1394
+		if ( ! empty( $args[ 'offset' ] ) ) {
1395
+			$offset += intval( $args[ 'offset' ] );
1396 1396
 		}
1397 1397
 
1398 1398
 		$paging = array(
@@ -1416,8 +1416,8 @@  discard block
 block discarded – undo
1416 1416
 	 */
1417 1417
 	public static function updateViewSorting( $args, $form_id ) {
1418 1418
 		$sorting = array();
1419
-		$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' );
1420
-		$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' );
1419
+		$sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' );
1420
+		$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' );
1421 1421
 
1422 1422
 		$sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id );
1423 1423
 
@@ -1457,11 +1457,11 @@  discard block
 block discarded – undo
1457 1457
 
1458 1458
 		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1459 1459
 
1460
-		if( ! $sort_field ) {
1460
+		if ( ! $sort_field ) {
1461 1461
 			return $sort_field_id;
1462 1462
 		}
1463 1463
 
1464
-		switch ( $sort_field['type'] ) {
1464
+		switch ( $sort_field[ 'type' ] ) {
1465 1465
 
1466 1466
 			case 'address':
1467 1467
 				// Sorting by full address
@@ -1478,7 +1478,7 @@  discard block
 block discarded – undo
1478 1478
 					 */
1479 1479
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1480 1480
 
1481
-					switch( strtolower( $address_part ) ){
1481
+					switch ( strtolower( $address_part ) ) {
1482 1482
 						case 'street':
1483 1483
 							$sort_field_id .= '.1';
1484 1484
 							break;
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
 		 */
1564 1564
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1565 1565
 
1566
-		if ( empty( $single_entry ) ){
1566
+		if ( empty( $single_entry ) ) {
1567 1567
 			return false;
1568 1568
 		} else {
1569 1569
 			return $single_entry;
@@ -1596,14 +1596,14 @@  discard block
 block discarded – undo
1596 1596
 					$template_id = $view->template ? $view->template->ID : null;
1597 1597
 					$data = $view->as_data();
1598 1598
 				} else {
1599
-					$template_id = $data['template_id'];
1599
+					$template_id = $data[ 'template_id' ];
1600 1600
 				}
1601 1601
 
1602 1602
 				/**
1603 1603
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1604 1604
 				 * @since 1.15
1605 1605
 				 */
1606
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1606
+				if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1607 1607
 					continue;
1608 1608
 				}
1609 1609
 
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 					$lightbox = $view->settings->get( 'lightbox' );
1616 1616
 				} else {
1617 1617
 					/** View data attributes are now stored in \GV\View::$settings */
1618
-					$lightbox = ! empty( $data['atts']['lightbox'] );
1618
+					$lightbox = ! empty( $data[ 'atts' ][ 'lightbox' ] );
1619 1619
 				}
1620 1620
 
1621 1621
 				// If the thickbox is enqueued, add dependencies
@@ -1625,13 +1625,13 @@  discard block
 block discarded – undo
1625 1625
 					 * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox`
1626 1626
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of it here.
1627 1627
 					 */
1628
-					$js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1628
+					$js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1629 1629
 
1630 1630
 					/**
1631 1631
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
1632 1632
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here.
1633 1633
 					 */
1634
-					$css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1634
+					$css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1635 1635
 				}
1636 1636
 
1637 1637
 				/**
@@ -1639,19 +1639,19 @@  discard block
 block discarded – undo
1639 1639
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1640 1640
 				 * @since 1.15
1641 1641
 				 */
1642
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1643
-					$css_dependencies[] = 'dashicons';
1642
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1643
+					$css_dependencies[ ] = 'dashicons';
1644 1644
 				}
1645 1645
 
1646 1646
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1647 1647
 
1648 1648
 				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1649 1649
 
1650
-				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 );
1650
+				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 );
1651 1651
 
1652 1652
 				wp_enqueue_script( 'gravityview-fe-view' );
1653 1653
 
1654
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1654
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1655 1655
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1656 1656
 				}
1657 1657
 
@@ -1719,7 +1719,7 @@  discard block
 block discarded – undo
1719 1719
 		} elseif ( empty( $template_id ) ) {
1720 1720
 			do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' );
1721 1721
 		} else {
1722
-			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) );
1722
+			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) );
1723 1723
 		}
1724 1724
 
1725 1725
 	}
@@ -1744,11 +1744,11 @@  discard block
 block discarded – undo
1744 1744
 		 * Not a table-based template; don't add sort icons
1745 1745
 		 * @since 1.12
1746 1746
 		 */
1747
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1747
+		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1748 1748
 			return $label;
1749 1749
 		}
1750 1750
 
1751
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1751
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1752 1752
 			return $label;
1753 1753
 		}
1754 1754
 
@@ -1756,29 +1756,29 @@  discard block
 block discarded – undo
1756 1756
 
1757 1757
 		$class = 'gv-sort';
1758 1758
 
1759
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1759
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1760 1760
 
1761 1761
 		$sort_args = array(
1762
-			'sort' => $field['id'],
1762
+			'sort' => $field[ 'id' ],
1763 1763
 			'dir' => 'asc',
1764 1764
 		);
1765 1765
 
1766
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1766
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1767 1767
 			//toggle sorting direction.
1768
-			if ( 'asc' === $sorting['direction'] ) {
1769
-				$sort_args['dir'] = 'desc';
1768
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1769
+				$sort_args[ 'dir' ] = 'desc';
1770 1770
 				$class .= ' gv-icon-sort-desc';
1771 1771
 			} else {
1772
-				$sort_args['dir'] = 'asc';
1772
+				$sort_args[ 'dir' ] = 'asc';
1773 1773
 				$class .= ' gv-icon-sort-asc';
1774 1774
 			}
1775 1775
 		} else {
1776 1776
 			$class .= ' gv-icon-caret-up-down';
1777 1777
 		}
1778 1778
 
1779
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1779
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
1780 1780
 
1781
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1781
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $label;
1782 1782
 
1783 1783
 	}
1784 1784
 
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
 
1797 1797
 		$field_type = $field_id;
1798 1798
 
1799
-		if( is_numeric( $field_id ) ) {
1799
+		if ( is_numeric( $field_id ) ) {
1800 1800
 			$field = GFFormsModel::get_field( $form, $field_id );
1801 1801
 			$field_type = $field->type;
1802 1802
 		}
@@ -1819,7 +1819,7 @@  discard block
 block discarded – undo
1819 1819
 			return false;
1820 1820
 		}
1821 1821
 
1822
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1822
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1823 1823
 
1824 1824
 	}
1825 1825
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 		}
459 459
 
460 460
 		// User reported WooCommerce doesn't pass two args.
461
-		if ( empty( $passed_post_id ) )  {
461
+		if ( empty( $passed_post_id ) ) {
462 462
 			return $title;
463 463
 		}
464 464
 
@@ -494,8 +494,9 @@  discard block
 block discarded – undo
494 494
 				}
495 495
 
496 496
 				/** No matching form sources were found, happens when requesting an entry from a different form . */
497
-				if ( ! isset( $view ) )
498
-					return $title;
497
+				if ( ! isset( $view ) ) {
498
+									return $title;
499
+				}
499 500
 			} else {
500 501
 				/** Deprecated. Use gravityview()->views->all() or gravityview()->request->all() */
501 502
 				foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
@@ -1478,7 +1479,7 @@  discard block
 block discarded – undo
1478 1479
 					 */
1479 1480
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1480 1481
 
1481
-					switch( strtolower( $address_part ) ){
1482
+					switch( strtolower( $address_part ) ) {
1482 1483
 						case 'street':
1483 1484
 							$sort_field_id .= '.1';
1484 1485
 							break;
@@ -1563,7 +1564,7 @@  discard block
 block discarded – undo
1563 1564
 		 */
1564 1565
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1565 1566
 
1566
-		if ( empty( $single_entry ) ){
1567
+		if ( empty( $single_entry ) ) {
1567 1568
 			return false;
1568 1569
 		} else {
1569 1570
 			return $single_entry;
Please login to merge, or discard this patch.
includes/class-common.php 1 patch
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
 		$form = false;
128 128
 
129
-		if( $entry ) {
130
-			$form = GFAPI::get_form( $entry['form_id'] );
129
+		if ( $entry ) {
130
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
131 131
 		}
132 132
 
133 133
 		return $form;
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 
194 194
 			$has_transaction_data = rgar( $entry, $meta, false );
195 195
 
196
-			if( ! empty( $has_transaction_data ) ) {
196
+			if ( ! empty( $has_transaction_data ) ) {
197 197
 				break;
198 198
 			}
199 199
 		}
200 200
 
201
-		return (bool) $has_transaction_data;
201
+		return (bool)$has_transaction_data;
202 202
 	}
203 203
 
204 204
 	/**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
238 238
 
239
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
239
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
240 240
 
241 241
 		return $result;
242 242
 	}
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
255 255
 	 */
256
-	public static function get_forms(  $active = true, $trash = false ) {
256
+	public static function get_forms( $active = true, $trash = false ) {
257 257
 		$forms = array();
258 258
 		if ( class_exists( 'GFAPI' ) ) {
259
-			if( 'any' === $active ) {
259
+			if ( 'any' === $active ) {
260 260
 				$active_forms = GFAPI::get_forms( true, $trash );
261 261
 				$inactive_forms = GFAPI::get_forms( false, $trash );
262 262
 				$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 		$has_post_fields = false;
288 288
 
289 289
 		if ( $form ) {
290
-			foreach ( $form['fields'] as $field ) {
291
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
292
-					$fields["{$field['id']}"] = array(
290
+			foreach ( $form[ 'fields' ] as $field ) {
291
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
292
+					$fields[ "{$field[ 'id' ]}" ] = array(
293 293
 						'label' => rgar( $field, 'label' ),
294 294
 						'parent' => null,
295 295
 						'type' => rgar( $field, 'type' ),
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 					);
299 299
 				}
300 300
 
301
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
302
-					foreach ( $field['inputs'] as $input ) {
301
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
302
+					foreach ( $field[ 'inputs' ] as $input ) {
303 303
 
304
-						if( ! empty( $input['isHidden'] ) ) {
304
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
305 305
 							continue;
306 306
 						}
307 307
 
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
                          * @hack
310 310
                          * In case of email/email confirmation, the input for email has the same id as the parent field
311 311
                          */
312
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
312
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
313 313
                             continue;
314 314
                         }
315
-						$fields["{$input['id']}"] = array(
315
+						$fields[ "{$input[ 'id' ]}" ] = array(
316 316
 							'label' => rgar( $input, 'label' ),
317 317
 							'customLabel' => rgar( $input, 'customLabel' ),
318 318
 							'parent' => $field,
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 				}
325 325
 
326 326
 
327
-				if( GFCommon::is_product_field( $field['type'] ) ){
327
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
328 328
 					$has_product_fields = true;
329 329
 				}
330 330
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		 * @since 1.7
339 339
 		 */
340 340
 		if ( $has_post_fields ) {
341
-			$fields['post_id'] = array(
341
+			$fields[ 'post_id' ] = array(
342 342
 				'label' => __( 'Post ID', 'gravityview' ),
343 343
 				'type' => 'post_id',
344 344
 			);
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 			foreach ( $payment_fields as $payment_field ) {
352 352
 
353 353
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
354
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
354
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
355 355
 					continue;
356 356
 				}
357 357
 
358
-				$fields["{$payment_field->name}"] = array(
358
+				$fields[ "{$payment_field->name}" ] = array(
359 359
 					'label' => $payment_field->label,
360 360
 					'desc' => $payment_field->description,
361 361
 					'type' => $payment_field->name,
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 
388 388
 		$fields = array();
389 389
 
390
-		foreach ( $extra_fields as $key => $field ){
391
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
392
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
390
+		foreach ( $extra_fields as $key => $field ) {
391
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
392
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
393 393
 			}
394 394
 		}
395 395
 
@@ -429,32 +429,32 @@  discard block
 block discarded – undo
429 429
 			'search_criteria' => null,
430 430
 			'sorting' => null,
431 431
 			'paging' => null,
432
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
432
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
433 433
 		);
434 434
 
435 435
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
436 436
 
437
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
438
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
437
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
438
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
439 439
 
440 440
 				if ( ! is_array( $filter ) ) {
441 441
 					continue;
442 442
 				}
443 443
 
444 444
 				// By default, we want searches to be wildcard for each field.
445
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
445
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
446 446
 
447 447
 				/**
448 448
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
449 449
 				 * @param string $operator Existing search operator
450 450
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
451 451
 				 */
452
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
452
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
453 453
 			}
454 454
 
455 455
 			// don't send just the [mode] without any field filter.
456
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
457
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
456
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
457
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
458 458
 			}
459 459
 
460 460
 		}
@@ -465,21 +465,21 @@  discard block
 block discarded – undo
465 465
 		 * Prepare date formats to be in Gravity Forms DB format;
466 466
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
467 467
 		 */
468
-		foreach ( array('start_date', 'end_date' ) as $key ) {
468
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
469 469
 
470
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
470
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
471 471
 
472 472
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
473
-				$date = date_create( $criteria['search_criteria'][ $key ] );
473
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
474 474
 
475 475
 				if ( $date ) {
476 476
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
477
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
477
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
478 478
 				} else {
479
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
479
+					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] );
480 480
 
481 481
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
482
-					unset( $criteria['search_criteria'][ $key ] );
482
+					unset( $criteria[ 'search_criteria' ][ $key ] );
483 483
 				}
484 484
 			}
485 485
 		}
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
 
499 499
 		// Calculate the context view id and send it to the advanced filter
500 500
 		if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
501
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
501
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
502 502
 		} elseif ( $multiple_original ) {
503
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
503
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
504 504
 		} elseif ( 'delete' === GFForms::get( 'action' ) ) {
505
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
506
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
505
+			$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
506
+		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) {
507 507
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
508
-			$criteria['context_view_id'] = null;
508
+			$criteria[ 'context_view_id' ] = null;
509 509
 		}
510 510
 
511 511
 		/**
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param array $form_ids Forms to search
515 515
 		 * @param int $view_id ID of the view being used to search
516 516
 		 */
517
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
517
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
518 518
 
519 519
 		return (array)$criteria;
520 520
 	}
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		/** Reduce # of database calls */
545 545
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
546 546
 
547
-		if ( ! empty( $criteria['cache'] ) ) {
547
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
548 548
 
549 549
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
550 550
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
 				// Still update the total count when using cached results
554 554
 				if ( ! is_null( $total ) ) {
555
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
555
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
556 556
 				}
557 557
 
558 558
 				$return = $entries;
@@ -572,9 +572,9 @@  discard block
 block discarded – undo
572 572
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
573 573
 
574 574
 			// No entries returned from gravityview_before_get_entries
575
-			if( is_null( $entries ) ) {
575
+			if ( is_null( $entries ) ) {
576 576
 
577
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
577
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
578 578
 
579 579
 				if ( is_wp_error( $entries ) ) {
580 580
 					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 				}
584 584
 			}
585 585
 
586
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
586
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
587 587
 
588 588
 				// Cache results
589 589
 				$Cache->set( $entries, 'entries' );
@@ -688,12 +688,12 @@  discard block
 block discarded – undo
688 688
 			 */
689 689
 			$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
690 690
 
691
-			if( $check_entry_display ) {
691
+			if ( $check_entry_display ) {
692 692
 				// Is the entry allowed
693 693
 				$entry = self::check_entry_display( $entry );
694 694
 			}
695 695
 
696
-			if( is_wp_error( $entry ) ) {
696
+			if ( is_wp_error( $entry ) ) {
697 697
 				do_action( 'gravityview_log_error', __METHOD__ . ': ' . $entry->get_error_message() );
698 698
 				return false;
699 699
 			}
@@ -725,12 +725,12 @@  discard block
 block discarded – undo
725 725
 
726 726
 		$value = false;
727 727
 
728
-		if( 'context' === $val1 ) {
728
+		if ( 'context' === $val1 ) {
729 729
 
730 730
 			$matching_contexts = array( $val2 );
731 731
 
732 732
 			// We allow for non-standard contexts.
733
-			switch( $val2 ) {
733
+			switch ( $val2 ) {
734 734
 				// Check for either single or edit
735 735
 				case 'singular':
736 736
 					$matching_contexts = array( 'single', 'edit' );
@@ -786,73 +786,73 @@  discard block
 block discarded – undo
786 786
 	public static function check_entry_display( $entry ) {
787 787
 
788 788
 		if ( ! $entry || is_wp_error( $entry ) ) {
789
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
789
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
790 790
 		}
791 791
 
792
-		if ( empty( $entry['form_id'] ) ) {
792
+		if ( empty( $entry[ 'form_id' ] ) ) {
793 793
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
794 794
 		}
795 795
 
796 796
 		$criteria = self::calculate_get_entries_criteria();
797 797
 
798
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
798
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
799 799
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
800 800
 			return $entry;
801 801
 		}
802 802
 
803 803
 		// Make sure the current View is connected to the same form as the Entry
804
-		if( ! empty( $criteria['context_view_id'] ) ) {
805
-			$context_view_id = intval( $criteria['context_view_id'] );
804
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
805
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
806 806
 			$context_form_id = gravityview_get_form_id( $context_view_id );
807
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
808
-				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
807
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
808
+				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] );
809 809
 			}
810 810
 		}
811 811
 
812
-		$search_criteria = $criteria['search_criteria'];
812
+		$search_criteria = $criteria[ 'search_criteria' ];
813 813
 
814 814
 		// check entry status
815
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
816
-			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
815
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
816
+			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
817 817
 		}
818 818
 
819 819
 		// check entry date
820 820
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
821 821
 
822 822
 		// field_filters
823
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
823
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
824 824
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
825 825
 			return $entry;
826 826
 		}
827 827
 
828
-		$filters = $search_criteria['field_filters'];
828
+		$filters = $search_criteria[ 'field_filters' ];
829 829
 
830
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
830
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
831 831
 
832
-		$form = self::get_form( $entry['form_id'] );
832
+		$form = self::get_form( $entry[ 'form_id' ] );
833 833
 
834 834
 		foreach ( $filters as $filter ) {
835 835
 
836
-			if ( ! isset( $filter['key'] ) ) {
836
+			if ( ! isset( $filter[ 'key' ] ) ) {
837 837
 				do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Filter key not set', $filter );
838 838
 				continue;
839 839
 			}
840 840
 
841
-			$k = $filter['key'];
841
+			$k = $filter[ 'key' ];
842 842
 
843 843
 			$field = self::get_field( $form, $k );
844 844
 
845 845
 			if ( is_null( $field ) ) {
846 846
 				$field_value = isset( $entry[ $k ] ) ? $entry[ $k ] : null;
847 847
 			} else {
848
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
848
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
849 849
 				 // If it's a complex field, then fetch the input's value, if exists at the current key. Otherwise, let GF handle it
850 850
 				$field_value = ( is_array( $field_value ) && isset( $field_value[ $k ] ) ) ? rgar( $field_value, $k ) : $field_value;
851 851
 			}
852 852
 
853
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
853
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
854 854
 
855
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
855
+			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
856 856
 
857 857
 			// Any match is all we need to know
858 858
 			if ( $is_value_match && 'any' === $mode ) {
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 
862 862
 			// Any failed match is a total fail
863 863
 			if ( ! $is_value_match && 'all' === $mode ) {
864
-				return new WP_Error('failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
864
+				return new WP_Error( 'failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
865 865
 			}
866 866
 		}
867 867
 
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved: all conditions were met' );
872 872
 			return $entry;
873 873
 		} else {
874
-			return new WP_Error('failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
874
+			return new WP_Error( 'failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
875 875
 		}
876 876
 
877 877
 	}
@@ -912,18 +912,18 @@  discard block
 block discarded – undo
912 912
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
913 913
 		 * @see GFCommon::format_date() for original code
914 914
 		 */
915
-		$date_gmt_time   = mysql2date( 'G', $date_string );
915
+		$date_gmt_time = mysql2date( 'G', $date_string );
916 916
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
917 917
 
918
-		$format  = rgar( $atts, 'format' );
919
-		$is_human  = ! empty( $atts['human'] );
920
-		$is_diff  = ! empty( $atts['diff'] );
921
-		$is_raw = ! empty( $atts['raw'] );
922
-		$is_timestamp = ! empty( $atts['timestamp'] );
923
-		$include_time = ! empty( $atts['time'] );
918
+		$format = rgar( $atts, 'format' );
919
+		$is_human = ! empty( $atts[ 'human' ] );
920
+		$is_diff = ! empty( $atts[ 'diff' ] );
921
+		$is_raw = ! empty( $atts[ 'raw' ] );
922
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
923
+		$include_time = ! empty( $atts[ 'time' ] );
924 924
 
925 925
 		// If we're using time diff, we want to have a different default format
926
-		if( empty( $format ) ) {
926
+		if ( empty( $format ) ) {
927 927
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
928 928
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
929 929
 		}
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
 		// If raw was specified, don't modify the stored value
932 932
 		if ( $is_raw ) {
933 933
 			$formatted_date = $date_string;
934
-		} elseif( $is_timestamp ) {
934
+		} elseif ( $is_timestamp ) {
935 935
 			$formatted_date = $date_local_timestamp;
936 936
 		} elseif ( $is_diff ) {
937 937
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 
966 966
 		$label = rgar( $field, 'label' );
967 967
 
968
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
968
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
969 969
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
970 970
 		}
971 971
 
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 			$form = GFAPI::get_form( $form );
994 994
 		}
995 995
 
996
-		if ( class_exists( 'GFFormsModel' ) ){
996
+		if ( class_exists( 'GFFormsModel' ) ) {
997 997
 			return GFFormsModel::get_field( $form, $field_id );
998 998
 		} else {
999 999
 			return null;
@@ -1040,19 +1040,19 @@  discard block
 block discarded – undo
1040 1040
 			$shortcodes = array();
1041 1041
 
1042 1042
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1043
-			if ( empty( $matches ) ){
1043
+			if ( empty( $matches ) ) {
1044 1044
 				return false;
1045 1045
 			}
1046 1046
 
1047 1047
 			foreach ( $matches as $shortcode ) {
1048
-				if ( $tag === $shortcode[2] ) {
1048
+				if ( $tag === $shortcode[ 2 ] ) {
1049 1049
 
1050 1050
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1051
-					$shortcodes[] = $shortcode;
1051
+					$shortcodes[ ] = $shortcode;
1052 1052
 
1053
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1054
-					foreach( $results as $result ) {
1055
-						$shortcodes[] = $result;
1053
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1054
+					foreach ( $results as $result ) {
1055
+						$shortcodes[ ] = $result;
1056 1056
 					}
1057 1057
 				}
1058 1058
 			}
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 	public static function get_directory_fields( $post_id, $apply_filter = true ) {
1197 1197
 		$fields = get_post_meta( $post_id, '_gravityview_directory_fields', true );
1198 1198
 
1199
-		if( $apply_filter ) {
1199
+		if ( $apply_filter ) {
1200 1200
 			/**
1201 1201
 			 * @filter `gravityview/configuration/fields` Filter the View fields' configuration array
1202 1202
 			 * @since 1.6.5
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 	 * @return string         html
1220 1220
 	 */
1221 1221
 	public static function get_sortable_fields( $formid, $current = '' ) {
1222
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1222
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1223 1223
 
1224 1224
 		if ( empty( $formid ) ) {
1225 1225
 			return $output;
@@ -1232,11 +1232,11 @@  discard block
 block discarded – undo
1232 1232
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1233 1233
 
1234 1234
 			foreach ( $fields as $id => $field ) {
1235
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1235
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1236 1236
 					continue;
1237 1237
 				}
1238 1238
 
1239
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1239
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1240 1240
 			}
1241 1241
 		}
1242 1242
 
@@ -1271,9 +1271,9 @@  discard block
 block discarded – undo
1271 1271
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1272 1272
 
1273 1273
 		// TODO: Convert to using array_filter
1274
-		foreach( $fields as $id => $field ) {
1274
+		foreach ( $fields as $id => $field ) {
1275 1275
 
1276
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1276
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1277 1277
 				unset( $fields[ $id ] );
1278 1278
 			}
1279 1279
 		}
@@ -1314,14 +1314,14 @@  discard block
 block discarded – undo
1314 1314
 	 * @param  int|array  $field field key or field array
1315 1315
 	 * @return boolean
1316 1316
 	 */
1317
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1317
+	public static function is_field_numeric( $form = null, $field = '' ) {
1318 1318
 
1319 1319
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1320 1320
 			$form = self::get_form( $form );
1321 1321
 		}
1322 1322
 
1323 1323
 		// If entry meta, it's a string. Otherwise, numeric
1324
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1324
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1325 1325
 			$type = $field;
1326 1326
 		} else {
1327 1327
 			$type = self::get_field_type( $form, $field );
@@ -1335,9 +1335,9 @@  discard block
 block discarded – undo
1335 1335
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1336 1336
 
1337 1337
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1338
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1339
-			if( true === $gv_field->is_numeric ) {
1340
-				$numeric_types[] = $gv_field->is_numeric;
1338
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1339
+			if ( true === $gv_field->is_numeric ) {
1340
+				$numeric_types[ ] = $gv_field->is_numeric;
1341 1341
 			}
1342 1342
 		}
1343 1343
 
@@ -1487,18 +1487,18 @@  discard block
 block discarded – undo
1487 1487
 		$final_atts = array_filter( $final_atts );
1488 1488
 
1489 1489
 		// If the href wasn't passed as an attribute, use the value passed to the function
1490
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1491
-			$final_atts['href'] = $href;
1490
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1491
+			$final_atts[ 'href' ] = $href;
1492 1492
 		}
1493 1493
 
1494
-		$final_atts['href'] = esc_url_raw( $href );
1494
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1495 1495
 
1496 1496
 		/**
1497 1497
 		 * Fix potential security issue with target=_blank
1498 1498
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1499 1499
 		 */
1500
-		if( '_blank' === rgar( $final_atts, 'target' ) ) {
1501
-			$final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1500
+		if ( '_blank' === rgar( $final_atts, 'target' ) ) {
1501
+			$final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1502 1502
 		}
1503 1503
 
1504 1504
 		// Sort the attributes alphabetically, to help testing
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1511 1511
 		}
1512 1512
 
1513
-		if( '' !== $output ) {
1513
+		if ( '' !== $output ) {
1514 1514
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1515 1515
 		}
1516 1516
 
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1538 1538
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1539 1539
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1540
-				$merged[] = $value;
1540
+				$merged[ ] = $value;
1541 1541
 			} else {
1542 1542
 				$merged[ $key ] = $value;
1543 1543
 			}
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1571 1571
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1572 1572
 		 */
1573
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1573
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1574 1574
 
1575 1575
 		return get_users( $get_users_settings );
1576 1576
 	}
@@ -1590,11 +1590,11 @@  discard block
 block discarded – undo
1590 1590
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1591 1591
 
1592 1592
     	// If $cap is defined, only show notice if user has capability
1593
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1593
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1594 1594
     		return '';
1595 1595
 	    }
1596 1596
 
1597
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1597
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1598 1598
     }
1599 1599
 
1600 1600
 	/**
Please login to merge, or discard this patch.