Completed
Push — develop ( 8ca23c...429df8 )
by Zack
06:51
created
future/includes/class-gv-shortcode-gvlogic.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
 		$value    = $this->get_value( $atts );
59 59
 
60 60
 		if ( false === $operator && is_null( $value ) ) {
61
-			if ( false !== $atts['if'] ) { // Only-if test
62
-				$match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) );
61
+			if ( false !== $atts[ 'if' ] ) { // Only-if test
62
+				$match = $authed && ! in_array( strtolower( $atts[ 'if' ] ), array( '', '0', 'false', 'no' ) );
63 63
 			} else {
64 64
 				$match = $authed; // Just login test
65 65
 			}
66 66
 		} else { // Regular test
67
-			$match = $authed && \GVCommon::matches_operation( $atts['if'], $value, $operator );
67
+			$match = $authed && \GVCommon::matches_operation( $atts[ 'if' ], $value, $operator );
68 68
 		}
69 69
 
70 70
 		$output = $this->get_output( $match, $atts, $content );
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @return string The output.
151 151
 	 */
152 152
 	private function get_output( $match, $atts, $content ) {
153
-		if ( ! $match && ! empty( $atts['else'] ) ) {
154
-			return $atts['else']; // Attributized else is easy :)
153
+		if ( ! $match && ! empty( $atts[ 'else' ] ) ) {
154
+			return $atts[ 'else' ]; // Attributized else is easy :)
155 155
 		}
156 156
 
157 157
 		$if = '';
@@ -278,18 +278,18 @@  discard block
 block discarded – undo
278 278
 		$atts = array_intersect_key( $supplied_atts, $atts );
279 279
 
280 280
 		// Strip whitespace if it's not default false
281
-		if ( isset( $atts['if'] ) && is_string( $atts['if'] ) ) {
282
-			$atts['if'] = trim( $atts['if'] );
281
+		if ( isset( $atts[ 'if' ] ) && is_string( $atts[ 'if' ] ) ) {
282
+			$atts[ 'if' ] = trim( $atts[ 'if' ] );
283 283
 		} else {
284
-			$atts['if'] = false;
284
+			$atts[ 'if' ] = false;
285 285
 		}
286 286
 
287
-		if ( isset( $atts['logged_in'] ) ) {
287
+		if ( isset( $atts[ 'logged_in' ] ) ) {
288 288
 			// Truthy
289
-			if ( in_array( strtolower( $atts['logged_in'] ), array( '0', 'false', 'no' ) ) ) {
290
-				$atts['logged_in'] = false;
289
+			if ( in_array( strtolower( $atts[ 'logged_in' ] ), array( '0', 'false', 'no' ) ) ) {
290
+				$atts[ 'logged_in' ] = false;
291 291
 			} else {
292
-				$atts['logged_in'] = true;
292
+				$atts[ 'logged_in' ] = true;
293 293
 			}
294 294
 		}
295 295
 
Please login to merge, or discard this patch.
includes/class-gravityview-entry-approval.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	private function add_hooks() {
40 40
 
41 41
 		// in case entry is edited (on admin or frontend)
42
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
42
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
43 43
 
44 44
 		// when using the User opt-in field, check on entry submission
45 45
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
46 46
 
47 47
 		// process ajax approve entry requests
48
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
48
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
49 49
 
50 50
 		// autounapprove
51 51
 		add_action( 'gravityview/edit_entry/after_update', array( __CLASS__, 'autounapprove' ), 10, 4 );
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 			return;
95 95
 		}
96 96
 
97
-		$form = GFAPI::get_form( $entry['form_id'] );
97
+		$form = GFAPI::get_form( $entry[ 'form_id' ] );
98 98
 
99 99
 		if ( ! $form ) {
100
-			gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry['form_id'], 'entry_id' => $entry_id ) );
100
+			gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $entry_id ) );
101 101
 			return;
102 102
 		}
103 103
 
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public static function add_approval_notification_events( $notification_events = array(), $form = array() ) {
116 116
 
117
-		$notification_events['gravityview/approve_entries/approved'] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' );
118
-		$notification_events['gravityview/approve_entries/disapproved'] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' );
119
-		$notification_events['gravityview/approve_entries/unapproved'] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' );
120
-		$notification_events['gravityview/approve_entries/updated'] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' );
117
+		$notification_events[ 'gravityview/approve_entries/approved' ] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' );
118
+		$notification_events[ 'gravityview/approve_entries/disapproved' ] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' );
119
+		$notification_events[ 'gravityview/approve_entries/unapproved' ] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' );
120
+		$notification_events[ 'gravityview/approve_entries/updated' ] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' );
121 121
 
122 122
 		return $notification_events;
123 123
 	}
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public static function get_entry_status( $entry, $value_or_label = 'label' ) {
137 137
 
138
-		$entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry, true );
138
+		$entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry, true );
139 139
 
140 140
 		$status = gform_get_meta( $entry_id, self::meta_key );
141 141
 
142 142
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
143 143
 
144
-		if( 'value' === $value_or_label ) {
144
+		if ( 'value' === $value_or_label ) {
145 145
 			return $status;
146 146
 		}
147 147
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		$nonce = \GV\Utils::_POST( 'nonce' );
180 180
 
181 181
 		// Valid status
182
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
182
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
183 183
 
184 184
 			gravityview()->log->error( 'Invalid approval status', array( 'data' => $_POST ) );
185 185
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
212 212
 
213
-			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') );
213
+			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) );
214 214
 
215 215
 		}
216 216
 
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 		}
273 273
 
274 274
 		// Set default
275
-		self::update_approved_meta( $entry['id'], $default_status, $entry['form_id'] );
275
+		self::update_approved_meta( $entry[ 'id' ], $default_status, $entry[ 'form_id' ] );
276 276
 
277 277
 		// Then check for if there is an approval column, and use that value instead
278
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
278
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
279 279
 	}
280 280
 
281 281
 	/**
@@ -289,12 +289,12 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
291 291
 
292
-		$approved_column = self::get_approved_column( $form['id'] );
292
+		$approved_column = self::get_approved_column( $form[ 'id' ] );
293 293
 
294 294
 		/**
295 295
 		 * If the form doesn't contain the approve field, don't assume anything.
296 296
 		 */
297
-		if( empty( $approved_column ) ) {
297
+		if ( empty( $approved_column ) ) {
298 298
 			return;
299 299
 		}
300 300
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 		 */
317 317
 		$value = apply_filters( 'gravityview/approve_entries/update_unapproved_meta', $value, $form, $entry );
318 318
 
319
-		self::update_approved_meta( $entry_id, $value, $form['id'] );
319
+		self::update_approved_meta( $entry_id, $value, $form[ 'id' ] );
320 320
 	}
321 321
 
322 322
 	/**
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public static function update_bulk( $entries = array(), $approved = 0, $form_id = 0 ) {
336 336
 
337
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
337
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
338 338
 			gravityview()->log->error( 'Entries were empty or malformed.', array( 'data' => $entries ) );
339 339
 			return NULL;
340 340
 		}
341 341
 
342
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
342
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
343 343
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
344 344
 			return NULL;
345 345
 		}
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
 		$approved_column_id = self::get_approved_column( $form_id );
355 355
 
356 356
 		$success = true;
357
-		foreach( $entries as $entry_id ) {
357
+		foreach ( $entries as $entry_id ) {
358 358
 			$update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
359 359
 
360
-			if( ! $update_success ) {
360
+			if ( ! $update_success ) {
361 361
 				$success = false;
362 362
 			}
363 363
 		}
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
 	 */
382 382
 	public static function update_approved( $entry_id = 0, $approved = 2, $form_id = 0, $approvedcolumn = 0 ) {
383 383
 
384
-		if( !class_exists( 'GFAPI' ) ) {
384
+		if ( ! class_exists( 'GFAPI' ) ) {
385 385
 			gravityview()->log->error( 'GFAPI does not exist' );
386 386
 			return false;
387 387
 		}
388 388
 
389
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
389
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
390 390
 			gravityview()->log->error( 'Not a valid approval value.' );
391 391
 			return false;
392 392
 		}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		// If the form has an Approve/Reject field, update that value
404 404
 		$result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn );
405 405
 
406
-		if( is_wp_error( $result ) ) {
406
+		if ( is_wp_error( $result ) ) {
407 407
 			gravityview()->log->error( 'Entry approval not updated: {error}', array( 'error' => $result->get_error_message() ) );
408 408
 			return false;
409 409
 		}
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
 		// add note to entry if approval field updating worked or there was no approved field
417 417
 		// There's no validation for the meta
418
-		if( true === $result ) {
418
+		if ( true === $result ) {
419 419
 
420 420
 			// Add an entry note
421 421
 			self::add_approval_status_updated_note( $entry_id, $approved );
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 
469 469
 		$note_id = false;
470 470
 
471
-		if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
471
+		if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
472 472
 
473 473
 			$current_user = wp_get_current_user();
474 474
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	 */
491 491
 	private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) {
492 492
 
493
-		if( empty( $approvedcolumn ) ) {
493
+		if ( empty( $approvedcolumn ) ) {
494 494
 			$approvedcolumn = self::get_approved_column( $form_id );
495 495
 		}
496 496
 
@@ -513,12 +513,12 @@  discard block
 block discarded – undo
513 513
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
514 514
 
515 515
 		$new_value = '';
516
-		if( GravityView_Entry_Approval_Status::APPROVED === $status ) {
516
+		if ( GravityView_Entry_Approval_Status::APPROVED === $status ) {
517 517
 			$new_value = self::get_approved_column_input_label( $form_id, $approvedcolumn );
518 518
 		}
519 519
 
520 520
 		//update entry
521
-		$entry["{$approvedcolumn}"] = $new_value;
521
+		$entry[ "{$approvedcolumn}" ] = $new_value;
522 522
 
523 523
 		/**
524 524
 		 * Note: GFAPI::update_entry() doesn't trigger `gform_after_update_entry`, so we trigger updating the meta ourselves
@@ -549,12 +549,12 @@  discard block
 block discarded – undo
549 549
 		// If the user has enabled a different value than the label (for some reason), use it.
550 550
 		// This is highly unlikely
551 551
 		if ( is_array( $field->choices ) && ! empty( $field->choices ) ) {
552
-			return isset( $field->choices[0]['value'] ) ? $field->choices[0]['value'] : $field->choices[0]['text'];
552
+			return isset( $field->choices[ 0 ][ 'value' ] ) ? $field->choices[ 0 ][ 'value' ] : $field->choices[ 0 ][ 'text' ];
553 553
 		}
554 554
 
555 555
 		// Otherwise, fall back on the inputs array
556 556
 		if ( is_array( $field->inputs ) && ! empty( $field->inputs ) ) {
557
-			return $field->inputs[0]['label'];
557
+			return $field->inputs[ 0 ][ 'label' ];
558 558
 		}
559 559
 
560 560
 		return null;
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 		 * @since 1.18 Added "unapproved"
607 607
 		 * @param  int $entry_id ID of the Gravity Forms entry
608 608
 		 */
609
-		do_action( 'gravityview/approve_entries/' . $action , $entry_id );
609
+		do_action( 'gravityview/approve_entries/' . $action, $entry_id );
610 610
 	}
611 611
 
612 612
 	/**
@@ -619,11 +619,11 @@  discard block
 block discarded – undo
619 619
 	 */
620 620
 	static public function get_approved_column( $form ) {
621 621
 
622
-		if( empty( $form ) ) {
622
+		if ( empty( $form ) ) {
623 623
 			return null;
624 624
 		}
625 625
 
626
-		if( !is_array( $form ) ) {
626
+		if ( ! is_array( $form ) ) {
627 627
 			$form = GVCommon::get_form( $form );
628 628
 		}
629 629
 
@@ -633,22 +633,22 @@  discard block
 block discarded – undo
633 633
 		 * @var string $key
634 634
 		 * @var GF_Field $field
635 635
 		 */
636
-		foreach( $form['fields'] as $key => $field ) {
636
+		foreach ( $form[ 'fields' ] as $key => $field ) {
637 637
 
638 638
 			$inputs = $field->get_entry_inputs();
639 639
 
640
-			if( !empty( $field->gravityview_approved ) ) {
641
-				if ( ! empty( $inputs ) && !empty( $inputs[0]['id'] ) ) {
642
-					$approved_column_id = $inputs[0]['id'];
640
+			if ( ! empty( $field->gravityview_approved ) ) {
641
+				if ( ! empty( $inputs ) && ! empty( $inputs[ 0 ][ 'id' ] ) ) {
642
+					$approved_column_id = $inputs[ 0 ][ 'id' ];
643 643
 					break;
644 644
 				}
645 645
 			}
646 646
 
647 647
 			// Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
648
-			if( 'checkbox' === $field->type && ! empty( $inputs ) ) {
648
+			if ( 'checkbox' === $field->type && ! empty( $inputs ) ) {
649 649
 				foreach ( $inputs as $input ) {
650
-					if ( 'approved' === strtolower( $input['label'] ) ) {
651
-						$approved_column_id = $input['id'];
650
+					if ( 'approved' === strtolower( $input[ 'label' ] ) ) {
651
+						$approved_column_id = $input[ 'id' ];
652 652
 						break;
653 653
 					}
654 654
 				}
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 
675 675
 		$view_keys = array_keys( $gv_data->get_views() );
676 676
 
677
-		$view = \GV\View::by_id( $view_keys[0] );
677
+		$view = \GV\View::by_id( $view_keys[ 0 ] );
678 678
 
679 679
 		if ( ! $view->settings->get( 'unapprove_edit' ) ) {
680 680
 			return;
@@ -699,11 +699,11 @@  discard block
 block discarded – undo
699 699
 			return;
700 700
 		}
701 701
 
702
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
702
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
703 703
 			$approval_status = GravityView_Entry_Approval_Status::UNAPPROVED;
704 704
 		}
705 705
 
706
-		self::update_approved_meta( $entry_id, $approval_status, $form['id'] );
706
+		self::update_approved_meta( $entry_id, $approval_status, $form[ 'id' ] );
707 707
 	}
708 708
 
709 709
 	/**
@@ -741,9 +741,9 @@  discard block
 block discarded – undo
741 741
 		$choices = GravityView_Entry_Approval_Status::get_all();
742 742
 
743 743
 		return <<<TEMPLATE
744
-<a href="#" data-approved="{$choices['approved']['value']}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-approved popover" title="{$choices['approved']['action']}"><span class="screen-reader-text">{$choices['approved']['action']}</span></a>
745
-<a href="#" data-approved="{$choices['disapproved']['value']}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-disapproved popover" title="{$choices['disapproved']['action']}"><span class="screen-reader-text">{$choices['disapproved']['action']}</span></a>
746
-<a href="#" data-approved="{$choices['unapproved']['value']}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-unapproved popover" title="{$choices['unapproved']['action']}"><span class="screen-reader-text">{$choices['unapproved']['action']}</span></a>
744
+<a href="#" data-approved="{$choices[ 'approved' ][ 'value' ]}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-approved popover" title="{$choices[ 'approved' ][ 'action' ]}"><span class="screen-reader-text">{$choices[ 'approved' ][ 'action' ]}</span></a>
745
+<a href="#" data-approved="{$choices[ 'disapproved' ][ 'value' ]}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-disapproved popover" title="{$choices[ 'disapproved' ][ 'action' ]}"><span class="screen-reader-text">{$choices[ 'disapproved' ][ 'action' ]}</span></a>
746
+<a href="#" data-approved="{$choices[ 'unapproved' ][ 'value' ]}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-unapproved popover" title="{$choices[ 'unapproved' ][ 'action' ]}"><span class="screen-reader-text">{$choices[ 'unapproved' ][ 'action' ]}</span></a>
747 747
 TEMPLATE;
748 748
 	}
749 749
 }
Please login to merge, or discard this patch.
includes/extensions/entry-notes/fields/notes.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 $gravityview_view = GravityView_View::getInstance();
10 10
 
11 11
 $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' );
12
-$show_notes_logged_out = ( ! empty( $visibility_settings['view'] ) && ! empty( $visibility_settings['view_loggedout'] ) );
12
+$show_notes_logged_out = ( ! empty( $visibility_settings[ 'view' ] ) && ! empty( $visibility_settings[ 'view_loggedout' ] ) );
13 13
 
14
-if(	! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) {
14
+if ( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) {
15 15
 	return;
16 16
 }
17 17
 
@@ -25,20 +25,20 @@  discard block
 block discarded – undo
25 25
 do_action( 'gravityview/field/notes/scripts' );
26 26
 
27 27
 $entry      = $gravityview_view->getCurrentEntry();
28
-$notes      = (array) GravityView_Entry_Notes::get_notes( $entry['id'] );
28
+$notes      = (array)GravityView_Entry_Notes::get_notes( $entry[ 'id' ] );
29 29
 $strings    = GravityView_Field_Notes::strings();
30
-$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
30
+$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
31 31
 
32
-$show_add = ! empty( $visibility_settings['add'] );
33
-$show_delete = ( ! empty( $visibility_settings['delete'] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) );
34
-$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings['view'] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) );
32
+$show_add = ! empty( $visibility_settings[ 'add' ] );
33
+$show_delete = ( ! empty( $visibility_settings[ 'delete' ] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) );
34
+$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings[ 'view' ] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) );
35 35
 
36 36
 $container_class = ( sizeof( $notes ) > 0 ? 'gv-has-notes' : 'gv-no-notes' );
37 37
 $container_class .= $show_notes ? ' gv-show-notes' : ' gv-hide-notes';
38 38
 ?>
39 39
 <div class="gv-notes <?php echo $container_class; ?>">
40 40
 <?php
41
-	if( $show_notes ) {
41
+	if ( $show_notes ) {
42 42
 ?>
43 43
 	<form method="post" class="gv-notes-list">
44 44
 		<?php if ( $show_delete ) { wp_nonce_field( 'gv_delete_notes_' . $entry_slug, 'gv_delete_notes' ); } ?>
@@ -46,21 +46,21 @@  discard block
 block discarded – undo
46 46
 			<input type="hidden" name="action" value="gv_delete_notes" />
47 47
 			<input type="hidden" name="entry-slug" value="<?php echo esc_attr( $entry_slug ); ?>" />
48 48
 			<table>
49
-				<caption><?php echo $strings['caption']; ?></caption>
49
+				<caption><?php echo $strings[ 'caption' ]; ?></caption>
50 50
 				<?php
51 51
 				if ( $show_delete ) {
52 52
 				?>
53 53
 				<thead>
54 54
 					<tr>
55 55
 						<th colspan="2">
56
-							<label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings['toggle-notes']; ?>"><span class="screen-reader-text"><?php echo $strings['toggle-notes']; ?></span></label>
57
-							<button type="submit" class="button button-small gv-notes-delete"><?php echo $strings['delete']; ?></button>
56
+							<label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings[ 'toggle-notes' ]; ?>"><span class="screen-reader-text"><?php echo $strings[ 'toggle-notes' ]; ?></span></label>
57
+							<button type="submit" class="button button-small gv-notes-delete"><?php echo $strings[ 'delete' ]; ?></button>
58 58
 						</th>
59 59
 					</tr>
60 60
 				</thead>
61 61
 				<?php } ?>
62 62
 				<tbody>
63
-					<tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings['no-notes']; ?></td></tr>
63
+					<tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings[ 'no-notes' ]; ?></td></tr>
64 64
 					<?php
65 65
 						foreach ( $notes as $note ) {
66 66
 							echo GravityView_Field_Notes::display_note( $note, $show_delete );
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 <?php
74 74
 	} // End if can view notes
75 75
 
76
-	if( $show_add ) {
76
+	if ( $show_add ) {
77 77
 		echo do_shortcode( '[gv_note_add]' );
78 78
 	}
79 79
 ?>
Please login to merge, or discard this patch.
future/includes/class-gv-renderer.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 
50 50
 		$post_types = get_post_types();
51 51
 
52
-		foreach( $post_types as $post_type ) {
52
+		foreach ( $post_types as $post_type ) {
53 53
 			$post_type_rewrite = get_post_type_object( $post_type )->rewrite;
54 54
 
55 55
 			if ( $slug = \GV\Utils::get( $post_type_rewrite, 'slug' ) ) {
56
-				$reserved_slugs[] = $slug;
56
+				$reserved_slugs[ ] = $slug;
57 57
 			}
58 58
 		}
59 59
 
@@ -89,8 +89,7 @@  discard block
 block discarded – undo
89 89
 				$tab = __( 'Edit Entry', 'gravityview' );
90 90
 				$context = 'edit';
91 91
 				break;
92
-			case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ):
93
-				$tab = __( 'Single Entry', 'gravityview' );
92
+			case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ) : $tab = __( 'Single Entry', 'gravityview' );
94 93
 				$context = 'single';
95 94
 				break;
96 95
 			default:
@@ -110,7 +109,7 @@  discard block
 block discarded – undo
110 109
 		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
111 110
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
112 111
 
113
-		$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
112
+		$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
114 113
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
115 114
 
116 115
 		echo \GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $gravityview->view->ID );
Please login to merge, or discard this patch.
includes/admin/class.render.settings.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$is_table_layout = preg_match( '/table/ism', $template_id );
32 32
 
33
-		if( 'field' === $field_type ) {
33
+		if ( 'field' === $field_type ) {
34 34
 
35 35
 			// Default options - fields
36 36
 			$field_options = array(
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 				'custom_class' => array(
50 50
 					'type' => 'text',
51 51
 					'label' => __( 'Custom CSS Class:', 'gravityview' ),
52
-					'desc' => __( 'This class will be added to the field container', 'gravityview'),
52
+					'desc' => __( 'This class will be added to the field container', 'gravityview' ),
53 53
 					'value' => '',
54 54
 					'merge_tags' => true,
55 55
 					'tooltip' => 'gv_css_merge_tags',
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 			);
71 71
 
72 72
 			// Match Table as well as DataTables
73
-			if( $is_table_layout && 'directory' === $context ) {
74
-				$field_options['width'] = array(
73
+			if ( $is_table_layout && 'directory' === $context ) {
74
+				$field_options[ 'width' ] = array(
75 75
 					'type' => 'number',
76
-					'label' => __('Percent Width', 'gravityview'),
77
-					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'),
76
+					'label' => __( 'Percent Width', 'gravityview' ),
77
+					'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ),
78 78
 					'class' => 'code widefat',
79 79
 					'value' => '',
80 80
 				);
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 			'manage_options' => __( 'Administrator', 'gravityview' ),
130 130
 		);
131 131
 
132
-		if( is_multisite() ) {
133
-			$select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' );
132
+		if ( is_multisite() ) {
133
+			$select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' );
134 134
 		}
135 135
 
136 136
 		/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		 * @param  string $context     Optional. What context are we in? Example: `single` or `directory`
144 144
 		 * @param  string $input_type  Optional. (textarea, list, select, etc.)
145 145
 		 */
146
-		$select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
146
+		$select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type );
147 147
 
148 148
 		return $select_cap_choices;
149 149
 	}
@@ -171,27 +171,27 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) {
173 173
 
174
-		if( empty( $uniqid ) ) {
174
+		if ( empty( $uniqid ) ) {
175 175
 			//generate a unique field id
176
-			$uniqid = uniqid('', false);
176
+			$uniqid = uniqid( '', false );
177 177
 		}
178 178
 
179 179
 		// get field/widget options
180 180
 		$options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id );
181 181
 
182 182
 		// two different post arrays, depending of the field type
183
-		$name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']';
183
+		$name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']';
184 184
 
185 185
 		// build output
186 186
 		$output = '';
187
-		$output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">';
188
-		$output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">';
187
+		$output .= '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">';
188
+		$output .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">';
189 189
 		if ( $form_id ) {
190
-			$output .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">';
190
+			$output .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">';
191 191
 		}
192 192
 
193 193
 		// If there are no options, return what we got.
194
-		if(empty($options)) {
194
+		if ( empty( $options ) ) {
195 195
 
196 196
 			// This is here for checking if the output is empty in render_label()
197 197
 			$output .= '<!-- No Options -->';
@@ -199,33 +199,33 @@  discard block
 block discarded – undo
199 199
 			return $output;
200 200
 		}
201 201
 
202
-		$output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">';
202
+		$output .= '<div class="gv-dialog-options" title="' . esc_attr( sprintf( __( 'Options: %s', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ) . '">';
203 203
 
204 204
 		/**
205 205
 		 * @since 1.8
206 206
 		 */
207
-		if( !empty( $item['subtitle'] ) ) {
208
-			$output .= '<div class="subtitle">' . $item['subtitle'] . '</div>';
207
+		if ( ! empty( $item[ 'subtitle' ] ) ) {
208
+			$output .= '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>';
209 209
 		}
210 210
 
211
-		foreach( $options as $key => $option ) {
211
+		foreach ( $options as $key => $option ) {
212 212
 
213 213
 			$value = isset( $current[ $key ] ) ? $current[ $key ] : NULL;
214 214
 
215
-			$field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value);
215
+			$field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value );
216 216
 
217 217
 			// The setting is empty
218
-			if( empty( $field_output ) ) {
218
+			if ( empty( $field_output ) ) {
219 219
 				continue;
220 220
 			}
221 221
 
222
-			switch( $option['type'] ) {
222
+			switch ( $option[ 'type' ] ) {
223 223
 				// Hide hidden fields
224 224
 				case 'hidden':
225
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>';
225
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>';
226 226
 					break;
227 227
 				default:
228
-					$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>';
228
+					$output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . '">' . $field_output . '</div>';
229 229
 			}
230 230
 		}
231 231
 
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 		 * @deprecated setting index 'default' was replaced by 'value'
255 255
 		 * @see GravityView_FieldType::get_field_defaults
256 256
 		 */
257
-		if( !empty( $option['default'] ) && empty( $option['value'] ) ) {
258
-			$option['value'] = $option['default'];
259
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' );
257
+		if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) {
258
+			$option[ 'value' ] = $option[ 'default' ];
259
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' );
260 260
 		}
261 261
 
262 262
 		// prepare to render option field type
263
-		if( isset( $option['type'] ) ) {
263
+		if ( isset( $option[ 'type' ] ) ) {
264 264
 
265 265
 			$type_class = self::load_type_class( $option );
266 266
 
267
-			if( class_exists( $type_class ) ) {
267
+			if ( class_exists( $type_class ) ) {
268 268
 
269 269
 				/** @var GravityView_FieldType $render_type */
270 270
 				$render_type = new $type_class( $name, $option, $curr_value );
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 				 * @param[in,out] string $output field class name
282 282
 				 * @param[in] array $option  option field data
283 283
 				 */
284
-				$output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option );
284
+				$output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option );
285 285
 			}
286 286
 
287 287
 		} // isset option[type]
@@ -316,27 +316,27 @@  discard block
 block discarded – undo
316 316
 		 * @deprecated setting index 'name' was replaced by 'label'
317 317
 		 * @see GravityView_FieldType::get_field_defaults
318 318
 		 */
319
-		if( isset( $setting['name'] ) && empty( $setting['label'] ) ) {
320
-			$setting['label'] = $setting['name'];
321
-			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' );
319
+		if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) {
320
+			$setting[ 'label' ] = $setting[ 'name' ];
321
+			_deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' );
322 322
 		}
323 323
 
324 324
 		$name = esc_attr( sprintf( $name, $key ) );
325
-		$setting['id'] = esc_attr( sprintf( $id, $key ) );
326
-		$setting['tooltip'] = 'gv_' . $key;
325
+		$setting[ 'id' ] = esc_attr( sprintf( $id, $key ) );
326
+		$setting[ 'tooltip' ] = 'gv_' . $key;
327 327
 
328 328
 		// Use default if current setting isn't set.
329
-		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value'];
329
+		$curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ];
330 330
 
331 331
 		// default setting type = text
332
-		$setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type'];
332
+		$setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ];
333 333
 
334 334
 		// merge tags
335
-		if( !isset( $setting['merge_tags'] ) ) {
336
-			if( $setting['type'] === 'text' ) {
337
-				$setting['merge_tags'] = true;
335
+		if ( ! isset( $setting[ 'merge_tags' ] ) ) {
336
+			if ( $setting[ 'type' ] === 'text' ) {
337
+				$setting[ 'merge_tags' ] = true;
338 338
 			} else {
339
-				$setting['merge_tags'] = false;
339
+				$setting[ 'merge_tags' ] = false;
340 340
 			}
341 341
 		}
342 342
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 
345 345
 		// render the setting
346 346
 		$type_class = self::load_type_class( $setting );
347
-		if( class_exists( $type_class ) ) {
347
+		if ( class_exists( $type_class ) ) {
348 348
 			/** @var GravityView_FieldType $render_type */
349 349
 			$render_type = new $type_class( $name, $setting, $curr_value );
350 350
 			ob_start();
@@ -353,25 +353,25 @@  discard block
 block discarded – undo
353 353
 		}
354 354
 
355 355
 		// Check if setting is specific for a template
356
-		if( !empty( $setting['show_in_template'] ) ) {
357
-			if( !is_array( $setting['show_in_template'] ) ) {
358
-				$setting['show_in_template'] = array( $setting['show_in_template'] );
356
+		if ( ! empty( $setting[ 'show_in_template' ] ) ) {
357
+			if ( ! is_array( $setting[ 'show_in_template' ] ) ) {
358
+				$setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] );
359 359
 			}
360
-			$show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"';
360
+			$show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"';
361 361
 		} else {
362 362
 			$show_if = '';
363 363
 		}
364 364
 
365
-		if( ! empty( $setting['requires'] ) ) {
366
-			$show_if .= sprintf( ' data-requires="%s"', $setting['requires'] );
365
+		if ( ! empty( $setting[ 'requires' ] ) ) {
366
+			$show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] );
367 367
 		}
368 368
 
369
-		if( ! empty( $setting['requires_not'] ) ) {
370
-			$show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] );
369
+		if ( ! empty( $setting[ 'requires_not' ] ) ) {
370
+			$show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] );
371 371
 		}
372 372
 
373 373
 		// output
374
-		echo '<tr valign="top" '. $show_if .'>' . $output . '</tr>';
374
+		echo '<tr valign="top" ' . $show_if . '>' . $output . '</tr>';
375 375
 
376 376
 	}
377 377
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 */
384 384
 	public static function load_type_class( $field = NULL ) {
385 385
 
386
-		if( empty( $field['type'] ) ) {
386
+		if ( empty( $field[ 'type' ] ) ) {
387 387
 			return NULL;
388 388
 		}
389 389
 
@@ -392,19 +392,19 @@  discard block
 block discarded – undo
392 392
 		 * @param string $class_suffix  field class suffix; `GravityView_FieldType_{$class_suffix}`
393 393
 		 * @param array $field   field data
394 394
 		 */
395
-		$type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field );
395
+		$type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field );
396 396
 
397
-		if( !class_exists( $type_class ) ) {
397
+		if ( ! class_exists( $type_class ) ) {
398 398
 
399 399
 			/**
400 400
 			 * @filter `gravityview/setting/class_file/{field_type}`
401 401
 			 * @param string  $field_type_include_path field class file path
402 402
 			 * @param array $field  field data
403 403
 			 */
404
-			$class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field );
404
+			$class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field );
405 405
 
406
-			if( $class_file ) {
407
-				if( file_exists( $class_file ) ) {
406
+			if ( $class_file ) {
407
+				if ( file_exists( $class_file ) ) {
408 408
 					require_once( $class_file );
409 409
 				}
410 410
 			}
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 
430 430
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' );
431 431
 
432
-		$output  = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">';
433
-		$output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >';
432
+		$output  = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">';
433
+		$output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >';
434 434
 
435 435
 		return $output;
436 436
 	}
@@ -450,22 +450,22 @@  discard block
 block discarded – undo
450 450
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' );
451 451
 
452 452
 		// Show the merge tags if the field is a list view
453
-		$is_list = ( preg_match( '/_list-/ism', $name ));
453
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
454 454
 
455 455
 		// Or is a single entry view
456
-		$is_single = ( preg_match( '/single_/ism', $name ));
456
+		$is_single = ( preg_match( '/single_/ism', $name ) );
457 457
 		$show = ( $is_single || $is_list );
458 458
 
459 459
 		$class = '';
460 460
 		// and $add_merge_tags is not false
461
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
461
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
462 462
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
463 463
 		}
464 464
 
465
-		$class .= !empty( $args['class'] ) ? $args['class'] : 'widefat';
466
-		$type = !empty( $args['type'] ) ? $args['type'] : 'text';
465
+		$class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat';
466
+		$type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text';
467 467
 
468
-		return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">';
468
+		return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">';
469 469
 	}
470 470
 
471 471
 	/**
@@ -482,21 +482,21 @@  discard block
 block discarded – undo
482 482
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' );
483 483
 
484 484
 		// Show the merge tags if the field is a list view
485
-		$is_list = ( preg_match( '/_list-/ism', $name ));
485
+		$is_list = ( preg_match( '/_list-/ism', $name ) );
486 486
 
487 487
 		// Or is a single entry view
488
-		$is_single = ( preg_match( '/single_/ism', $name ));
488
+		$is_single = ( preg_match( '/single_/ism', $name ) );
489 489
 		$show = ( $is_single || $is_list );
490 490
 
491 491
 		$class = '';
492 492
 		// and $add_merge_tags is not false
493
-		if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
493
+		if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) {
494 494
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
495 495
 		}
496 496
 
497
-		$class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat';
497
+		$class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat';
498 498
 
499
-		return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>';
499
+		return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>';
500 500
 	}
501 501
 
502 502
 	/**
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 
513 513
 		_deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' );
514 514
 
515
-		$output = '<select name="'. $name .'" id="'. $id .'">';
516
-		foreach( $choices as $value => $label ) {
517
-			$output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>';
515
+		$output = '<select name="' . $name . '" id="' . $id . '">';
516
+		foreach ( $choices as $value => $label ) {
517
+			$output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>';
518 518
 		}
519 519
 		$output .= '</select>';
520 520
 
Please login to merge, or discard this patch.
includes/class-gravityview-logging.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
 
8 8
 	function __construct() {
9 9
 
10
-		add_action( 'gravityview_log_error', array( $this, 'log_error'), 10, 2 );
10
+		add_action( 'gravityview_log_error', array( $this, 'log_error' ), 10, 2 );
11 11
 
12
-		add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 );
12
+		add_action( 'gravityview_log_debug', array( $this, 'log_debug' ), 10, 2 );
13 13
 
14 14
 		// Enable debug with Gravity Forms Logging Add-on
15 15
 	    add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) );
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 			include_once( GRAVITYVIEW_DIR . 'includes/class-debug-bar.php' );
35 35
 		}
36 36
 
37
-		$panels[] = new GravityView_Debug_Bar;
37
+		$panels[ ] = new GravityView_Debug_Bar;
38 38
 
39 39
 		return $panels;
40 40
 	}
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param array $supported_plugins List of plugins
45 45
 	 */
46 46
 	public function enable_gform_logging( $supported_plugins ) {
47
-	    $supported_plugins['gravityview'] = 'GravityView';
47
+	    $supported_plugins[ 'gravityview' ] = 'GravityView';
48 48
 	    return $supported_plugins;
49 49
 	}
50 50
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @return string "print_r" or "var_export"
73 73
 	 */
74 74
 	static function get_print_function() {
75
-		if( ob_get_level() > 0 ) {
75
+		if ( ob_get_level() > 0 ) {
76 76
 			$function = 'var_export';
77 77
 		} else {
78 78
 			$function = 'print_r';
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 			'data' => $data,
91 91
 		);
92 92
 
93
-		if( !in_array( $notice, self::$notices ) ) {
94
-			self::$notices[] = $notice;
93
+		if ( ! in_array( $notice, self::$notices ) ) {
94
+			self::$notices[ ] = $notice;
95 95
 		}
96 96
 
97
-		if ( class_exists("GFLogging") ) {
97
+		if ( class_exists( "GFLogging" ) ) {
98 98
 			GFLogging::include_logger();
99
-	        GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG );
99
+	        GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::DEBUG );
100 100
 	    }
101 101
 	}
102 102
 
103
-	static function log_error( $message = '', $data = null  ) {
103
+	static function log_error( $message = '', $data = null ) {
104 104
 
105 105
 		$function = self::get_print_function();
106 106
 
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 			'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '',
111 111
 		);
112 112
 
113
-		if( !in_array( $error, self::$errors ) ) {
114
-			self::$errors[] = $error;
113
+		if ( ! in_array( $error, self::$errors ) ) {
114
+			self::$errors[ ] = $error;
115 115
 		}
116 116
 
117
-		if ( class_exists("GFLogging") ) {
117
+		if ( class_exists( "GFLogging" ) ) {
118 118
 		    GFLogging::include_logger();
119
-		    GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ( $error, true), KLogger::ERROR );
119
+		    GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $error, true ), KLogger::ERROR );
120 120
 		}
121 121
 	}
122 122
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	static function is_logging_active( $plugin = 'gravityview' ) {
135 135
 
136
-		if( ! class_exists( 'GFLogging') ) {
136
+		if ( ! class_exists( 'GFLogging' ) ) {
137 137
 			return false;
138 138
 		}
139 139
 
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				'type' => 'radio',
65 65
 				'full_width' => true,
66 66
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
67
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
67
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
68 68
 				'value' => 'any',
69 69
 				'class' => 'hide-if-js',
70 70
 				'options' => array(
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
85 85
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
86
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
86
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
87 87
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
88 88
 
89 89
 			// ajax - get the searchable fields
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
228 228
 		$script_source = empty( $script_min ) ? '/source' : '';
229 229
 
230
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
230
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
231 231
 
232 232
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
233 233
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
250 250
 	 */
251 251
 	public function register_no_conflict( $allowed ) {
252
-		$allowed[] = 'gravityview_searchwidget_admin';
252
+		$allowed[ ] = 'gravityview_searchwidget_admin';
253 253
 		return $allowed;
254 254
 	}
255 255
 
@@ -262,24 +262,24 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	public static function get_searchable_fields() {
264 264
 
265
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
265
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
266 266
 			exit( '0' );
267 267
 		}
268 268
 
269 269
 		$form = '';
270 270
 
271 271
 		// Fetch the form for the current View
272
-		if ( ! empty( $_POST['view_id'] ) ) {
272
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
273 273
 
274
-			$form = gravityview_get_form_id( $_POST['view_id'] );
274
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
275 275
 
276
-		} elseif ( ! empty( $_POST['formid'] ) ) {
276
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
277 277
 
278
-			$form = (int) $_POST['formid'];
278
+			$form = (int)$_POST[ 'formid' ];
279 279
 
280
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
280
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
281 281
 
282
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
282
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
283 283
 
284 284
 		}
285 285
 
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
 		);
330 330
 
331 331
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
332
-			$custom_fields['is_approved'] = array(
332
+			$custom_fields[ 'is_approved' ] = array(
333 333
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
334 334
 				'type' => 'multi',
335 335
 			);
336 336
 		}
337 337
 
338
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
339
-			$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'] );
338
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
339
+			$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' ] );
340 340
 		}
341 341
 
342 342
 		// Get fields with sub-inputs and no parent
@@ -358,13 +358,13 @@  discard block
 block discarded – undo
358 358
 
359 359
 			foreach ( $fields as $id => $field ) {
360 360
 
361
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
361
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
362 362
 					continue;
363 363
 				}
364 364
 
365
-				$types = self::get_search_input_types( $id, $field['type'] );
365
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
366 366
 
367
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
367
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
368 368
 			}
369 369
 		}
370 370
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
388 388
 
389 389
 		// @todo - This needs to be improved - many fields have . including products and addresses
390
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
390
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
391 391
 			$input_type = 'boolean'; // on/off checkbox
392 392
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
393 393
 			$input_type = 'multi'; //multiselect
@@ -433,19 +433,19 @@  discard block
 block discarded – undo
433 433
 			$post_id = 0;
434 434
 
435 435
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
436
-			if ( ! empty( $widget_args['post_id'] ) ) {
437
-				$post_id = absint( $widget_args['post_id'] );
436
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
437
+				$post_id = absint( $widget_args[ 'post_id' ] );
438 438
 			}
439 439
 			// We're in the WordPress Widget context, and the base View ID should be used
440
-			else if ( ! empty( $widget_args['view_id'] ) ) {
441
-				$post_id = absint( $widget_args['view_id'] );
440
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
441
+				$post_id = absint( $widget_args[ 'view_id' ] );
442 442
 			}
443 443
 
444 444
 			$args = gravityview_get_permalink_query_args( $post_id );
445 445
 
446 446
 			// Add hidden fields to the search form
447 447
 			foreach ( $args as $key => $value ) {
448
-				$search_fields[] = array(
448
+				$search_fields[ ] = array(
449 449
 					'name'  => $key,
450 450
 					'input' => 'hidden',
451 451
 					'value' => $value,
@@ -484,28 +484,28 @@  discard block
 block discarded – undo
484 484
 		/**
485 485
 		 * Include the sidebar Widgets.
486 486
 		 */
487
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
487
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
488 488
 
489 489
 		foreach ( $widgets as $widget ) {
490
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
491
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
490
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
491
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
492 492
 					foreach ( $_fields as $field ) {
493
-						if ( empty( $field['form_id'] ) ) {
494
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
493
+						if ( empty( $field[ 'form_id' ] ) ) {
494
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
495 495
 						}
496
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
496
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
497 497
 					}
498 498
 				}
499 499
 			}
500 500
 		}
501 501
 
502 502
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
503
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
503
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
504 504
 				foreach ( $_fields as $field ) {
505
-					if ( empty( $field['form_id'] ) ) {
506
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
505
+					if ( empty( $field[ 'form_id' ] ) ) {
506
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
507 507
 					}
508
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
508
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
509 509
 				}
510 510
 			}
511 511
 		}
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
544 544
 		}
545 545
 
546
-		if( 'post' === $this->search_method ) {
546
+		if ( 'post' === $this->search_method ) {
547 547
 			$get = $_POST;
548 548
 		} else {
549 549
 			$get = $_GET;
@@ -562,15 +562,15 @@  discard block
 block discarded – undo
562 562
 		$get = gv_map_deep( $get, 'rawurldecode' );
563 563
 
564 564
 		// Make sure array key is set up
565
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
565
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
566 566
 
567 567
 		$searchable_fields = $this->get_view_searchable_fields( $view );
568 568
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
569 569
 
570 570
 		// add free search
571
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
571
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
572 572
 
573
-			$search_all_value = trim( $get['gv_search'] );
573
+			$search_all_value = trim( $get[ 'gv_search' ] );
574 574
 
575 575
 			/**
576 576
 			 * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase?
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 			}
596 596
 
597 597
 			foreach ( $words as $word ) {
598
-				$search_criteria['field_filters'][] = array(
598
+				$search_criteria[ 'field_filters' ][ ] = array(
599 599
 					'key' => null, // The field ID to search
600 600
 					'value' => $word, // The value to search
601 601
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -608,14 +608,14 @@  discard block
 block discarded – undo
608 608
 			/**
609 609
 			 * Get and normalize the dates according to the input format.
610 610
 			 */
611
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
612
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
611
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
612
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
613 613
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
614 614
 				}
615 615
 			}
616 616
 
617
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
618
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
617
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
618
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
619 619
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
620 620
 				}
621 621
 			}
@@ -650,22 +650,22 @@  discard block
 block discarded – undo
650 650
 			 */
651 651
 			if ( ! empty( $curr_start ) ) {
652 652
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
653
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
653
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
654 654
 			}
655 655
 
656 656
 			if ( ! empty( $curr_end ) ) {
657 657
 				// Fast-forward 24 hour on the end time
658 658
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
659
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
660
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
661
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
659
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
660
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
661
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
662 662
 				}
663 663
 			}
664 664
 		}
665 665
 
666 666
 		// search for a specific entry ID
667 667
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
668
-			$search_criteria['field_filters'][] = array(
668
+			$search_criteria[ 'field_filters' ][ ] = array(
669 669
 				'key' => 'id',
670 670
 				'value' => absint( $get[ 'gv_id' ] ),
671 671
 				'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ),
@@ -674,20 +674,20 @@  discard block
 block discarded – undo
674 674
 
675 675
 		// search for a specific Created_by ID
676 676
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
677
-			$search_criteria['field_filters'][] = array(
677
+			$search_criteria[ 'field_filters' ][ ] = array(
678 678
 				'key' => 'created_by',
679
-				'value' => $get['gv_by'],
679
+				'value' => $get[ 'gv_by' ],
680 680
 				'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ),
681 681
 			);
682 682
 		}
683 683
 
684 684
 		// Get search mode passed in URL
685
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
685
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
686 686
 
687 687
 		// get the other search filters
688 688
 		foreach ( $get as $key => $value ) {
689 689
 
690
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
690
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
691 691
 				continue; // Not a filter, or empty
692 692
 			}
693 693
 
@@ -701,19 +701,19 @@  discard block
 block discarded – undo
701 701
 				continue;
702 702
 			}
703 703
 
704
-			if ( ! isset( $filter['operator'] ) ) {
705
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
704
+			if ( ! isset( $filter[ 'operator' ] ) ) {
705
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
706 706
 			}
707 707
 
708
-			if ( isset( $filter[0]['value'] ) ) {
709
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
708
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
709
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
710 710
 
711 711
 				// if date range type, set search mode to ALL
712
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
712
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
713 713
 					$mode = 'all';
714 714
 				}
715
-			} elseif( !empty( $filter ) ) {
716
-				$search_criteria['field_filters'][] = $filter;
715
+			} elseif ( ! empty( $filter ) ) {
716
+				$search_criteria[ 'field_filters' ][ ] = $filter;
717 717
 			}
718 718
 		}
719 719
 
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 		 * @since 1.5.1
723 723
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
724 724
 		 */
725
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
725
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
726 726
 
727 727
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
728 728
 
@@ -756,19 +756,19 @@  discard block
 block discarded – undo
756 756
 
757 757
 		$query_class = $view->get_query_class();
758 758
 
759
-		if ( empty( $search_criteria['field_filters'] ) ) {
759
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
760 760
 			return;
761 761
 		}
762 762
 
763 763
 		$widgets = $view->widgets->by_id( $this->widget_id );
764 764
 		if ( $widgets->count() ) {
765 765
 			$widgets = $widgets->all();
766
-			$widget  = $widgets[0];
766
+			$widget  = $widgets[ 0 ];
767 767
 
768 768
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
769 769
 
770
-			foreach ( (array) $search_fields as $search_field ) {
771
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
770
+			foreach ( (array)$search_fields as $search_field ) {
771
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
772 772
 					$created_by_text_mode = true;
773 773
 				}
774 774
 			}
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 		$extra_conditions = array();
778 778
 		$mode = 'any';
779 779
 
780
-		foreach ( $search_criteria['field_filters'] as &$filter ) {
780
+		foreach ( $search_criteria[ 'field_filters' ] as &$filter ) {
781 781
 			if ( ! is_array( $filter ) ) {
782 782
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
783 783
 					$mode = $filter;
@@ -786,13 +786,13 @@  discard block
 block discarded – undo
786 786
 			}
787 787
 
788 788
 			// Construct a manual query for unapproved statuses
789
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
790
-				$_tmp_query       = new $query_class( $view->form->ID, array(
789
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
790
+				$_tmp_query = new $query_class( $view->form->ID, array(
791 791
 					'field_filters' => array(
792 792
 						array(
793 793
 							'operator' => 'in',
794 794
 							'key'      => 'is_approved',
795
-							'value'    => (array) $filter['value'],
795
+							'value'    => (array)$filter[ 'value' ],
796 796
 						),
797 797
 						array(
798 798
 							'operator' => 'is',
@@ -804,30 +804,30 @@  discard block
 block discarded – undo
804 804
 				) );
805 805
 				$_tmp_query_parts = $_tmp_query->_introspect();
806 806
 
807
-				$extra_conditions[] = $_tmp_query_parts['where'];
807
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
808 808
 
809 809
 				$filter = false;
810 810
 				continue;
811 811
 			}
812 812
 
813 813
 			// Construct manual query for text mode creator search
814
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
815
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
814
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
815
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
816 816
 				$filter = false;
817 817
 				continue;
818 818
 			}
819 819
 
820 820
 			// By default, we want searches to be wildcard for each field.
821
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
821
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
822 822
 
823 823
 			// For multichoice, let's have an in (OR) search.
824
-			if ( is_array( $filter['value'] ) ) {
825
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
824
+			if ( is_array( $filter[ 'value' ] ) ) {
825
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
826 826
 			}
827 827
 
828 828
 			// Default form with joins functionality
829
-			if ( empty( $filter['form_id'] ) ) {
830
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
829
+			if ( empty( $filter[ 'form_id' ] ) ) {
830
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
831 831
 			}
832 832
 
833 833
 			/**
@@ -837,28 +837,28 @@  discard block
 block discarded – undo
837 837
 			 * @since develop
838 838
 			 * @param \GV\View $view The View we're operating on.
839 839
 			 */
840
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );
840
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view );
841 841
 		}
842 842
 
843
-		if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) {
843
+		if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) {
844 844
 			$date_criteria = array();
845 845
 
846
-			if ( isset( $search_criteria['start_date'] ) ) {
847
-				$date_criteria['start_date'] = $search_criteria['start_date'];
846
+			if ( isset( $search_criteria[ 'start_date' ] ) ) {
847
+				$date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ];
848 848
 			}
849 849
 
850
-			if ( isset( $search_criteria['end_date'] ) ) {
851
-				$date_criteria['end_date'] = $search_criteria['end_date'];
850
+			if ( isset( $search_criteria[ 'end_date' ] ) ) {
851
+				$date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ];
852 852
 			}
853 853
 
854 854
 			$_tmp_query         = new $query_class( $view->form->ID, $date_criteria );
855 855
 			$_tmp_query_parts   = $_tmp_query->_introspect();
856
-			$extra_conditions[] = $_tmp_query_parts['where'];
856
+			$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
857 857
 		}
858 858
 
859 859
 		$search_conditions = array();
860 860
 
861
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
861
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
862 862
 			foreach ( $filters as &$filter ) {
863 863
 				if ( ! is_array( $filter ) ) {
864 864
 					continue;
@@ -870,12 +870,12 @@  discard block
 block discarded – undo
870 870
 				 * code by reusing what's inside GF_Query already as they
871 871
 				 * take care of many small things like forcing numeric, etc.
872 872
 				 */
873
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
873
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
874 874
 				$_tmp_query_parts = $_tmp_query->_introspect();
875
-				$search_condition = $_tmp_query_parts['where'];
875
+				$search_condition = $_tmp_query_parts[ 'where' ];
876 876
 
877
-				if ( empty( $filter['key'] ) && $search_condition->expressions ) {
878
-					$search_conditions[] = $search_condition;
877
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
878
+					$search_conditions[ ] = $search_condition;
879 879
 				} else {
880 880
 					$left = $search_condition->left;
881 881
 					$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 							$on = $_join->join_on;
886 886
 							$join = $_join->join;
887 887
 
888
-							$search_conditions[] = GF_Query_Condition::_or(
888
+							$search_conditions[ ] = GF_Query_Condition::_or(
889 889
 								// Join
890 890
 								new GF_Query_Condition(
891 891
 									new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ),
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 							);
902 902
 						}
903 903
 					} else {
904
-						$search_conditions[] = new GF_Query_Condition(
904
+						$search_conditions[ ] = new GF_Query_Condition(
905 905
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
906 906
 							$search_condition->operator,
907 907
 							$search_condition->right
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 		/**
924 924
 		 * Combine the parts as a new WHERE clause.
925 925
 		 */
926
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
926
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
927 927
 		$query->where( $where );
928 928
 	}
929 929
 
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 		$field_id = str_replace( 'filter_', '', $key );
947 947
 
948 948
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
949
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
949
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
950 950
 			$field_id = str_replace( '_', '.', $field_id );
951 951
 		}
952 952
 
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 			// form is in searchable fields
1004 1004
 			$found = false;
1005 1005
 			foreach ( $searchable_fields as $field ) {
1006
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
1006
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
1007 1007
 					$found = true;
1008 1008
 					break;
1009 1009
 				}
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
 			case 'select':
1045 1045
 			case 'radio':
1046
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1046
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1047 1047
 				break;
1048 1048
 
1049 1049
 			case 'post_category':
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 				foreach ( $value as $val ) {
1059 1059
 					$cat = get_term( $val, 'category' );
1060
-					$filter[] = array(
1060
+					$filter[ ] = array(
1061 1061
 						'key'      => $field_id,
1062 1062
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
1063 1063
 						'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 				$filter = array();
1077 1077
 
1078 1078
 				foreach ( $value as $val ) {
1079
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1079
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1080 1080
 				}
1081 1081
 
1082 1082
 				break;
@@ -1085,9 +1085,9 @@  discard block
 block discarded – undo
1085 1085
 				// convert checkbox on/off into the correct search filter
1086 1086
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1087 1087
 					foreach ( $form_field->inputs as $k => $input ) {
1088
-						if ( $input['id'] == $field_id ) {
1089
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1090
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1088
+						if ( $input[ 'id' ] == $field_id ) {
1089
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1090
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1091 1091
 							break;
1092 1092
 						}
1093 1093
 					}
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 					$filter = array();
1098 1098
 
1099 1099
 					foreach ( $value as $val ) {
1100
-						$filter[] = array(
1100
+						$filter[ ] = array(
1101 1101
 							'key'      => $field_id,
1102 1102
 							'value'    => $val,
1103 1103
 							'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1118,9 +1118,9 @@  discard block
 block discarded – undo
1118 1118
 					foreach ( $words as $word ) {
1119 1119
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1120 1120
 							// Keep the same key for each filter
1121
-							$filter['value'] = $word;
1121
+							$filter[ 'value' ] = $word;
1122 1122
 							// Add a search for the value
1123
-							$filters[] = $filter;
1123
+							$filters[ ] = $filter;
1124 1124
 						}
1125 1125
 					}
1126 1126
 
@@ -1134,19 +1134,19 @@  discard block
 block discarded – undo
1134 1134
 
1135 1135
 					foreach ( $searchable_fields as $searchable_field ) {
1136 1136
 
1137
-						if( $form_field->ID !== $searchable_field['field'] ) {
1137
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1138 1138
 							continue;
1139 1139
 						}
1140 1140
 
1141 1141
 						// Only exact-match dropdowns, not text search
1142
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1142
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1143 1143
 							continue;
1144 1144
 						}
1145 1145
 
1146 1146
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1147 1147
 
1148 1148
 						if ( 4 === $input_id ) {
1149
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1149
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1150 1150
 						};
1151 1151
 					}
1152 1152
 				}
@@ -1173,12 +1173,12 @@  discard block
 block discarded – undo
1173 1173
 						 * @since 1.16.3
1174 1174
 						 * Safeguard until GF implements '<=' operator
1175 1175
 						 */
1176
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1176
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1177 1177
 							$operator = '<';
1178 1178
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1179 1179
 						}
1180 1180
 
1181
-						$filter[] = array(
1181
+						$filter[ ] = array(
1182 1182
 							'key'      => $field_id,
1183 1183
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1184 1184
 							'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ),
@@ -1186,8 +1186,8 @@  discard block
 block discarded – undo
1186 1186
 					}
1187 1187
 				} else {
1188 1188
 					$date = $value;
1189
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1190
-					$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1189
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1190
+					$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1191 1191
 				}
1192 1192
 
1193 1193
 				break;
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
 			'ymd_dot' => 'Y.m.d',
1219 1219
 		);
1220 1220
 
1221
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1221
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1222 1222
 			$format = $datepicker[ $field->dateFormat ];
1223 1223
 		}
1224 1224
 
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 	public function add_template_path( $file_paths ) {
1256 1256
 
1257 1257
 		// Index 100 is the default GravityView template path.
1258
-		$file_paths[102] = self::$file . 'templates/';
1258
+		$file_paths[ 102 ] = self::$file . 'templates/';
1259 1259
 
1260 1260
 		return $file_paths;
1261 1261
 	}
@@ -1274,7 +1274,7 @@  discard block
 block discarded – undo
1274 1274
 		$has_date = false;
1275 1275
 
1276 1276
 		foreach ( $search_fields as $k => $field ) {
1277
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1277
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1278 1278
 				$has_date = true;
1279 1279
 				break;
1280 1280
 			}
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 		}
1302 1302
 
1303 1303
 		// get configured search fields
1304
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1304
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1305 1305
 
1306 1306
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1307 1307
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1317,40 +1317,40 @@  discard block
 block discarded – undo
1317 1317
 
1318 1318
 			$updated_field = $this->get_search_filter_details( $updated_field, $context );
1319 1319
 
1320
-			switch ( $field['field'] ) {
1320
+			switch ( $field[ 'field' ] ) {
1321 1321
 
1322 1322
 				case 'search_all':
1323
-					$updated_field['key'] = 'search_all';
1324
-					$updated_field['input'] = 'search_all';
1325
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1323
+					$updated_field[ 'key' ] = 'search_all';
1324
+					$updated_field[ 'input' ] = 'search_all';
1325
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1326 1326
 					break;
1327 1327
 
1328 1328
 				case 'entry_date':
1329
-					$updated_field['key'] = 'entry_date';
1330
-					$updated_field['input'] = 'entry_date';
1331
-					$updated_field['value'] = array(
1329
+					$updated_field[ 'key' ] = 'entry_date';
1330
+					$updated_field[ 'input' ] = 'entry_date';
1331
+					$updated_field[ 'value' ] = array(
1332 1332
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1333 1333
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1334 1334
 					);
1335 1335
 					break;
1336 1336
 
1337 1337
 				case 'entry_id':
1338
-					$updated_field['key'] = 'entry_id';
1339
-					$updated_field['input'] = 'entry_id';
1340
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1338
+					$updated_field[ 'key' ] = 'entry_id';
1339
+					$updated_field[ 'input' ] = 'entry_id';
1340
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1341 1341
 					break;
1342 1342
 
1343 1343
 				case 'created_by':
1344
-					$updated_field['key'] = 'created_by';
1345
-					$updated_field['name'] = 'gv_by';
1346
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1347
-					$updated_field['choices'] = self::get_created_by_choices( $view );
1344
+					$updated_field[ 'key' ] = 'created_by';
1345
+					$updated_field[ 'name' ] = 'gv_by';
1346
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1347
+					$updated_field[ 'choices' ] = self::get_created_by_choices( $view );
1348 1348
 					break;
1349 1349
 
1350 1350
 				case 'is_approved':
1351
-					$updated_field['key'] = 'is_approved';
1352
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1353
-					$updated_field['choices'] = self::get_is_approved_choices();
1351
+					$updated_field[ 'key' ] = 'is_approved';
1352
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1353
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1354 1354
 					break;
1355 1355
 			}
1356 1356
 
@@ -1371,16 +1371,16 @@  discard block
 block discarded – undo
1371 1371
 
1372 1372
 		$gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args );
1373 1373
 
1374
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1374
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1375 1375
 
1376 1376
 		/** @since 1.14 */
1377
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1377
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1378 1378
 
1379
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1379
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1380 1380
 
1381 1381
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1382 1382
 
1383
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1383
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1384 1384
 
1385 1385
 		if ( $this->has_date_field( $search_fields ) ) {
1386 1386
 			// enqueue datepicker stuff only if needed!
@@ -1402,10 +1402,10 @@  discard block
 block discarded – undo
1402 1402
 	public static function get_search_class( $custom_class = '' ) {
1403 1403
 		$gravityview_view = GravityView_View::getInstance();
1404 1404
 
1405
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1405
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1406 1406
 
1407
-		if ( ! empty( $custom_class )  ) {
1408
-			$search_class .= ' '.$custom_class;
1407
+		if ( ! empty( $custom_class ) ) {
1408
+			$search_class .= ' ' . $custom_class;
1409 1409
 		}
1410 1410
 
1411 1411
 		/**
@@ -1449,9 +1449,9 @@  discard block
 block discarded – undo
1449 1449
 
1450 1450
 		if ( ! $label ) {
1451 1451
 
1452
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1452
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1453 1453
 
1454
-			switch( $field['field'] ) {
1454
+			switch ( $field[ 'field' ] ) {
1455 1455
 				case 'search_all':
1456 1456
 					$label = __( 'Search Entries:', 'gravityview' );
1457 1457
 					break;
@@ -1463,10 +1463,10 @@  discard block
 block discarded – undo
1463 1463
 					break;
1464 1464
 				default:
1465 1465
 					// If this is a field input, not a field
1466
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1466
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1467 1467
 
1468 1468
 						// Get the label for the field in question, which returns an array
1469
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1469
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1470 1470
 
1471 1471
 						// Get the item with the `label` key
1472 1472
 						$values = wp_list_pluck( $items, 'label' );
@@ -1507,35 +1507,35 @@  discard block
 block discarded – undo
1507 1507
 		$form = $gravityview_view->getForm();
1508 1508
 
1509 1509
 		// for advanced field ids (eg, first name / last name )
1510
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1510
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1511 1511
 
1512 1512
 		// get searched value from $_GET/$_POST (string or array)
1513 1513
 		$value = $this->rgget_or_rgpost( $name );
1514 1514
 
1515 1515
 		// get form field details
1516
-		$form_field = gravityview_get_field( $form, $field['field'] );
1516
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1517 1517
 
1518 1518
 		$filter = array(
1519
-			'key' => $field['field'],
1519
+			'key' => $field[ 'field' ],
1520 1520
 			'name' => $name,
1521 1521
 			'label' => self::get_field_label( $field, $form_field ),
1522
-			'input' => $field['input'],
1522
+			'input' => $field[ 'input' ],
1523 1523
 			'value' => $value,
1524
-			'type' => $form_field['type'],
1524
+			'type' => $form_field[ 'type' ],
1525 1525
 		);
1526 1526
 
1527 1527
 		// collect choices
1528
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1529
-			$filter['choices'] = gravityview_get_terms_choices();
1530
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1531
-			$filter['choices'] = $form_field['choices'];
1528
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1529
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1530
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1531
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1532 1532
 		}
1533 1533
 
1534
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1535
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1534
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1535
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1536 1536
 		}
1537 1537
 
1538
-		if ( ! empty( $filter['choices'] ) ) {
1538
+		if ( ! empty( $filter[ 'choices' ] ) ) {
1539 1539
 			/**
1540 1540
 			 * @filter `gravityview/search/sieve_choices` Only output used choices for this field.
1541 1541
 			 * @param[in,out] bool Yes or no.
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
 			 * @param \GV\Context The context.
1544 1544
 			 */
1545 1545
 			if ( apply_filters( 'gravityview/search/sieve_choices', false, $field, $context ) ) {
1546
-				$filter['choices'] = $this->sieve_filter_choices( $filter, $context );
1546
+				$filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context );
1547 1547
 			}
1548 1548
 		}
1549 1549
 
@@ -1572,11 +1572,11 @@  discard block
 block discarded – undo
1572 1572
 	 * @return array The filter choices.
1573 1573
 	 */
1574 1574
 	private function sieve_filter_choices( $filter, $context ) {
1575
-		if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) {
1575
+		if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) {
1576 1576
 			return $filter; // @todo Populate plugins might give us empty choices
1577 1577
 		}
1578 1578
 
1579
-		if ( ! is_numeric( $filter['key'] ) ) {
1579
+		if ( ! is_numeric( $filter[ 'key' ] ) ) {
1580 1580
 			return $filter;
1581 1581
 		}
1582 1582
 
@@ -1586,29 +1586,29 @@  discard block
 block discarded – undo
1586 1586
 
1587 1587
 		$table = GFFormsModel::get_entry_meta_table_name();
1588 1588
 
1589
-		$key_like = $wpdb->esc_like( $filter['key'] ) . '.%';
1589
+		$key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%';
1590 1590
 
1591 1591
 		switch ( \GV\Utils::get( $filter, 'type' ) ):
1592 1592
 			case 'post_category':
1593 1593
 				$choices = $wpdb->get_col( $wpdb->prepare(
1594 1594
 					"SELECT DISTINCT SUBSTRING_INDEX(meta_value, ':', 1) FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1595
-					$key_like, $filter['key'], $form_id
1595
+					$key_like, $filter[ 'key' ], $form_id
1596 1596
 				) );
1597 1597
 				break;
1598 1598
 			default:
1599 1599
 				$choices = $wpdb->get_col( $wpdb->prepare(
1600 1600
 					"SELECT DISTINCT meta_value FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1601
-					$key_like, $filter['key'], $form_id
1601
+					$key_like, $filter[ 'key' ], $form_id
1602 1602
 				) );
1603 1603
 
1604
-				if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) {
1604
+				if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) {
1605 1605
 					$choices = array_map( 'json_decode', $choices );
1606 1606
 					$_choices_array = array();
1607 1607
 					foreach ( $choices as $choice ) {
1608 1608
 						if ( is_array( $choice ) ) {
1609 1609
 							$_choices_array = array_merge( $_choices_array, $choice );
1610 1610
 						} else {
1611
-							$_choices_array []= $choice;
1611
+							$_choices_array [ ] = $choice;
1612 1612
 						}
1613 1613
 					}
1614 1614
 					$choices = array_unique( $_choices_array );
@@ -1618,9 +1618,9 @@  discard block
 block discarded – undo
1618 1618
 		endswitch;
1619 1619
 
1620 1620
 		$filter_choices = array();
1621
-		foreach ( $filter['choices'] as $choice ) {
1622
-			if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) {
1623
-				$filter_choices[] = $choice;
1621
+		foreach ( $filter[ 'choices' ] as $choice ) {
1622
+			if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) {
1623
+				$filter_choices[ ] = $choice;
1624 1624
 			}
1625 1625
 		}
1626 1626
 
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 			 * @param \GV\View $view The view.
1656 1656
 			 */
1657 1657
 			$text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view );
1658
-			$choices[] = array(
1658
+			$choices[ ] = array(
1659 1659
 				'value' => $user->ID,
1660 1660
 				'text' => $text,
1661 1661
 			);
@@ -1675,9 +1675,9 @@  discard block
 block discarded – undo
1675 1675
 
1676 1676
 		$choices = array();
1677 1677
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1678
-			$choices[] = array(
1679
-				'value' => $status['value'],
1680
-				'text' => $status['label'],
1678
+			$choices[ ] = array(
1679
+				'value' => $status[ 'value' ],
1680
+				'text' => $status[ 'label' ],
1681 1681
 			);
1682 1682
 		}
1683 1683
 
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
 	 */
1730 1730
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1731 1731
 
1732
-		$js_dependencies[] = 'jquery-ui-datepicker';
1732
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1733 1733
 
1734 1734
 		return $js_dependencies;
1735 1735
 	}
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 			'isRTL'             => is_rtl(),
1774 1774
 		), $view_data );
1775 1775
 
1776
-		$localizations['datepicker'] = $datepicker_settings;
1776
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1777 1777
 
1778 1778
 		return $localizations;
1779 1779
 
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 	 * @return void
1801 1801
 	 */
1802 1802
 	private function maybe_enqueue_flexibility() {
1803
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1803
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1804 1804
 			wp_enqueue_script( 'gv-flexibility' );
1805 1805
 		}
1806 1806
 	}
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1823 1823
 
1824 1824
 		$scheme = is_ssl() ? 'https://' : 'http://';
1825
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1825
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1826 1826
 
1827 1827
 		/**
1828 1828
 		 * @filter `gravityview_search_datepicker_class`
@@ -1901,7 +1901,7 @@  discard block
 block discarded – undo
1901 1901
 	public function add_preview_inputs() {
1902 1902
 		global $wp;
1903 1903
 
1904
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
1904
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
1905 1905
 			return;
1906 1906
 		}
1907 1907
 
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
  */
1954 1954
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
1955 1955
 	public function __construct( $filter, $view ) {
1956
-		$this->value = $filter['value'];
1956
+		$this->value = $filter[ 'value' ];
1957 1957
 		$this->view = $view;
1958 1958
 	}
1959 1959
 
@@ -1985,11 +1985,11 @@  discard block
 block discarded – undo
1985 1985
 		$conditions = array();
1986 1986
 
1987 1987
 		foreach ( $user_fields as $user_field ) {
1988
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
1988
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
1989 1989
 		}
1990 1990
 
1991 1991
 		foreach ( $user_meta_fields as $meta_field ) {
1992
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
1992
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
1993 1993
 		}
1994 1994
 
1995 1995
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
Please login to merge, or discard this patch.
includes/class-frontend-views.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	private function __construct() {}
86 86
 
87 87
 	private function initialize() {
88
-		add_action( 'wp', array( $this, 'parse_content'), 11 );
88
+		add_action( 'wp', array( $this, 'parse_content' ), 11 );
89 89
 		add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 );
90
-		add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 );
90
+		add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 );
91 91
 
92 92
 		// Enqueue scripts and styles after GravityView_Template::register_styles()
93 93
 		add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 );
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 
237 237
 			$this->context_view_id = $view_id;
238 238
 
239
-		} elseif ( isset( $_GET['gvid'] ) && $multiple_views ) {
239
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) {
240 240
 			/**
241 241
 			 * used on a has_multiple_views context
242 242
 			 * @see GravityView_API::entry_link
243 243
 			 */
244
-			$this->context_view_id = $_GET['gvid'];
244
+			$this->context_view_id = $_GET[ 'gvid' ];
245 245
 
246 246
 		} elseif ( ! $multiple_views ) {
247 247
 			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
@@ -278,25 +278,25 @@  discard block
 block discarded – undo
278 278
 		global $wp_rewrite;
279 279
 
280 280
 		$is_front_page = ( $query->is_home || $query->is_page );
281
-		$show_on_front = ( 'page' === get_option('show_on_front') );
282
-		$front_page_id = get_option('page_on_front');
281
+		$show_on_front = ( 'page' === get_option( 'show_on_front' ) );
282
+		$front_page_id = get_option( 'page_on_front' );
283 283
 
284
-		if (  $is_front_page && $show_on_front && $front_page_id ) {
284
+		if ( $is_front_page && $show_on_front && $front_page_id ) {
285 285
 
286 286
 			// Force to be an array, potentially a query string ( entry=16 )
287 287
 			$_query = wp_parse_args( $query->query );
288 288
 
289 289
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
290
-			if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) {
291
-				unset( $_query['pagename'] );
290
+			if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) {
291
+				unset( $_query[ 'pagename' ] );
292 292
 			}
293 293
 
294 294
 			// this is where will break from core wordpress
295 295
 			/** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */
296 296
 			$ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query );
297 297
 			$endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' );
298
-			foreach ( (array) $endpoints as $endpoint ) {
299
-				$ignore[] = $endpoint[1];
298
+			foreach ( (array)$endpoints as $endpoint ) {
299
+				$ignore[ ] = $endpoint[ 1 ];
300 300
 			}
301 301
 			unset( $endpoints );
302 302
 
@@ -306,21 +306,21 @@  discard block
 block discarded – undo
306 306
 			// - The query includes keys that are associated with registered endpoints. `entry`, for example.
307 307
 			if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) {
308 308
 
309
-				$qv =& $query->query_vars;
309
+				$qv = & $query->query_vars;
310 310
 
311 311
 				// Prevent redirect when on the single entry endpoint
312
-				if( self::is_single_entry() ) {
312
+				if ( self::is_single_entry() ) {
313 313
 					add_filter( 'redirect_canonical', '__return_false' );
314 314
 				}
315 315
 
316 316
 				$query->is_page = true;
317 317
 				$query->is_home = false;
318
-				$qv['page_id']  = $front_page_id;
318
+				$qv[ 'page_id' ]  = $front_page_id;
319 319
 
320 320
 				// Correct <!--nextpage--> for page_on_front
321
-				if ( ! empty( $qv['paged'] ) ) {
322
-					$qv['page'] = $qv['paged'];
323
-					unset( $qv['paged'] );
321
+				if ( ! empty( $qv[ 'paged' ] ) ) {
322
+					$qv[ 'page' ] = $qv[ 'paged' ];
323
+					unset( $qv[ 'paged' ] );
324 324
 				}
325 325
 			}
326 326
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' );
352 352
 
353
-		$post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null );
353
+		$post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null );
354 354
 		$this->setPostId( $post_id );
355 355
 		$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false;
356 356
 		$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) );
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 		$search_method = GravityView_Widget_Search::getInstance()->get_search_method();
388 388
 
389
-		if( 'post' === $search_method ) {
389
+		if ( 'post' === $search_method ) {
390 390
 			$get = $_POST;
391 391
 		} else {
392 392
 			$get = $_GET;
@@ -443,20 +443,20 @@  discard block
 block discarded – undo
443 443
 		 * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop
444 444
 		 * @param array $entry Current entry
445 445
 		 */
446
-		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry );
446
+		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry );
447 447
 
448 448
 		if ( ! $apply_outside_loop ) {
449 449
 			return $title;
450 450
 		}
451 451
 
452 452
 		// User reported WooCommerce doesn't pass two args.
453
-		if ( empty( $passed_post_id ) )  {
453
+		if ( empty( $passed_post_id ) ) {
454 454
 			return $title;
455 455
 		}
456 456
 
457 457
 		// Don't modify the title for anything other than the current view/post.
458 458
 		// This is true for embedded shortcodes and Views.
459
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
459
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
460 460
 			return $title;
461 461
 		}
462 462
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 			$view_meta = $this->getGvOutputData()->get_view( $context_view_id );
469 469
 		} else {
470 470
 			foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
471
-				if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) {
471
+				if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) {
472 472
 					$view_meta = $view_data;
473 473
 					break;
474 474
 				}
@@ -476,12 +476,12 @@  discard block
 block discarded – undo
476 476
 		}
477 477
 
478 478
 		/** Deprecated stuff in the future. See the branch above. */
479
-		if ( ! empty( $view_meta['atts']['single_title'] ) ) {
479
+		if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) {
480 480
 
481
-			$title = $view_meta['atts']['single_title'];
481
+			$title = $view_meta[ 'atts' ][ 'single_title' ];
482 482
 
483 483
 			// We are allowing HTML in the fields, so no escaping the output
484
-			$title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry );
484
+			$title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry );
485 485
 
486 486
 			$title = do_shortcode( $title );
487 487
 		}
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
 		$context = GravityView_View::getInstance()->getContext();
554 554
 
555
-		switch( $context ) {
555
+		switch ( $context ) {
556 556
 			case 'directory':
557 557
 				$tab = __( 'Multiple Entries', 'gravityview' );
558 558
 				break;
@@ -566,12 +566,12 @@  discard block
 block discarded – undo
566 566
 		}
567 567
 
568 568
 
569
-		$title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
569
+		$title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
570 570
 		$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) );
571
-		$action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab );
571
+		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
572 572
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
573 573
 
574
-		$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
574
+		$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
575 575
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
576 576
 
577 577
 		echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id );
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 		$direct_access = apply_filters( 'gravityview_direct_access', true, $view->ID );
620 620
 		$embed_only = $view->settings->get( 'embed_only' );
621 621
 
622
-		if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
622
+		if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
623 623
 			return __( 'You are not allowed to view this content.', 'gravityview' );
624 624
 		}
625 625
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 				$datetime_format = 'Y-m-d H:i:s';
667 667
 				$search_is_outside_view_bounds = false;
668 668
 
669
-				if( ! empty( $search_criteria[ $key ] ) ) {
669
+				if ( ! empty( $search_criteria[ $key ] ) ) {
670 670
 
671 671
 					$search_date = strtotime( $search_criteria[ $key ] );
672 672
 
@@ -694,14 +694,14 @@  discard block
 block discarded – undo
694 694
 				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
695 695
 
696 696
 					// Then we override the search and re-set the start date
697
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
697
+					$return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true );
698 698
 				}
699 699
 			}
700 700
 		}
701 701
 
702
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
702
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
703 703
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
704
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
704
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
705 705
 				gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) );
706 706
 			}
707 707
 		}
@@ -720,19 +720,19 @@  discard block
 block discarded – undo
720 720
 	public static function process_search_only_approved( $args, $search_criteria ) {
721 721
 
722 722
 		/** @since 1.19 */
723
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
723
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
724 724
 			gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' );
725 725
 			return $search_criteria;
726 726
 		}
727 727
 
728
-		if ( ! empty( $args['show_only_approved'] ) ) {
728
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
729 729
 
730
-			$search_criteria['field_filters'][] = array(
730
+			$search_criteria[ 'field_filters' ][ ] = array(
731 731
 				'key' => GravityView_Entry_Approval::meta_key,
732 732
 				'value' => GravityView_Entry_Approval_Status::APPROVED
733 733
 			);
734 734
 
735
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
735
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
736 736
 
737 737
 			gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) );
738 738
 		}
@@ -759,18 +759,18 @@  discard block
 block discarded – undo
759 759
 	 */
760 760
 	public static function is_entry_approved( $entry, $args = array() ) {
761 761
 
762
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
762
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
763 763
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
764 764
 			return true;
765 765
 		}
766 766
 
767 767
 		/** @since 1.19 */
768
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
768
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
769 769
 			gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' );
770 770
 			return true;
771 771
 		}
772 772
 
773
-		$is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key );
773
+		$is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key );
774 774
 
775 775
 		return GravityView_Entry_Approval_Status::is_approved( $is_approved );
776 776
 	}
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 		 * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`.
795 795
 		 */
796 796
 		$criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) );
797
-		$search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() );
797
+		$search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() );
798 798
 
799 799
 		/**
800 800
 		 * @filter `gravityview_fe_search_criteria` Modify the search criteria
@@ -810,29 +810,29 @@  discard block
 block discarded – undo
810 810
 		gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' =>$search_criteria ) );
811 811
 
812 812
 		// implicity search
813
-		if ( ! empty( $args['search_value'] ) ) {
813
+		if ( ! empty( $args[ 'search_value' ] ) ) {
814 814
 
815 815
 			// Search operator options. Options: `is` or `contains`
816
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
816
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
817 817
 
818
-			$search_criteria['field_filters'][] = array(
818
+			$search_criteria[ 'field_filters' ][ ] = array(
819 819
 				'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search
820
-				'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes.
820
+				'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes.
821 821
 				'operator' => $operator,
822 822
 			);
823 823
 
824 824
 			// Lock search mode to "all" with implicit presearch filter.
825
-			$search_criteria['field_filters']['mode'] = 'all';
825
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all';
826 826
 		}
827 827
 
828
-		if( $search_criteria !== $original_search_criteria ) {
828
+		if ( $search_criteria !== $original_search_criteria ) {
829 829
 			gravityview()->log->debug( '[get_search_criteria] Search Criteria after implicity search: ', array( 'data' => $search_criteria ) );
830 830
 		}
831 831
 
832 832
 		// Handle setting date range
833 833
 		$search_criteria = self::process_search_dates( $args, $search_criteria );
834 834
 
835
-		if( $search_criteria !== $original_search_criteria ) {
835
+		if ( $search_criteria !== $original_search_criteria ) {
836 836
 			gravityview()->log->debug( '[get_search_criteria] Search Criteria after date params: ', array( 'data' => $search_criteria ) );
837 837
 		}
838 838
 
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
844 844
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
845 845
 		 */
846
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
846
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
847 847
 
848 848
 		return $search_criteria;
849 849
 	}
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			'search_criteria' => $search_criteria,
957 957
 			'sorting' => self::updateViewSorting( $args, $form_id ),
958 958
 			'paging' => $paging,
959
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
959
+			'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
960 960
 		);
961 961
 
962 962
 		/**
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
982 982
 		 * @param array $args View configuration args.
983 983
 		 */
984
-		$parameters = apply_filters( 'gravityview_get_entries_'.\GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id );
984
+		$parameters = apply_filters( 'gravityview_get_entries_' . \GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id );
985 985
 
986 986
 		gravityview()->log->debug( '$parameters passed to gravityview_get_entries(): ', array( 'data' => $parameters ) );
987 987
 
@@ -1006,17 +1006,17 @@  discard block
 block discarded – undo
1006 1006
 		$default_page_size = apply_filters( 'gravityview_default_page_size', 25 );
1007 1007
 
1008 1008
 		// Paging & offset
1009
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size;
1009
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size;
1010 1010
 
1011 1011
 		if ( -1 === $page_size ) {
1012 1012
 			$page_size = PHP_INT_MAX;
1013 1013
 		}
1014 1014
 
1015
-		$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
1015
+		$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
1016 1016
 		$offset = ( $curr_page - 1 ) * $page_size;
1017 1017
 
1018
-		if ( ! empty( $args['offset'] ) ) {
1019
-			$offset += intval( $args['offset'] );
1018
+		if ( ! empty( $args[ 'offset' ] ) ) {
1019
+			$offset += intval( $args[ 'offset' ] );
1020 1020
 		}
1021 1021
 
1022 1022
 		$paging = array(
@@ -1041,11 +1041,11 @@  discard block
 block discarded – undo
1041 1041
 	public static function updateViewSorting( $args, $form_id ) {
1042 1042
 		$sorting = array();
1043 1043
 
1044
-		$has_values = isset( $_GET['sort'] );
1044
+		$has_values = isset( $_GET[ 'sort' ] );
1045 1045
 
1046
-		if ( $has_values && is_array( $_GET['sort'] ) ) {
1047
-			$sorts = array_keys( $_GET['sort'] );
1048
-			$dirs  = array_values( $_GET['sort'] );
1046
+		if ( $has_values && is_array( $_GET[ 'sort' ] ) ) {
1047
+			$sorts = array_keys( $_GET[ 'sort' ] );
1048
+			$dirs  = array_values( $_GET[ 'sort' ] );
1049 1049
 
1050 1050
 			if ( $has_values = array_filter( $dirs ) ) {
1051 1051
 				$sort_field_id = end( $sorts );
@@ -1054,11 +1054,11 @@  discard block
 block discarded – undo
1054 1054
 		}
1055 1055
 
1056 1056
 		if ( ! isset( $sort_field_id ) ) {
1057
-			$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' );
1057
+			$sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' );
1058 1058
 		}
1059 1059
 
1060 1060
 		if ( ! isset( $sort_direction ) ) {
1061
-			$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' );
1061
+			$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' );
1062 1062
 		}
1063 1063
 
1064 1064
 		if ( is_array( $sort_field_id ) ) {
@@ -1090,10 +1090,10 @@  discard block
 block discarded – undo
1090 1090
 				$form = GFAPI::get_form( $form_id );
1091 1091
 
1092 1092
 				// Get the first GF_Field field ID, set as the key for entry randomization
1093
-				if ( ! empty( $form['fields'] ) ) {
1093
+				if ( ! empty( $form[ 'fields' ] ) ) {
1094 1094
 
1095 1095
 					/** @var GF_Field $field */
1096
-					foreach ( $form['fields'] as $field ) {
1096
+					foreach ( $form[ 'fields' ] as $field ) {
1097 1097
 						if ( ! is_a( $field, 'GF_Field' ) ) {
1098 1098
 							continue;
1099 1099
 						}
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 		if ( is_array( $sort_field_id ) ) {
1139 1139
 			$modified_ids = array();
1140 1140
 			foreach ( $sort_field_id as $_sort_field_id ) {
1141
-				$modified_ids []= self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id );
1141
+				$modified_ids [ ] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id );
1142 1142
 			}
1143 1143
 			return $modified_ids;
1144 1144
 		}
@@ -1147,11 +1147,11 @@  discard block
 block discarded – undo
1147 1147
 
1148 1148
 		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1149 1149
 
1150
-		if( ! $sort_field ) {
1150
+		if ( ! $sort_field ) {
1151 1151
 			return $sort_field_id;
1152 1152
 		}
1153 1153
 
1154
-		switch ( $sort_field['type'] ) {
1154
+		switch ( $sort_field[ 'type' ] ) {
1155 1155
 
1156 1156
 			case 'address':
1157 1157
 				// Sorting by full address
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 					 */
1169 1169
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1170 1170
 
1171
-					switch( strtolower( $address_part ) ){
1171
+					switch ( strtolower( $address_part ) ) {
1172 1172
 						case 'street':
1173 1173
 							$sort_field_id .= '.1';
1174 1174
 							break;
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 		if ( ! class_exists( '\GV\Entry' ) ) {
1242 1242
 
1243 1243
 			// Not using gravityview()->log->error(), since that may not exist yet either!
1244
-			do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary()  );
1244
+			do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary() );
1245 1245
 
1246 1246
 			return null;
1247 1247
 		}
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
 		 */
1259 1259
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1260 1260
 
1261
-		if ( empty( $single_entry ) ){
1261
+		if ( empty( $single_entry ) ) {
1262 1262
 			return false;
1263 1263
 		} else {
1264 1264
 			return $single_entry;
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 			$views = $this->getGvOutputData()->get_views();
1281 1281
 
1282 1282
 			foreach ( $views as $view_id => $data ) {
1283
-				$view = \GV\View::by_id( $data['id'] );
1283
+				$view = \GV\View::by_id( $data[ 'id' ] );
1284 1284
 				$view_id = $view->ID;
1285 1285
 				$template_id = gravityview_get_template_id( $view->ID );
1286 1286
 				$data = $view->as_data();
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1290 1290
 				 * @since 1.15
1291 1291
 				 */
1292
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1292
+				if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1293 1293
 					continue;
1294 1294
 				}
1295 1295
 
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 					 * @param \GV\View The View.
1322 1322
 					 */
1323 1323
 					apply_filters( 'gravityview_lightbox_script', $js_dependency, $view );
1324
-					$js_dependencies[] = $js_dependency;
1324
+					$js_dependencies[ ] = $js_dependency;
1325 1325
 
1326 1326
 					if ( ! empty( $wp_filter[ 'gravity_view_lightbox_style' ] ) ) {
1327 1327
 						gravityview()->log->warning( 'gravity_view_lightbox_style filter is deprecated use gravityview_lightbox_style instead' );
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
 					 * @param \GV\View The View.
1341 1341
 					 */
1342 1342
 					$css_dependency = apply_filters( 'gravityview_lightbox_style', $css_dependency, $view );
1343
-					$css_dependencies[] = $css_dependency;
1343
+					$css_dependencies[ ] = $css_dependency;
1344 1344
 				}
1345 1345
 
1346 1346
 				/**
@@ -1348,19 +1348,19 @@  discard block
 block discarded – undo
1348 1348
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1349 1349
 				 * @since 1.15
1350 1350
 				 */
1351
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1352
-					$css_dependencies[] = 'dashicons';
1351
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1352
+					$css_dependencies[ ] = 'dashicons';
1353 1353
 				}
1354 1354
 
1355 1355
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1356 1356
 
1357 1357
 				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1358 1358
 
1359
-				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 );
1359
+				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 );
1360 1360
 
1361 1361
 				wp_enqueue_script( 'gravityview-fe-view' );
1362 1362
 
1363
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1363
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1364 1364
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1365 1365
 				}
1366 1366
 
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 	public static function add_style( $template_id ) {
1424 1424
 
1425 1425
 		if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) {
1426
-			gravityview()->log->debug(  'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) );
1426
+			gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) );
1427 1427
 			wp_enqueue_style( 'gravityview_style_' . $template_id );
1428 1428
 		} elseif ( empty( $template_id ) ) {
1429 1429
 			gravityview()->log->error( 'Cannot add template style; template_id is empty' );
@@ -1454,11 +1454,11 @@  discard block
 block discarded – undo
1454 1454
 		 * Not a table-based template; don't add sort icons
1455 1455
 		 * @since 1.12
1456 1456
 		 */
1457
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1457
+		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1458 1458
 			return $label;
1459 1459
 		}
1460 1460
 
1461
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1461
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1462 1462
 			return $label;
1463 1463
 		}
1464 1464
 
@@ -1466,29 +1466,29 @@  discard block
 block discarded – undo
1466 1466
 
1467 1467
 		$class = 'gv-sort';
1468 1468
 
1469
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1469
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1470 1470
 
1471 1471
 		$sort_args = array(
1472
-			'sort' => $field['id'],
1472
+			'sort' => $field[ 'id' ],
1473 1473
 			'dir' => 'asc',
1474 1474
 		);
1475 1475
 
1476
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1476
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1477 1477
 			//toggle sorting direction.
1478
-			if ( 'asc' === $sorting['direction'] ) {
1479
-				$sort_args['dir'] = 'desc';
1478
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1479
+				$sort_args[ 'dir' ] = 'desc';
1480 1480
 				$class .= ' gv-icon-sort-desc';
1481 1481
 			} else {
1482
-				$sort_args['dir'] = 'asc';
1482
+				$sort_args[ 'dir' ] = 'asc';
1483 1483
 				$class .= ' gv-icon-sort-asc';
1484 1484
 			}
1485 1485
 		} else {
1486 1486
 			$class .= ' gv-icon-caret-up-down';
1487 1487
 		}
1488 1488
 
1489
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1489
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
1490 1490
 
1491
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1491
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $label;
1492 1492
 
1493 1493
 	}
1494 1494
 
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
 
1507 1507
 		$field_type = $field_id;
1508 1508
 
1509
-		if( is_numeric( $field_id ) ) {
1509
+		if ( is_numeric( $field_id ) ) {
1510 1510
 			$field = GFFormsModel::get_field( $form, $field_id );
1511 1511
 			$field_type = $field ? $field->type : $field_id;
1512 1512
 		}
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 			return false;
1530 1530
 		}
1531 1531
 
1532
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1532
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1533 1533
 
1534 1534
 	}
1535 1535
 
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/view-configuration.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -15,32 +15,32 @@  discard block
 block discarded – undo
15 15
 
16 16
 		<div id="directory-fields" class="gv-section">
17 17
 
18
-			<h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview'); ?></span></h4>
18
+			<h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview' ); ?></span></h4>
19 19
 
20
-			<?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?>
20
+			<?php do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?>
21 21
 
22
-			<h4><?php esc_html_e( 'Entries Fields', 'gravityview'); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview'); ?></span></h4>
22
+			<h4><?php esc_html_e( 'Entries Fields', 'gravityview' ); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview' ); ?></span></h4>
23 23
 
24 24
 			<div id="directory-active-fields" class="gv-grid">
25
-				<?php if(!empty( $curr_template ) ) {
26
-					do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true );
25
+				<?php if ( ! empty( $curr_template ) ) {
26
+					do_action( 'gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true );
27 27
 				} ?>
28 28
 			</div>
29 29
 
30
-			<h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview'); ?></span></h4>
30
+			<h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview' ); ?></span></h4>
31 31
 
32 32
 			<?php
33 33
 
34
-                do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID );
34
+                do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID );
35 35
 
36
-    			do_action('gravityview_render_field_pickers', 'directory' );
36
+    			do_action( 'gravityview_render_field_pickers', 'directory' );
37 37
 
38 38
             ?>
39 39
 
40 40
 			<?php // list of available widgets to be shown in the popup ?>
41 41
             <div id="directory-available-widgets" class="hide-if-js gv-tooltip">
42 42
                 <span class="close" role="button" aria-label="<?php esc_html_e( 'Close', 'gravityview' ); ?>"><i class="dashicons dashicons-dismiss"></i></span>
43
-				<?php do_action('gravityview_render_available_widgets' ); ?>
43
+				<?php do_action( 'gravityview_render_available_widgets' ); ?>
44 44
             </div>
45 45
 
46 46
 		</div>
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
 
57 57
 		<div id="single-fields" class="gv-section">
58 58
 
59
-			<h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview'); ?></h4>
59
+			<h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview' ); ?></h4>
60 60
 
61 61
 			<div id="single-active-fields" class="gv-grid">
62 62
 				<?php
63
-                if(!empty( $curr_template ) ) {
64
-				    do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true );
63
+                if ( ! empty( $curr_template ) ) {
64
+				    do_action( 'gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true );
65 65
                 }
66 66
 			    ?>
67 67
 			</div>
68 68
             <?php
69
-                do_action('gravityview_render_field_pickers', 'single' );
69
+                do_action( 'gravityview_render_field_pickers', 'single' );
70 70
 			?>
71 71
 		</div>
72 72
 
@@ -76,16 +76,16 @@  discard block
 block discarded – undo
76 76
 
77 77
 		<div id="edit-fields" class="gv-section">
78 78
 
79
-			<h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gravityview'); ?></span></h4>
79
+			<h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview' ); ?> <span><?php esc_html_e( 'If not configured, all form fields will be displayed.', 'gravityview' ); ?></span></h4>
80 80
 
81 81
 			<div id="edit-active-fields" class="gv-grid">
82 82
 				<?php
83
-				do_action('gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true );
83
+				do_action( 'gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true );
84 84
 				?>
85 85
 			</div>
86 86
 
87 87
 			<?php
88
-			    do_action('gravityview_render_field_pickers', 'edit' );
88
+			    do_action( 'gravityview_render_field_pickers', 'edit' );
89 89
 			?>
90 90
 
91 91
 		</div>
Please login to merge, or discard this patch.