Completed
Pull Request — develop (#1561)
by Zack
36:00 queued 15:58
created
includes/extensions/delete-entry/class-delete-entry.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @since 2.9.2
65 65
 	 *
66
-	 * @param $component
66
+	 * @param string $component
67 67
 	 */
68 68
 	private function load_components( $component ) {
69 69
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param array $args Existing reserved args
110 110
 	 *
111
-	 * @return array
111
+	 * @return string[]
112 112
 	 */
113 113
 	public function add_reserved_arg( $args ) {
114 114
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @uses GFAPI::delete_entry()
441 441
 	 * @uses GFAPI::update_entry_property()
442 442
 	 *
443
-	 * @return WP_Error|string "deleted" or "trashed" if successful, WP_Error if GFAPI::delete_entry() or updating entry failed.
443
+	 * @return string "deleted" or "trashed" if successful, WP_Error if GFAPI::delete_entry() or updating entry failed.
444 444
 	 */
445 445
 	private function delete_or_trash_entry( $entry ) {
446 446
 
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	 *
608 608
 	 * @since 1.5.1
609 609
 	 * @param  array $entry Gravity Forms entry array
610
-	 * @return boolean|WP_Error        True: can edit form. WP_Error: nope.
610
+	 * @return string        True: can edit form. WP_Error: nope.
611 611
 	 */
612 612
 	function user_can_delete_entry( $entry = array(), $view_id = null ) {
613 613
 
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 *
649 649
 	 * @param  array $entry Gravity Forms entry array
650 650
 	 * @param array $field Field settings (optional)
651
-	 * @param int|\GV\View $view Pass a View ID to check caps against. If not set, check against current View (@deprecated no longer optional)
651
+	 * @param integer $view Pass a View ID to check caps against. If not set, check against current View (@deprecated no longer optional)
652 652
 	 * @return bool
653 653
 	 */
654 654
 	public static function check_user_cap_delete_entry( $entry, $field = array(), $view = 0 ) {
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function add_reserved_arg( $args ) {
114 114
 
115
-		$args[] = 'delete';
115
+		$args[ ] = 'delete';
116 116
 
117 117
 		return $args;
118 118
 	}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// Index 100 is the default GravityView template path.
184 184
 		// Index 110 is Edit Entry link
185
-		$file_paths[115] = self::$file;
185
+		$file_paths[ 115 ] = self::$file;
186 186
 
187 187
 		return $file_paths;
188 188
 	}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
 		$attributes = array(
288 288
 			'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete',
289
-			'tabindex' => ( GFCommon::$tab_index ++ ),
289
+			'tabindex' => ( GFCommon::$tab_index++ ),
290 290
 			'onclick' => self::get_confirm_dialog(),
291 291
 		);
292 292
 
@@ -322,12 +322,12 @@  discard block
 block discarded – undo
322 322
 		);
323 323
 
324 324
 		// If the form is not submitted, return early
325
-		if ( 'delete' !== $get_fields['action'] || empty( $get_fields['entry_id'] ) ) {
325
+		if ( 'delete' !== $get_fields[ 'action' ] || empty( $get_fields[ 'entry_id' ] ) ) {
326 326
 			return;
327 327
 		}
328 328
 
329 329
 		// Make sure it's a GravityView request
330
-		$valid_nonce_key = wp_verify_nonce( $get_fields['delete'], self::get_nonce_key( $get_fields['entry_id'] ) );
330
+		$valid_nonce_key = wp_verify_nonce( $get_fields[ 'delete' ], self::get_nonce_key( $get_fields[ 'entry_id' ] ) );
331 331
 
332 332
 		if ( ! $valid_nonce_key ) {
333 333
 			gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' );
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 		}
337 337
 
338 338
 		// Get the entry slug
339
-		$entry_slug = esc_attr( $get_fields['entry_id'] );
339
+		$entry_slug = esc_attr( $get_fields[ 'entry_id' ] );
340 340
 
341 341
 		// Redirect after deleting the entry.
342
-		$view = \GV\View::by_id( $get_fields['view_id'] );
342
+		$view = \GV\View::by_id( $get_fields[ 'view_id' ] );
343 343
 
344 344
 		// See if there's an entry there
345 345
 		$entry = gravityview_get_entry( $entry_slug, true, false, $view );
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
 			$this->_redirect_and_exit( $delete_redirect_base, $delete_response->get_error_message(), 'error' );
367 367
 		}
368 368
 
369
-		if ( (int) $view->settings->get( 'delete_redirect' ) === self::REDIRECT_TO_URL_VALUE ) {
369
+		if ( (int)$view->settings->get( 'delete_redirect' ) === self::REDIRECT_TO_URL_VALUE ) {
370 370
 
371
-			$form                 = GFAPI::get_form( $entry['form_id'] );
371
+			$form                 = GFAPI::get_form( $entry[ 'form_id' ] );
372 372
 			$redirect_url_setting = $view->settings->get( 'delete_redirect_url' );
373 373
 			$redirect_url         = GFCommon::replace_variables( $redirect_url_setting, $form, $entry, false, false, false, 'text' );
374 374
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 */
445 445
 	private function delete_or_trash_entry( $entry ) {
446 446
 
447
-		$entry_id = $entry['id'];
447
+		$entry_id = $entry[ 'id' ];
448 448
 
449 449
 		$mode = $this->get_delete_mode();
450 450
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	public function process_connected_posts( $entry_id = 0, $entry = array() ) {
509 509
 
510 510
 		// The entry had no connected post
511
-		if ( empty( $entry['post_id'] ) ) {
511
+		if ( empty( $entry[ 'post_id' ] ) ) {
512 512
 			return;
513 513
 		}
514 514
 
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 		$action = current_action();
527 527
 
528 528
 		if ( 'gravityview/delete-entry/deleted' === $action ) {
529
-			$result = wp_delete_post( $entry['post_id'], true );
529
+			$result = wp_delete_post( $entry[ 'post_id' ], true );
530 530
 		} else {
531
-			$result = wp_trash_post( $entry['post_id'] );
531
+			$result = wp_trash_post( $entry[ 'post_id' ] );
532 532
 		}
533 533
 
534 534
 		if ( false === $result ) {
@@ -559,13 +559,13 @@  discard block
 block discarded – undo
559 559
 	public function verify_nonce() {
560 560
 
561 561
 		// No delete entry request was made
562
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) {
562
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) {
563 563
 			return false;
564 564
 		}
565 565
 
566
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
566
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
567 567
 
568
-		$valid = wp_verify_nonce( $_GET['delete'], $nonce_key );
568
+		$valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key );
569 569
 
570 570
 		/**
571 571
 		 * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid.
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 			$error = __( 'You do not have permission to delete this entry.', 'gravityview' );
622 622
 		}
623 623
 
624
-		if ( $entry['status'] === 'trash' ) {
624
+		if ( $entry[ 'status' ] === 'trash' ) {
625 625
 			if ( 'trash' === $this->get_delete_mode() ) {
626 626
 				$error = __( 'The entry is already in the trash.', 'gravityview' );
627 627
 			} else {
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 
666 666
 		$current_user = wp_get_current_user();
667 667
 
668
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : null;
668
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null;
669 669
 
670 670
 		// Or if they can delete any entries (as defined in Gravity Forms), we're good.
671 671
 		if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) {
@@ -679,17 +679,17 @@  discard block
 block discarded – undo
679 679
 		if ( ! empty( $field ) ) {
680 680
 
681 681
 			// If capability is not defined, something is not right!
682
-			if ( empty( $field['allow_edit_cap'] ) ) {
682
+			if ( empty( $field[ 'allow_edit_cap' ] ) ) {
683 683
 
684 684
 				gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) );
685 685
 
686 686
 				return false;
687 687
 			}
688 688
 
689
-			if ( GVCommon::has_cap( $field['allow_edit_cap'] ) ) {
689
+			if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) {
690 690
 
691 691
 				// Do not return true if cap is read, as we need to check if the current user created the entry
692
-				if ( $field['allow_edit_cap'] !== 'read' ) {
692
+				if ( $field[ 'allow_edit_cap' ] !== 'read' ) {
693 693
 					return true;
694 694
 				}
695 695
 			} else {
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 			}
701 701
 		}
702 702
 
703
-		if ( ! isset( $entry['created_by'] ) ) {
703
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
704 704
 
705 705
 			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
706 706
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 		}
717 717
 
718 718
 		// If the logged-in user is the same as the user who created the entry, we're good.
719
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
719
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
720 720
 
721 721
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
722 722
 
@@ -741,12 +741,12 @@  discard block
 block discarded – undo
741 741
 	 */
742 742
 	public function maybe_display_message( $current_view_id = 0 ) {
743 743
 
744
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
744
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
745 745
 			return;
746 746
 		}
747 747
 
748 748
 		// Entry wasn't deleted from current View
749
-		if ( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) {
749
+		if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) {
750 750
 			return;
751 751
 		}
752 752
 
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 
756 756
 	public function display_message() {
757 757
 
758
-		if ( empty( $_GET['status'] ) || empty( $_GET['delete'] ) ) {
758
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'delete' ] ) ) {
759 759
 			return;
760 760
 		}
761 761
 
762
-		$status = esc_attr( $_GET['status'] );
762
+		$status = esc_attr( $_GET[ 'status' ] );
763 763
 		$message_from_url = \GV\Utils::_GET( 'message' );
764 764
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
765 765
 		$class = '';
Please login to merge, or discard this patch.
includes/extensions/duplicate-entry/class-duplicate-entry.php 2 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @param array $args Existing reserved args
81 81
 	 *
82
-	 * @return array
82
+	 * @return string[]
83 83
 	 */
84 84
 	public function add_reserved_arg( $args ) {
85 85
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @param array $fields Array of field types not editable by users
153 153
 	 *
154
-	 * @return array
154
+	 * @return string[]
155 155
 	 */
156 156
 	public function _filter_sortable_fields( $fields ) {
157 157
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @param array $file_paths List of template paths ordered
171 171
 	 *
172
-	 * @return array File paths, with duplicate field path added at index 117
172
+	 * @return string[] File paths, with duplicate field path added at index 117
173 173
 	 */
174 174
 	public function add_template_path( $file_paths ) {
175 175
 
@@ -275,7 +275,6 @@  discard block
 block discarded – undo
275 275
 	 * @since 2.5
276 276
 	 *
277 277
 	 * @param  array 	    $visibility_caps        Array of capabilities to display in field dropdown.
278
-	 * @param  string       $field_type  Type of field options to render (`field` or `widget`)
279 278
 	 * @param  string       $template_id Table slug
280 279
 	 * @param  float|string $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
281 280
 	 * @param  string       $context     What context are we in? Example: `single` or `directory`
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function add_reserved_arg( $args ) {
85 85
 
86
-		$args[] = 'duplicate';
86
+		$args[ ] = 'duplicate';
87 87
 
88 88
 		return $args;
89 89
 	}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function _filter_sortable_fields( $fields ) {
157 157
 
158
-		$fields = (array) $fields;
158
+		$fields = (array)$fields;
159 159
 
160
-		$fields[] = 'duplicate_link';
160
+		$fields[ ] = 'duplicate_link';
161 161
 
162 162
 		return $fields;
163 163
 	}
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 	public function duplicate_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
197 197
 
198 198
 		// Always a link, never a filter, always same window
199
-		unset( $field_options['show_as_link'], $field_options['search_filter'], $field_options['new_window'] );
199
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ], $field_options[ 'new_window' ] );
200 200
 
201 201
 		// Duplicate Entry link should only appear to visitors capable of editing entries
202
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
202
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
203 203
 
204
-		$add_option['duplicate_link'] = array(
204
+		$add_option[ 'duplicate_link' ] = array(
205 205
 			'type' => 'text',
206 206
 			'label' => __( 'Duplicate Link Text', 'gravityview' ),
207 207
 			'desc' => NULL,
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			'merge_tags' => true,
210 210
 		);
211 211
 
212
-		$field_options['allow_duplicate_cap'] = array(
212
+		$field_options[ 'allow_duplicate_cap' ] = array(
213 213
 			'type' => 'select',
214 214
 			'label' => __( 'Allow the following users to duplicate the entry:', 'gravityview' ),
215 215
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	public function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
237 237
 
238 238
 		if ( 'edit' !== $zone ) {
239
-			$entry_default_fields['duplicate_link'] = array(
239
+			$entry_default_fields[ 'duplicate_link' ] = array(
240 240
 				'label' => __( 'Duplicate Entry', 'gravityview' ),
241 241
 				'type'  => 'duplicate_link',
242 242
 				'desc'  => __( 'A link to duplicate the entry. Respects the Duplicate Entry permissions.', 'gravityview' ),
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function add_available_field( $available_fields = array() ) {
260 260
 
261
-		$available_fields['duplicate_link'] = array(
261
+		$available_fields[ 'duplicate_link' ] = array(
262 262
 			'label_text' => __( 'Duplicate Entry', 'gravityview' ),
263 263
 			'field_id' => 'duplicate_link',
264 264
 			'label_type' => 'field',
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 		if ( 'duplicate_link' === $field_id ) {
292 292
 
293 293
 			// Remove other built-in caps.
294
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['duplicate_others_posts'] );
294
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'duplicate_others_posts' ] );
295 295
 
296
-			$caps['read'] = _x( 'Entry Creator', 'User capability', 'gravityview' );
296
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
297 297
 		}
298 298
 
299 299
 		return $caps;
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 */
329 329
 	public static function get_duplicate_link( $entry, $view_id, $post_id = null ) {
330 330
 
331
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
331
+        $base = GravityView_API::directory_link( $post_id ?: $view_id, true );
332 332
 
333 333
 		if ( empty( $base ) ) {
334 334
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
 
338 338
 		$actionurl = add_query_arg( array(
339 339
 			'action'	=> 'duplicate',
340
-			'entry_id'	=> $entry['id'],
340
+			'entry_id'	=> $entry[ 'id' ],
341 341
 			'gvid' => $view_id,
342 342
             'view_id' => $view_id,
343 343
 		), $base );
344 344
 
345
-		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl );
345
+		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry[ 'id' ] ) ), $actionurl );
346 346
 	}
347 347
 
348 348
 	/**
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 	public function process_duplicate() {
364 364
 
365 365
 		// If the form is submitted
366
-		if ( ( ! isset( $_GET['action'] ) ) || 'duplicate' !== $_GET['action'] || ( ! isset( $_GET['entry_id'] ) ) ) {
366
+		if ( ( ! isset( $_GET[ 'action' ] ) ) || 'duplicate' !== $_GET[ 'action' ] || ( ! isset( $_GET[ 'entry_id' ] ) ) ) {
367 367
 			return;
368 368
 		}
369 369
 
370 370
 		// Make sure it's a GravityView request
371
-		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET['entry_id'] ) );
371
+		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET[ 'entry_id' ] ) );
372 372
 
373 373
 		if ( ! $valid_nonce_key ) {
374 374
 			gravityview()->log->debug( 'Duplicate entry not processed: nonce validation failed.' );
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 
378 378
 		// Get the entry slug
379
-		$entry_slug = esc_attr( $_GET['entry_id'] );
379
+		$entry_slug = esc_attr( $_GET[ 'entry_id' ] );
380 380
 
381 381
 		// See if there's an entry there
382 382
 		$entry = gravityview_get_entry( $entry_slug, true, false );
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 			return new WP_Error( 'gravityview-duplicate-entry-missing', __( 'The entry does not exist.', 'gravityview' ) );
471 471
 		}
472 472
 
473
-		$form = GFAPI::get_form( $entry['form_id'] );
473
+		$form = GFAPI::get_form( $entry[ 'form_id' ] );
474 474
 
475
-		$row['id'] = null;
476
-		$row['date_created'] = date( 'Y-m-d H:i:s', time() );
477
-		$row['date_updated'] = $row['date_created'];
478
-		$row['is_starred'] = false;
479
-		$row['is_read'] = false;
480
-		$row['ip'] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip();
481
-		$row['source_url'] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) );
482
-		$row['user_agent'] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
483
-		$row['created_by'] = wp_get_current_user()->ID;
475
+		$row[ 'id' ] = null;
476
+		$row[ 'date_created' ] = date( 'Y-m-d H:i:s', time() );
477
+		$row[ 'date_updated' ] = $row[ 'date_created' ];
478
+		$row[ 'is_starred' ] = false;
479
+		$row[ 'is_read' ] = false;
480
+		$row[ 'ip' ] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip();
481
+		$row[ 'source_url' ] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) );
482
+		$row[ 'user_agent' ] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
483
+		$row[ 'created_by' ] = wp_get_current_user()->ID;
484 484
 
485 485
 		/**
486 486
 		 * @filter `gravityview/entry/duplicate/details` Modify the new entry details before it's created.
@@ -508,15 +508,15 @@  discard block
 block discarded – undo
508 508
 
509 509
 		$save_this_meta = array();
510 510
 		foreach ( $duplicate_meta->get_output() as $m ) {
511
-			$save_this_meta[] = array(
512
-				'meta_key' => $m['meta_key'],
513
-				'meta_value' => $m['meta_value'],
514
-				'item_index' => $m['item_index'],
511
+			$save_this_meta[ ] = array(
512
+				'meta_key' => $m[ 'meta_key' ],
513
+				'meta_value' => $m[ 'meta_value' ],
514
+				'item_index' => $m[ 'item_index' ],
515 515
 			);
516 516
 		}
517 517
 
518 518
 		// Update the row ID for later usage
519
-		$row['id'] = $duplicated_id;
519
+		$row[ 'id' ] = $duplicated_id;
520 520
 
521 521
 		/**
522 522
 		 * @filter `gravityview/entry/duplicate/meta` Modify the new entry meta details.
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 		$save_this_meta = apply_filters( 'gravityview/entry/duplicate/meta', $save_this_meta, $row, $entry );
528 528
 
529 529
 		foreach ( $save_this_meta as $data ) {
530
-			$data['form_id'] = $entry['form_id'];
531
-			$data['entry_id'] = $duplicated_id;
530
+			$data[ 'form_id' ] = $entry[ 'form_id' ];
531
+			$data[ 'entry_id' ] = $duplicated_id;
532 532
 
533 533
 			if ( ! $wpdb->insert( $entry_meta_table, $data ) ) {
534 534
 				return new WP_Error( 'gravityview-duplicate-entry-db-meta', __( 'There was an error duplicating the entry.', 'gravityview' ) );
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
 	public function verify_nonce() {
563 563
 
564 564
 		// No duplicate entry request was made
565
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['duplicate'] ) ) {
565
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
566 566
 			return false;
567 567
 		}
568 568
 
569
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
569
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
570 570
 
571
-		$valid = wp_verify_nonce( $_GET['duplicate'], $nonce_key );
571
+		$valid = wp_verify_nonce( $_GET[ 'duplicate' ], $nonce_key );
572 572
 
573 573
 		/**
574 574
 		 * @filter `gravityview/duplicate-entry/verify_nonce` Override Duplicate Entry nonce validation. Return true to declare nonce valid.
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 			return '';
605 605
 		}
606 606
 
607
-		return 'return window.confirm(\''. esc_js( $confirm ) .'\');';
607
+		return 'return window.confirm(\'' . esc_js( $confirm ) . '\');';
608 608
 	}
609 609
 
610 610
 	/**
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 	public static function check_user_cap_duplicate_entry( $entry, $field = array(), $view_id = 0 ) {
659 659
 		$current_user = wp_get_current_user();
660 660
 
661
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : null;
661
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null;
662 662
 
663 663
 		// Or if they can duplicate any entries (as defined in Gravity Forms), we're good.
664 664
 		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gform_full_access', 'gravityview_full_access' ), $entry_id ) ) {
@@ -673,17 +673,17 @@  discard block
 block discarded – undo
673 673
 		if ( ! empty( $field ) ) {
674 674
 
675 675
 			// If capability is not defined, something is not right!
676
-			if ( empty( $field['allow_duplicate_cap'] ) ) {
676
+			if ( empty( $field[ 'allow_duplicate_cap' ] ) ) {
677 677
 
678 678
 				gravityview()->log->error( 'Cannot read duplicate entry field caps', array( 'data' => $field ) );
679 679
 
680 680
 				return false;
681 681
 			}
682 682
 
683
-			if ( GVCommon::has_cap( $field['allow_duplicate_cap'] ) ) {
683
+			if ( GVCommon::has_cap( $field[ 'allow_duplicate_cap' ] ) ) {
684 684
 
685 685
 				// Do not return true if cap is read, as we need to check if the current user created the entry
686
-				if ( 'read' !== $field['allow_duplicate_cap'] ) {
686
+				if ( 'read' !== $field[ 'allow_duplicate_cap' ] ) {
687 687
 					return true;
688 688
 				}
689 689
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 
697 697
 		}
698 698
 
699
-		if ( ! isset( $entry['created_by'] ) ) {
699
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
700 700
 
701 701
 			gravityview()->log->error( 'Cannot duplicate entry; entry `created_by` doesn\'t exist.' );
702 702
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 		}
722 722
 
723 723
 		// If the logged-in user is the same as the user who created the entry, we're good.
724
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
724
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
725 725
 
726 726
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
727 727
 
@@ -745,12 +745,12 @@  discard block
 block discarded – undo
745 745
 	 * @return void
746 746
 	 */
747 747
 	public function maybe_display_message( $current_view_id = 0 ) {
748
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
748
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
749 749
 			return;
750 750
 		}
751 751
 
752 752
 		// Entry wasn't duplicated from current View
753
-		if ( isset( $_GET['view_id'] ) && ( intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) ) {
753
+		if ( isset( $_GET[ 'view_id' ] ) && ( intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) ) {
754 754
 			return;
755 755
 		}
756 756
 
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 	}
759 759
 
760 760
 	public function display_message() {
761
-		if ( empty( $_GET['status'] ) || empty( $_GET['duplicate'] ) ) {
761
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
762 762
 			return;
763 763
 		}
764 764
 
765
-		$status = esc_attr( $_GET['status'] );
765
+		$status = esc_attr( $_GET[ 'status' ] );
766 766
 		$message_from_url = \GV\Utils::_GET( 'message' );
767 767
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
768 768
 		$class = '';
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 		$message = apply_filters( 'gravityview/duplicate-entry/message', esc_attr( $message ), $status, $message_from_url );
789 789
 
790 790
 		// DISPLAY ERROR/SUCCESS MESSAGE
791
-		echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>';
791
+		echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>';
792 792
 	}
793 793
 
794 794
 	/**
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 		?>
819 819
 		<span class="gv-duplicate">
820 820
 			|
821
-			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry['id'] ), self::get_nonce_key( $entry['id'] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
821
+			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry[ 'id' ] ), self::get_nonce_key( $entry[ 'id' ] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
822 822
 		</span>
823 823
 		<?php
824 824
 	}
@@ -840,9 +840,9 @@  discard block
 block discarded – undo
840 840
 
841 841
 		if ( 'success' === \GV\Utils::_GET( 'result' ) ) {
842 842
 			add_filter( 'gform_admin_messages', function( $messages ) {
843
-				$messages = (array) $messages;
843
+				$messages = (array)$messages;
844 844
 
845
-				$messages[] = esc_html__( 'Entry duplicated.', 'gravityview' );
845
+				$messages[ ] = esc_html__( 'Entry duplicated.', 'gravityview' );
846 846
 				return $messages;
847 847
 			} );
848 848
 		}
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 
854 854
 			$check_logs_message = '';
855 855
 
856
-			if( $is_logging_active ) {
856
+			if ( $is_logging_active ) {
857 857
 				$check_logs_message = sprintf( ' <a href="%s">%s</a>',
858 858
 					esc_url( admin_url( 'admin.php?page=gf_settings&subview=gravityformslogging' ) ),
859 859
 					esc_html_x( 'Check the GravityView logs for more information.', 'Error message links to logging page', 'gravityview' )
@@ -861,9 +861,9 @@  discard block
 block discarded – undo
861 861
 			}
862 862
 
863 863
 			add_filter( 'gform_admin_error_messages', function( $messages ) use ( $check_logs_message ) {
864
-				$messages = (array) $messages;
864
+				$messages = (array)$messages;
865 865
 
866
-				$messages[] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
866
+				$messages[ ] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
867 867
 
868 868
 				return $messages;
869 869
 			} );
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry.php 3 patches
Doc Comments   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,6 +64,9 @@  discard block
 block discarded – undo
64 64
     }
65 65
 
66 66
 
67
+    /**
68
+     * @param string $component
69
+     */
67 70
     private function load_components( $component ) {
68 71
 
69 72
         $dir = trailingslashit( self::$file );
@@ -104,7 +107,7 @@  discard block
 block discarded – undo
104 107
 	 *
105 108
 	 * @param array $args Existing reserved args
106 109
 	 *
107
-	 * @return array
110
+	 * @return string[]
108 111
 	 */
109 112
 	public function add_reserved_arg( $args ) {
110 113
 
@@ -200,7 +203,7 @@  discard block
 block discarded – undo
200 203
      * "You can edit this post from the post page" fields, for example.
201 204
      *
202 205
      * @param $entry array Gravity Forms entry object
203
-     * @param $view_id int GravityView view id
206
+     * @param integer $view_id int GravityView view id
204 207
      * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205 208
      * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206 209
      * @return string
@@ -303,7 +306,7 @@  discard block
 block discarded – undo
303 306
      * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
304 307
      *
305 308
      * @param  array $entry Gravity Forms entry array
306
-     * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
309
+     * @param integer $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
307 310
      * @return bool
308 311
      */
309 312
     public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
Please login to merge, or discard this patch.
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -18,84 +18,84 @@  discard block
 block discarded – undo
18 18
 
19 19
 class GravityView_Edit_Entry {
20 20
 
21
-    /**
22
-     * @var string
23
-     */
21
+	/**
22
+	 * @var string
23
+	 */
24 24
 	static $file;
25 25
 
26 26
 	static $instance;
27 27
 
28
-    /**
29
-     * Component instances.
30
-     * @var array
31
-     */
32
-    public $instances = array();
28
+	/**
29
+	 * Component instances.
30
+	 * @var array
31
+	 */
32
+	public $instances = array();
33 33
 
34 34
 
35 35
 	function __construct() {
36 36
 
37
-        self::$file = plugin_dir_path( __FILE__ );
37
+		self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
40
-            $this->load_components( 'admin' );
41
-        }
39
+		if( is_admin() ) {
40
+			$this->load_components( 'admin' );
41
+		}
42 42
 
43 43
 		$this->load_components( 'locking' );
44 44
 
45
-        $this->load_components( 'render' );
45
+		$this->load_components( 'render' );
46 46
 
47
-        // If GF User Registration Add-on exists
48
-        $this->load_components( 'user-registration' );
47
+		// If GF User Registration Add-on exists
48
+		$this->load_components( 'user-registration' );
49 49
 
50
-        $this->add_hooks();
50
+		$this->add_hooks();
51 51
 
52 52
 		// Process hooks for addons that may or may not be present
53 53
 		$this->addon_specific_hooks();
54 54
 	}
55 55
 
56 56
 
57
-    static function getInstance() {
57
+	static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
60
-            self::$instance = new GravityView_Edit_Entry;
61
-        }
59
+		if( empty( self::$instance ) ) {
60
+			self::$instance = new GravityView_Edit_Entry;
61
+		}
62 62
 
63
-        return self::$instance;
64
-    }
63
+		return self::$instance;
64
+	}
65 65
 
66 66
 
67
-    private function load_components( $component ) {
67
+	private function load_components( $component ) {
68 68
 
69
-        $dir = trailingslashit( self::$file );
69
+		$dir = trailingslashit( self::$file );
70 70
 
71
-        $filename  = $dir . 'class-edit-entry-' . $component . '.php';
72
-        $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
71
+		$filename  = $dir . 'class-edit-entry-' . $component . '.php';
72
+		$classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
73 73
 
74
-        // Loads component and pass extension's instance so that component can
75
-        // talk each other.
76
-        require_once $filename;
77
-        $this->instances[ $component ] = new $classname( $this );
78
-        $this->instances[ $component ]->load();
74
+		// Loads component and pass extension's instance so that component can
75
+		// talk each other.
76
+		require_once $filename;
77
+		$this->instances[ $component ] = new $classname( $this );
78
+		$this->instances[ $component ]->load();
79 79
 
80
-    }
80
+	}
81 81
 
82
-    private function add_hooks() {
82
+	private function add_hooks() {
83 83
 
84
-        // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
84
+		// Add front-end access to Gravity Forms delete file action
85
+		add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
86 86
 
87
-        // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
87
+		// Make sure this hook is run for non-admins
88
+		add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
89 89
 
90
-        add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
90
+		add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
91 91
 
92
-        // add template path to check for field
93
-        add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
92
+		// add template path to check for field
93
+		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
94 94
 
95 95
 		add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 );
96 96
 
97 97
 		add_filter( 'gravityview/api/reserved_query_args', array( $this, 'add_reserved_arg' ) );
98
-    }
98
+	}
99 99
 
100 100
 	/**
101 101
 	 * Adds "edit" to the list of internal reserved query args
@@ -166,74 +166,74 @@  discard block
 block discarded – undo
166 166
 		return false;
167 167
 	}
168 168
 
169
-    /**
170
-     * Include this extension templates path
171
-     * @param array $file_paths List of template paths ordered
172
-     */
173
-    public function add_template_path( $file_paths ) {
174
-
175
-        // Index 100 is the default GravityView template path.
176
-        $file_paths[ 110 ] = self::$file;
177
-
178
-        return $file_paths;
179
-    }
180
-
181
-    /**
182
-     *
183
-     * Return a well formatted nonce key according to GravityView Edit Entry protocol
184
-     *
185
-     * @param $view_id int GravityView view id
186
-     * @param $form_id int Gravity Forms form id
187
-     * @param $entry_id int Gravity Forms entry id
188
-     * @return string
189
-     */
190
-    public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
191
-        return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
192
-    }
193
-
194
-
195
-    /**
196
-     * The edit entry link creates a secure link with a nonce
197
-     *
198
-     * It also mimics the URL structure Gravity Forms expects to have so that
199
-     * it formats the display of the edit form like it does in the backend, like
200
-     * "You can edit this post from the post page" fields, for example.
201
-     *
202
-     * @param $entry array Gravity Forms entry object
203
-     * @param $view_id int GravityView view id
204
-     * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205
-     * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206
-     * @return string
207
-     */
208
-    public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209
-
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
211
-
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
213
-
214
-        $url = add_query_arg( array(
215
-            'edit' => wp_create_nonce( $nonce_key )
216
-        ), $base );
217
-
218
-        if( $post_id ) {
219
-	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220
-        }
221
-
222
-	    /**
223
-	     * Allow passing params to dynamically populate entry with values
224
-	     * @since 1.9.2
225
-	     */
226
-	    if( !empty( $field_values ) ) {
227
-
228
-		    if( is_array( $field_values ) ) {
229
-			    // If already an array, no parse_str() needed
230
-			    $params = $field_values;
231
-		    } else {
232
-			    parse_str( $field_values, $params );
233
-		    }
234
-
235
-		    $url = add_query_arg( $params, $url );
236
-	    }
169
+	/**
170
+	 * Include this extension templates path
171
+	 * @param array $file_paths List of template paths ordered
172
+	 */
173
+	public function add_template_path( $file_paths ) {
174
+
175
+		// Index 100 is the default GravityView template path.
176
+		$file_paths[ 110 ] = self::$file;
177
+
178
+		return $file_paths;
179
+	}
180
+
181
+	/**
182
+	 *
183
+	 * Return a well formatted nonce key according to GravityView Edit Entry protocol
184
+	 *
185
+	 * @param $view_id int GravityView view id
186
+	 * @param $form_id int Gravity Forms form id
187
+	 * @param $entry_id int Gravity Forms entry id
188
+	 * @return string
189
+	 */
190
+	public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
191
+		return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
192
+	}
193
+
194
+
195
+	/**
196
+	 * The edit entry link creates a secure link with a nonce
197
+	 *
198
+	 * It also mimics the URL structure Gravity Forms expects to have so that
199
+	 * it formats the display of the edit form like it does in the backend, like
200
+	 * "You can edit this post from the post page" fields, for example.
201
+	 *
202
+	 * @param $entry array Gravity Forms entry object
203
+	 * @param $view_id int GravityView view id
204
+	 * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205
+	 * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206
+	 * @return string
207
+	 */
208
+	public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209
+
210
+		$nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
211
+
212
+		$base = gv_entry_link( $entry, $post_id ? : $view_id  );
213
+
214
+		$url = add_query_arg( array(
215
+			'edit' => wp_create_nonce( $nonce_key )
216
+		), $base );
217
+
218
+		if( $post_id ) {
219
+			$url = add_query_arg( array( 'gvid' => $view_id ), $url );
220
+		}
221
+
222
+		/**
223
+		 * Allow passing params to dynamically populate entry with values
224
+		 * @since 1.9.2
225
+		 */
226
+		if( !empty( $field_values ) ) {
227
+
228
+			if( is_array( $field_values ) ) {
229
+				// If already an array, no parse_str() needed
230
+				$params = $field_values;
231
+			} else {
232
+				parse_str( $field_values, $params );
233
+			}
234
+
235
+			$url = add_query_arg( $params, $url );
236
+		}
237 237
 
238 238
 		/**
239 239
 		 * @filter `gravityview/edit/link` Filter the edit URL link.
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244 244
 		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
245
-    }
245
+	}
246 246
 
247 247
 	/**
248 248
 	 * Edit mode doesn't allow certain field types.
@@ -297,19 +297,19 @@  discard block
 block discarded – undo
297 297
 	}
298 298
 
299 299
 
300
-    /**
301
-     * checks if user has permissions to edit a specific entry
302
-     *
303
-     * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
304
-     *
305
-     * @param  array $entry Gravity Forms entry array
306
-     * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
307
-     * @return bool
308
-     */
309
-    public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
300
+	/**
301
+	 * checks if user has permissions to edit a specific entry
302
+	 *
303
+	 * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
304
+	 *
305
+	 * @param  array $entry Gravity Forms entry array
306
+	 * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
307
+	 * @return bool
308
+	 */
309
+	public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
310 310
 
311
-        // No permission by default
312
-        $user_can_edit = false;
311
+		// No permission by default
312
+		$user_can_edit = false;
313 313
 
314 314
 		// get user_edit setting
315 315
 		if ( empty( $view ) ) {
@@ -327,60 +327,60 @@  discard block
 block discarded – undo
327 327
 			$user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
328 328
 		}
329 329
 
330
-        // If they can edit any entries (as defined in Gravity Forms)
331
-        // Or if they can edit other people's entries
332
-        // Then we're good.
333
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
330
+		// If they can edit any entries (as defined in Gravity Forms)
331
+		// Or if they can edit other people's entries
332
+		// Then we're good.
333
+		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
334 334
 
335
-            gravityview()->log->debug( 'User has ability to edit all entries.' );
335
+			gravityview()->log->debug( 'User has ability to edit all entries.' );
336 336
 
337
-            $user_can_edit = true;
337
+			$user_can_edit = true;
338 338
 
339
-        } else if( !isset( $entry['created_by'] ) ) {
339
+		} else if( !isset( $entry['created_by'] ) ) {
340 340
 
341
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
341
+			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
342 342
 
343
-            $user_can_edit = false;
343
+			$user_can_edit = false;
344 344
 
345
-        } else {
345
+		} else {
346 346
 
347
-            $current_user = wp_get_current_user();
347
+			$current_user = wp_get_current_user();
348 348
 
349
-            // User edit is disabled
350
-            if( empty( $user_edit ) ) {
349
+			// User edit is disabled
350
+			if( empty( $user_edit ) ) {
351 351
 
352
-                gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
352
+				gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
353 353
 
354
-                $user_can_edit = false;
355
-            }
354
+				$user_can_edit = false;
355
+			}
356 356
 
357
-            // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
358
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
357
+			// User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
358
+			else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
359 359
 
360
-                gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
360
+				gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
361 361
 
362
-                $user_can_edit = true;
362
+				$user_can_edit = true;
363 363
 
364
-            } else if( ! is_user_logged_in() ) {
364
+			} else if( ! is_user_logged_in() ) {
365 365
 
366
-                gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
366
+				gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
367 367
 
368
-	            $user_can_edit = false; // Here just for clarity
369
-            }
368
+				$user_can_edit = false; // Here just for clarity
369
+			}
370 370
 
371
-        }
371
+		}
372 372
 
373
-        /**
374
-         * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
375
-         * @since 1.15 Added `$entry` and `$view_id` parameters
376
-         * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
377
-         * @param[in] array $entry Gravity Forms entry array {@since 1.15}
378
-         * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
379
-         */
380
-        $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
373
+		/**
374
+		 * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
375
+		 * @since 1.15 Added `$entry` and `$view_id` parameters
376
+		 * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
377
+		 * @param[in] array $entry Gravity Forms entry array {@since 1.15}
378
+		 * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
379
+		 */
380
+		$user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
381 381
 
382
-        return (bool) $user_can_edit;
383
-    }
382
+		return (bool) $user_can_edit;
383
+	}
384 384
 
385 385
 
386 386
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
39
+        if ( is_admin() ) {
40 40
             $this->load_components( 'admin' );
41 41
         }
42 42
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
     static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
59
+        if ( empty( self::$instance ) ) {
60 60
             self::$instance = new GravityView_Edit_Entry;
61 61
         }
62 62
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
     private function add_hooks() {
83 83
 
84 84
         // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
85
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) );
86 86
 
87 87
         // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
88
+        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) );
89 89
 
90 90
         add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
91 91
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function add_reserved_arg( $args ) {
110 110
 
111
-		$args[] = 'edit';
111
+		$args[ ] = 'edit';
112 112
 
113 113
 		return $args;
114 114
 	}
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	private function addon_specific_hooks() {
121 121
 
122
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
122
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
124 124
 		}
125 125
 
126 126
 	}
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209 209
 
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
210
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
211 211
 
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
212
+        $base = gv_entry_link( $entry, $post_id ?: $view_id );
213 213
 
214 214
         $url = add_query_arg( array(
215 215
             'edit' => wp_create_nonce( $nonce_key )
216 216
         ), $base );
217 217
 
218
-        if( $post_id ) {
218
+        if ( $post_id ) {
219 219
 	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220 220
         }
221 221
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 	     * Allow passing params to dynamically populate entry with values
224 224
 	     * @since 1.9.2
225 225
 	     */
226
-	    if( !empty( $field_values ) ) {
226
+	    if ( ! empty( $field_values ) ) {
227 227
 
228
-		    if( is_array( $field_values ) ) {
228
+		    if ( is_array( $field_values ) ) {
229 229
 			    // If already an array, no parse_str() needed
230 230
 			    $params = $field_values;
231 231
 		    } else {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		 * @param array $entry The entry.
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244
-		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
244
+		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) );
245 245
     }
246 246
 
247 247
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function modify_field_blacklist( $fields = array(), $context = NULL ) {
254 254
 
255
-		if( empty( $context ) || $context !== 'edit' ) {
255
+		if ( empty( $context ) || $context !== 'edit' ) {
256 256
 			return $fields;
257 257
 		}
258 258
 
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
         // If they can edit any entries (as defined in Gravity Forms)
331 331
         // Or if they can edit other people's entries
332 332
         // Then we're good.
333
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
333
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
334 334
 
335 335
             gravityview()->log->debug( 'User has ability to edit all entries.' );
336 336
 
337 337
             $user_can_edit = true;
338 338
 
339
-        } else if( !isset( $entry['created_by'] ) ) {
339
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
340 340
 
341
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
341
+            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
342 342
 
343 343
             $user_can_edit = false;
344 344
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             $current_user = wp_get_current_user();
348 348
 
349 349
             // User edit is disabled
350
-            if( empty( $user_edit ) ) {
350
+            if ( empty( $user_edit ) ) {
351 351
 
352 352
                 gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
353 353
 
@@ -355,13 +355,13 @@  discard block
 block discarded – undo
355 355
             }
356 356
 
357 357
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
358
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
358
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
359 359
 
360 360
                 gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
361 361
 
362 362
                 $user_can_edit = true;
363 363
 
364
-            } else if( ! is_user_logged_in() ) {
364
+            } else if ( ! is_user_logged_in() ) {
365 365
 
366 366
                 gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
367 367
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
          */
380 380
         $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
381 381
 
382
-        return (bool) $user_can_edit;
382
+        return (bool)$user_can_edit;
383 383
     }
384 384
 
385 385
 
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +183 added lines, -183 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
@@ -119,19 +119,19 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function add_reserved_args( $args ) {
121 121
 
122
-		$args[] = 'gv_search';
123
-		$args[] = 'gv_start';
124
-		$args[] = 'gv_end';
125
-		$args[] = 'gv_id';
126
-		$args[] = 'gv_by';
127
-		$args[] = 'mode';
122
+		$args[ ] = 'gv_search';
123
+		$args[ ] = 'gv_start';
124
+		$args[ ] = 'gv_end';
125
+		$args[ ] = 'gv_id';
126
+		$args[ ] = 'gv_by';
127
+		$args[ ] = 'mode';
128 128
 
129
-		$get = (array) $_GET;
129
+		$get = (array)$_GET;
130 130
 
131 131
 		// If the fields being searched as reserved; not to be considered user-passed variables
132 132
 		foreach ( $get as $key => $value ) {
133 133
 			if ( $key !== $this->convert_request_key_to_filter_key( $key ) ) {
134
-				$args[] = $key;
134
+				$args[ ] = $key;
135 135
 			}
136 136
 		}
137 137
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
256 256
 		$script_source = empty( $script_min ) ? '/source' : '';
257 257
 
258
-		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 );
258
+		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 );
259 259
 
260 260
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
261 261
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
278 278
 	 */
279 279
 	public function register_no_conflict( $allowed ) {
280
-		$allowed[] = 'gravityview_searchwidget_admin';
280
+		$allowed[ ] = 'gravityview_searchwidget_admin';
281 281
 		return $allowed;
282 282
 	}
283 283
 
@@ -289,24 +289,24 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public static function get_searchable_fields() {
291 291
 
292
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
292
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
293 293
 			exit( '0' );
294 294
 		}
295 295
 
296 296
 		$form = '';
297 297
 
298 298
 		// Fetch the form for the current View
299
-		if ( ! empty( $_POST['view_id'] ) ) {
299
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
300 300
 
301
-			$form = gravityview_get_form_id( $_POST['view_id'] );
301
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
302 302
 
303
-		} elseif ( ! empty( $_POST['formid'] ) ) {
303
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
304 304
 
305
-			$form = (int) $_POST['formid'];
305
+			$form = (int)$_POST[ 'formid' ];
306 306
 
307
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
307
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
308 308
 
309
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
309
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
310 310
 
311 311
 		}
312 312
 
@@ -356,14 +356,14 @@  discard block
 block discarded – undo
356 356
 		);
357 357
 
358 358
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
359
-			$custom_fields['is_approved'] = array(
359
+			$custom_fields[ 'is_approved' ] = array(
360 360
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
361 361
 				'type' => 'multi',
362 362
 			);
363 363
 		}
364 364
 
365
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
366
-			$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'] );
365
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
366
+			$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' ] );
367 367
 		}
368 368
 
369 369
 		// Get fields with sub-inputs and no parent
@@ -385,13 +385,13 @@  discard block
 block discarded – undo
385 385
 
386 386
 			foreach ( $fields as $id => $field ) {
387 387
 
388
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
388
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
389 389
 					continue;
390 390
 				}
391 391
 
392
-				$types = self::get_search_input_types( $id, $field['type'] );
392
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
393 393
 
394
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
394
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
395 395
 			}
396 396
 		}
397 397
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
415 415
 
416 416
 		// @todo - This needs to be improved - many fields have . including products and addresses
417
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
417
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
418 418
 			$input_type = 'boolean'; // on/off checkbox
419 419
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
420 420
 			$input_type = 'multi'; //multiselect
@@ -460,19 +460,19 @@  discard block
 block discarded – undo
460 460
 			$post_id = 0;
461 461
 
462 462
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
463
-			if ( ! empty( $widget_args['post_id'] ) ) {
464
-				$post_id = absint( $widget_args['post_id'] );
463
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
464
+				$post_id = absint( $widget_args[ 'post_id' ] );
465 465
 			}
466 466
 			// We're in the WordPress Widget context, and the base View ID should be used
467
-			else if ( ! empty( $widget_args['view_id'] ) ) {
468
-				$post_id = absint( $widget_args['view_id'] );
467
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
468
+				$post_id = absint( $widget_args[ 'view_id' ] );
469 469
 			}
470 470
 
471 471
 			$args = gravityview_get_permalink_query_args( $post_id );
472 472
 
473 473
 			// Add hidden fields to the search form
474 474
 			foreach ( $args as $key => $value ) {
475
-				$search_fields[] = array(
475
+				$search_fields[ ] = array(
476 476
 					'name'  => $key,
477 477
 					'input' => 'hidden',
478 478
 					'value' => $value,
@@ -511,28 +511,28 @@  discard block
 block discarded – undo
511 511
 		/**
512 512
 		 * Include the sidebar Widgets.
513 513
 		 */
514
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
514
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
515 515
 
516 516
 		foreach ( $widgets as $widget ) {
517
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
518
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
517
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
518
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
519 519
 					foreach ( $_fields as $field ) {
520
-						if ( empty( $field['form_id'] ) ) {
521
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
520
+						if ( empty( $field[ 'form_id' ] ) ) {
521
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
522 522
 						}
523
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
523
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
524 524
 					}
525 525
 				}
526 526
 			}
527 527
 		}
528 528
 
529 529
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
530
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
530
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
531 531
 				foreach ( $_fields as $field ) {
532
-					if ( empty( $field['form_id'] ) ) {
533
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
532
+					if ( empty( $field[ 'form_id' ] ) ) {
533
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
534 534
 					}
535
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
535
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
536 536
 				}
537 537
 			}
538 538
 		}
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
571 571
 		}
572 572
 
573
-		if( 'post' === $this->search_method ) {
573
+		if ( 'post' === $this->search_method ) {
574 574
 			$get = $_POST;
575 575
 		} else {
576 576
 			$get = $_GET;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		$get = gv_map_deep( $get, 'rawurldecode' );
590 590
 
591 591
 		// Make sure array key is set up
592
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
592
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
593 593
 
594 594
 		$searchable_fields = $this->get_view_searchable_fields( $view );
595 595
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
@@ -609,9 +609,9 @@  discard block
 block discarded – undo
609 609
 		$trim_search_value = apply_filters( 'gravityview/search-trim-input', true );
610 610
 
611 611
 		// add free search
612
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
612
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
613 613
 
614
-			$search_all_value = $trim_search_value ? trim( $get['gv_search'] ) : $get['gv_search'];
614
+			$search_all_value = $trim_search_value ? trim( $get[ 'gv_search' ] ) : $get[ 'gv_search' ];
615 615
 
616 616
 			if ( $split_words ) {
617 617
 				// Search for a piece
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 			}
628 628
 
629 629
 			foreach ( $words as $word ) {
630
-				$search_criteria['field_filters'][] = array(
630
+				$search_criteria[ 'field_filters' ][ ] = array(
631 631
 					'key' => null, // The field ID to search
632 632
 					'value' => $word, // The value to search
633 633
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -640,14 +640,14 @@  discard block
 block discarded – undo
640 640
 			/**
641 641
 			 * Get and normalize the dates according to the input format.
642 642
 			 */
643
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
644
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
643
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
644
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
645 645
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
646 646
 				}
647 647
 			}
648 648
 
649
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
650
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
649
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
650
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
651 651
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
652 652
 				}
653 653
 			}
@@ -683,22 +683,22 @@  discard block
 block discarded – undo
683 683
 			 */
684 684
 			if ( ! empty( $curr_start ) ) {
685 685
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
686
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
686
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
687 687
 			}
688 688
 
689 689
 			if ( ! empty( $curr_end ) ) {
690 690
 				// Fast-forward 24 hour on the end time
691 691
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
692
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
693
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
694
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
692
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
693
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
694
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
695 695
 				}
696 696
 			}
697 697
 		}
698 698
 
699 699
 		// search for a specific entry ID
700 700
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
701
-			$search_criteria['field_filters'][] = array(
701
+			$search_criteria[ 'field_filters' ][ ] = array(
702 702
 				'key' => 'id',
703 703
 				'value' => absint( $get[ 'gv_id' ] ),
704 704
 				'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ),
@@ -707,15 +707,15 @@  discard block
 block discarded – undo
707 707
 
708 708
 		// search for a specific Created_by ID
709 709
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
710
-			$search_criteria['field_filters'][] = array(
710
+			$search_criteria[ 'field_filters' ][ ] = array(
711 711
 				'key' => 'created_by',
712
-				'value' => $get['gv_by'],
712
+				'value' => $get[ 'gv_by' ],
713 713
 				'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ),
714 714
 			);
715 715
 		}
716 716
 
717 717
 		// Get search mode passed in URL
718
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
718
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
719 719
 
720 720
 		// get the other search filters
721 721
 		foreach ( $get as $key => $value ) {
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 				$value = is_array( $value ) ? array_map( 'trim', $value ) : trim( $value );
725 725
 			}
726 726
 
727
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
727
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
728 728
 				continue; // Not a filter, or empty
729 729
 			}
730 730
 
@@ -738,21 +738,21 @@  discard block
 block discarded – undo
738 738
 				continue;
739 739
 			}
740 740
 
741
-			if ( ! isset( $filter['operator'] ) ) {
742
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
741
+			if ( ! isset( $filter[ 'operator' ] ) ) {
742
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
743 743
 			}
744 744
 
745
-			if ( isset( $filter[0]['value'] ) ) {
746
-				$filter[0]['value'] = $trim_search_value ? trim( $filter[0]['value'] ) : $filter[0]['value'];
745
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
746
+				$filter[ 0 ][ 'value' ] = $trim_search_value ? trim( $filter[ 0 ][ 'value' ] ) : $filter[ 0 ][ 'value' ];
747 747
 
748
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
748
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
749 749
 
750 750
 				// if date range type, set search mode to ALL
751
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
751
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
752 752
 					$mode = 'all';
753 753
 				}
754
-			} elseif( !empty( $filter ) ) {
755
-				$search_criteria['field_filters'][] = $filter;
754
+			} elseif ( ! empty( $filter ) ) {
755
+				$search_criteria[ 'field_filters' ][ ] = $filter;
756 756
 			}
757 757
 		}
758 758
 
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 		 * @since 1.5.1
762 762
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
763 763
 		 */
764
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
764
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
765 765
 
766 766
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
767 767
 
@@ -795,19 +795,19 @@  discard block
 block discarded – undo
795 795
 
796 796
 		$query_class = $view->get_query_class();
797 797
 
798
-		if ( empty( $search_criteria['field_filters'] ) ) {
798
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
799 799
 			return;
800 800
 		}
801 801
 
802 802
 		$widgets = $view->widgets->by_id( $this->widget_id );
803 803
 		if ( $widgets->count() ) {
804 804
 			$widgets = $widgets->all();
805
-			$widget  = $widgets[0];
805
+			$widget  = $widgets[ 0 ];
806 806
 
807 807
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
808 808
 
809
-			foreach ( (array) $search_fields as $search_field ) {
810
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
809
+			foreach ( (array)$search_fields as $search_field ) {
810
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
811 811
 					$created_by_text_mode = true;
812 812
 				}
813 813
 			}
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 		$extra_conditions = array();
817 817
 		$mode = 'any';
818 818
 
819
-		foreach ( $search_criteria['field_filters'] as &$filter ) {
819
+		foreach ( $search_criteria[ 'field_filters' ] as &$filter ) {
820 820
 			if ( ! is_array( $filter ) ) {
821 821
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
822 822
 					$mode = $filter;
@@ -825,13 +825,13 @@  discard block
 block discarded – undo
825 825
 			}
826 826
 
827 827
 			// Construct a manual query for unapproved statuses
828
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
829
-				$_tmp_query       = new $query_class( $view->form->ID, array(
828
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
829
+				$_tmp_query = new $query_class( $view->form->ID, array(
830 830
 					'field_filters' => array(
831 831
 						array(
832 832
 							'operator' => 'in',
833 833
 							'key'      => 'is_approved',
834
-							'value'    => (array) $filter['value'],
834
+							'value'    => (array)$filter[ 'value' ],
835 835
 						),
836 836
 						array(
837 837
 							'operator' => 'is',
@@ -843,30 +843,30 @@  discard block
 block discarded – undo
843 843
 				) );
844 844
 				$_tmp_query_parts = $_tmp_query->_introspect();
845 845
 
846
-				$extra_conditions[] = $_tmp_query_parts['where'];
846
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
847 847
 
848 848
 				$filter = false;
849 849
 				continue;
850 850
 			}
851 851
 
852 852
 			// Construct manual query for text mode creator search
853
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
854
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
853
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
854
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
855 855
 				$filter = false;
856 856
 				continue;
857 857
 			}
858 858
 
859 859
 			// By default, we want searches to be wildcard for each field.
860
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
860
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
861 861
 
862 862
 			// For multichoice, let's have an in (OR) search.
863
-			if ( is_array( $filter['value'] ) ) {
864
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
863
+			if ( is_array( $filter[ 'value' ] ) ) {
864
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
865 865
 			}
866 866
 
867 867
 			// Default form with joins functionality
868
-			if ( empty( $filter['form_id'] ) ) {
869
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
868
+			if ( empty( $filter[ 'form_id' ] ) ) {
869
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
870 870
 			}
871 871
 
872 872
 			/**
@@ -876,28 +876,28 @@  discard block
 block discarded – undo
876 876
 			 * @since develop
877 877
 			 * @param \GV\View $view The View we're operating on.
878 878
 			 */
879
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );
879
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view );
880 880
 		}
881 881
 
882
-		if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) {
882
+		if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) {
883 883
 			$date_criteria = array();
884 884
 
885
-			if ( isset( $search_criteria['start_date'] ) ) {
886
-				$date_criteria['start_date'] = $search_criteria['start_date'];
885
+			if ( isset( $search_criteria[ 'start_date' ] ) ) {
886
+				$date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ];
887 887
 			}
888 888
 
889
-			if ( isset( $search_criteria['end_date'] ) ) {
890
-				$date_criteria['end_date'] = $search_criteria['end_date'];
889
+			if ( isset( $search_criteria[ 'end_date' ] ) ) {
890
+				$date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ];
891 891
 			}
892 892
 
893 893
 			$_tmp_query         = new $query_class( $view->form->ID, $date_criteria );
894 894
 			$_tmp_query_parts   = $_tmp_query->_introspect();
895
-			$extra_conditions[] = $_tmp_query_parts['where'];
895
+			$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
896 896
 		}
897 897
 
898 898
 		$search_conditions = array();
899 899
 
900
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
900
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
901 901
 			foreach ( $filters as &$filter ) {
902 902
 				if ( ! is_array( $filter ) ) {
903 903
 					continue;
@@ -909,12 +909,12 @@  discard block
 block discarded – undo
909 909
 				 * code by reusing what's inside GF_Query already as they
910 910
 				 * take care of many small things like forcing numeric, etc.
911 911
 				 */
912
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
912
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
913 913
 				$_tmp_query_parts = $_tmp_query->_introspect();
914
-				$search_condition = $_tmp_query_parts['where'];
914
+				$search_condition = $_tmp_query_parts[ 'where' ];
915 915
 
916
-				if ( empty( $filter['key'] ) && $search_condition->expressions ) {
917
-					$search_conditions[] = $search_condition;
916
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
917
+					$search_conditions[ ] = $search_condition;
918 918
 				} else {
919 919
 					$left = $search_condition->left;
920 920
 					$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 							$on = $_join->join_on;
925 925
 							$join = $_join->join;
926 926
 
927
-							$search_conditions[] = GF_Query_Condition::_or(
927
+							$search_conditions[ ] = GF_Query_Condition::_or(
928 928
 								// Join
929 929
 								new GF_Query_Condition(
930 930
 									new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ),
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 							);
941 941
 						}
942 942
 					} else {
943
-						$search_conditions[] = new GF_Query_Condition(
943
+						$search_conditions[ ] = new GF_Query_Condition(
944 944
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
945 945
 							$search_condition->operator,
946 946
 							$search_condition->right
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 		/**
963 963
 		 * Combine the parts as a new WHERE clause.
964 964
 		 */
965
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
965
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
966 966
 		$query->where( $where );
967 967
 	}
968 968
 
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 		$field_id = str_replace( 'filter_', '', $key );
986 986
 
987 987
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
988
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
988
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
989 989
 			$field_id = str_replace( '_', '.', $field_id );
990 990
 		}
991 991
 
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 			// form is in searchable fields
1043 1043
 			$found = false;
1044 1044
 			foreach ( $searchable_fields as $field ) {
1045
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
1045
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
1046 1046
 					$found = true;
1047 1047
 					break;
1048 1048
 				}
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 
1083 1083
 			case 'select':
1084 1084
 			case 'radio':
1085
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1085
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1086 1086
 				break;
1087 1087
 
1088 1088
 			case 'post_category':
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 
1097 1097
 				foreach ( $value as $val ) {
1098 1098
 					$cat = get_term( $val, 'category' );
1099
-					$filter[] = array(
1099
+					$filter[ ] = array(
1100 1100
 						'key'      => $field_id,
1101 1101
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
1102 1102
 						'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 				$filter = array();
1116 1116
 
1117 1117
 				foreach ( $value as $val ) {
1118
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1118
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1119 1119
 				}
1120 1120
 
1121 1121
 				break;
@@ -1124,9 +1124,9 @@  discard block
 block discarded – undo
1124 1124
 				// convert checkbox on/off into the correct search filter
1125 1125
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1126 1126
 					foreach ( $form_field->inputs as $k => $input ) {
1127
-						if ( $input['id'] == $field_id ) {
1128
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1129
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1127
+						if ( $input[ 'id' ] == $field_id ) {
1128
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1129
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1130 1130
 							break;
1131 1131
 						}
1132 1132
 					}
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 					$filter = array();
1137 1137
 
1138 1138
 					foreach ( $value as $val ) {
1139
-						$filter[] = array(
1139
+						$filter[ ] = array(
1140 1140
 							'key'      => $field_id,
1141 1141
 							'value'    => $val,
1142 1142
 							'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1157,9 +1157,9 @@  discard block
 block discarded – undo
1157 1157
 					foreach ( $words as $word ) {
1158 1158
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1159 1159
 							// Keep the same key for each filter
1160
-							$filter['value'] = $word;
1160
+							$filter[ 'value' ] = $word;
1161 1161
 							// Add a search for the value
1162
-							$filters[] = $filter;
1162
+							$filters[ ] = $filter;
1163 1163
 						}
1164 1164
 					}
1165 1165
 
@@ -1173,19 +1173,19 @@  discard block
 block discarded – undo
1173 1173
 
1174 1174
 					foreach ( $searchable_fields as $searchable_field ) {
1175 1175
 
1176
-						if( $form_field->ID !== $searchable_field['field'] ) {
1176
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1177 1177
 							continue;
1178 1178
 						}
1179 1179
 
1180 1180
 						// Only exact-match dropdowns, not text search
1181
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1181
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1182 1182
 							continue;
1183 1183
 						}
1184 1184
 
1185 1185
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1186 1186
 
1187 1187
 						if ( 4 === $input_id ) {
1188
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1188
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1189 1189
 						};
1190 1190
 					}
1191 1191
 				}
@@ -1213,12 +1213,12 @@  discard block
 block discarded – undo
1213 1213
 						 * @since 1.16.3
1214 1214
 						 * Safeguard until GF implements '<=' operator
1215 1215
 						 */
1216
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1216
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1217 1217
 							$operator = '<';
1218 1218
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1219 1219
 						}
1220 1220
 
1221
-						$filter[] = array(
1221
+						$filter[ ] = array(
1222 1222
 							'key'      => $field_id,
1223 1223
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1224 1224
 							'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ),
@@ -1226,12 +1226,12 @@  discard block
 block discarded – undo
1226 1226
 					}
1227 1227
 				} else {
1228 1228
 					$date = $value;
1229
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1230
-					$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1229
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1230
+					$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1231 1231
 				}
1232 1232
 
1233
-				if ('payment_date' === $key) {
1234
-					$filter['operator'] = 'contains';
1233
+				if ( 'payment_date' === $key ) {
1234
+					$filter[ 'operator' ] = 'contains';
1235 1235
 				}
1236 1236
 
1237 1237
 				break;
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 			'ymd_dot' => 'Y.m.d',
1261 1261
 		);
1262 1262
 
1263
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1263
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1264 1264
 			$format = $datepicker[ $field->dateFormat ];
1265 1265
 		}
1266 1266
 
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 	public function add_template_path( $file_paths ) {
1298 1298
 
1299 1299
 		// Index 100 is the default GravityView template path.
1300
-		$file_paths[102] = self::$file . 'templates/';
1300
+		$file_paths[ 102 ] = self::$file . 'templates/';
1301 1301
 
1302 1302
 		return $file_paths;
1303 1303
 	}
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 		$has_date = false;
1317 1317
 
1318 1318
 		foreach ( $search_fields as $k => $field ) {
1319
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1319
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1320 1320
 				$has_date = true;
1321 1321
 				break;
1322 1322
 			}
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 		$view = \GV\View::by_id( $gravityview_view->view_id );
1346 1346
 
1347 1347
 		// get configured search fields
1348
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1348
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1349 1349
 
1350 1350
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1351 1351
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1359,40 +1359,40 @@  discard block
 block discarded – undo
1359 1359
 
1360 1360
 			$updated_field = $this->get_search_filter_details( $updated_field, $context );
1361 1361
 
1362
-			switch ( $field['field'] ) {
1362
+			switch ( $field[ 'field' ] ) {
1363 1363
 
1364 1364
 				case 'search_all':
1365
-					$updated_field['key'] = 'search_all';
1366
-					$updated_field['input'] = 'search_all';
1367
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1365
+					$updated_field[ 'key' ] = 'search_all';
1366
+					$updated_field[ 'input' ] = 'search_all';
1367
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1368 1368
 					break;
1369 1369
 
1370 1370
 				case 'entry_date':
1371
-					$updated_field['key'] = 'entry_date';
1372
-					$updated_field['input'] = 'entry_date';
1373
-					$updated_field['value'] = array(
1371
+					$updated_field[ 'key' ] = 'entry_date';
1372
+					$updated_field[ 'input' ] = 'entry_date';
1373
+					$updated_field[ 'value' ] = array(
1374 1374
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1375 1375
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1376 1376
 					);
1377 1377
 					break;
1378 1378
 
1379 1379
 				case 'entry_id':
1380
-					$updated_field['key'] = 'entry_id';
1381
-					$updated_field['input'] = 'entry_id';
1382
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1380
+					$updated_field[ 'key' ] = 'entry_id';
1381
+					$updated_field[ 'input' ] = 'entry_id';
1382
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1383 1383
 					break;
1384 1384
 
1385 1385
 				case 'created_by':
1386
-					$updated_field['key'] = 'created_by';
1387
-					$updated_field['name'] = 'gv_by';
1388
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1389
-					$updated_field['choices'] = self::get_created_by_choices( $view );
1386
+					$updated_field[ 'key' ] = 'created_by';
1387
+					$updated_field[ 'name' ] = 'gv_by';
1388
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1389
+					$updated_field[ 'choices' ] = self::get_created_by_choices( $view );
1390 1390
 					break;
1391 1391
 
1392 1392
 				case 'is_approved':
1393
-					$updated_field['key'] = 'is_approved';
1394
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1395
-					$updated_field['choices'] = self::get_is_approved_choices();
1393
+					$updated_field[ 'key' ] = 'is_approved';
1394
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1395
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1396 1396
 					break;
1397 1397
 			}
1398 1398
 
@@ -1413,16 +1413,16 @@  discard block
 block discarded – undo
1413 1413
 
1414 1414
 		$gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args );
1415 1415
 
1416
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1416
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1417 1417
 
1418 1418
 		/** @since 1.14 */
1419
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1419
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1420 1420
 
1421
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1421
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1422 1422
 
1423 1423
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1424 1424
 
1425
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1425
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1426 1426
 
1427 1427
 		if ( $this->has_date_field( $search_fields ) ) {
1428 1428
 			// enqueue datepicker stuff only if needed!
@@ -1444,10 +1444,10 @@  discard block
 block discarded – undo
1444 1444
 	public static function get_search_class( $custom_class = '' ) {
1445 1445
 		$gravityview_view = GravityView_View::getInstance();
1446 1446
 
1447
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1447
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1448 1448
 
1449
-		if ( ! empty( $custom_class )  ) {
1450
-			$search_class .= ' '.$custom_class;
1449
+		if ( ! empty( $custom_class ) ) {
1450
+			$search_class .= ' ' . $custom_class;
1451 1451
 		}
1452 1452
 
1453 1453
 		/**
@@ -1498,9 +1498,9 @@  discard block
 block discarded – undo
1498 1498
 
1499 1499
 		if ( ! $label ) {
1500 1500
 
1501
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1501
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1502 1502
 
1503
-			switch( $field['field'] ) {
1503
+			switch ( $field[ 'field' ] ) {
1504 1504
 				case 'search_all':
1505 1505
 					$label = __( 'Search Entries:', 'gravityview' );
1506 1506
 					break;
@@ -1512,10 +1512,10 @@  discard block
 block discarded – undo
1512 1512
 					break;
1513 1513
 				default:
1514 1514
 					// If this is a field input, not a field
1515
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1515
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1516 1516
 
1517 1517
 						// Get the label for the field in question, which returns an array
1518
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1518
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1519 1519
 
1520 1520
 						// Get the item with the `label` key
1521 1521
 						$values = wp_list_pluck( $items, 'label' );
@@ -1556,13 +1556,13 @@  discard block
 block discarded – undo
1556 1556
 		$form = $gravityview_view->getForm();
1557 1557
 
1558 1558
 		// for advanced field ids (eg, first name / last name )
1559
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1559
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1560 1560
 
1561 1561
 		// get searched value from $_GET/$_POST (string or array)
1562 1562
 		$value = $this->rgget_or_rgpost( $name );
1563 1563
 
1564 1564
 		// get form field details
1565
-		$form_field = gravityview_get_field( $form, $field['field'] );
1565
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1566 1566
 
1567 1567
 		$form_field_type = \GV\Utils::get( $form_field, 'type' );
1568 1568
 
@@ -1576,17 +1576,17 @@  discard block
 block discarded – undo
1576 1576
 		);
1577 1577
 
1578 1578
 		// collect choices
1579
-		if ( 'post_category' === $form_field_type && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1580
-			$filter['choices'] = gravityview_get_terms_choices();
1581
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1582
-			$filter['choices'] = $form_field['choices'];
1579
+		if ( 'post_category' === $form_field_type && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1580
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1581
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1582
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1583 1583
 		}
1584 1584
 
1585
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1586
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1585
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1586
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1587 1587
 		}
1588 1588
 
1589
-		if ( ! empty( $filter['choices'] ) ) {
1589
+		if ( ! empty( $filter[ 'choices' ] ) ) {
1590 1590
 			/**
1591 1591
 			 * @filter `gravityview/search/sieve_choices` Only output used choices for this field.
1592 1592
 			 * @param[in,out] bool Yes or no.
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
 			 * @param \GV\Context The context.
1595 1595
 			 */
1596 1596
 			if ( apply_filters( 'gravityview/search/sieve_choices', false, $field, $context ) ) {
1597
-				$filter['choices'] = $this->sieve_filter_choices( $filter, $context );
1597
+				$filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context );
1598 1598
 			}
1599 1599
 		}
1600 1600
 
@@ -1623,11 +1623,11 @@  discard block
 block discarded – undo
1623 1623
 	 * @return array The filter choices.
1624 1624
 	 */
1625 1625
 	private function sieve_filter_choices( $filter, $context ) {
1626
-		if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) {
1626
+		if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) {
1627 1627
 			return $filter; // @todo Populate plugins might give us empty choices
1628 1628
 		}
1629 1629
 
1630
-		if ( ! is_numeric( $filter['key'] ) ) {
1630
+		if ( ! is_numeric( $filter[ 'key' ] ) ) {
1631 1631
 			return $filter;
1632 1632
 		}
1633 1633
 
@@ -1637,29 +1637,29 @@  discard block
 block discarded – undo
1637 1637
 
1638 1638
 		$table = GFFormsModel::get_entry_meta_table_name();
1639 1639
 
1640
-		$key_like = $wpdb->esc_like( $filter['key'] ) . '.%';
1640
+		$key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%';
1641 1641
 
1642 1642
 		switch ( \GV\Utils::get( $filter, 'type' ) ):
1643 1643
 			case 'post_category':
1644 1644
 				$choices = $wpdb->get_col( $wpdb->prepare(
1645 1645
 					"SELECT DISTINCT SUBSTRING_INDEX(meta_value, ':', 1) FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1646
-					$key_like, $filter['key'], $form_id
1646
+					$key_like, $filter[ 'key' ], $form_id
1647 1647
 				) );
1648 1648
 				break;
1649 1649
 			default:
1650 1650
 				$choices = $wpdb->get_col( $wpdb->prepare(
1651 1651
 					"SELECT DISTINCT meta_value FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1652
-					$key_like, $filter['key'], $form_id
1652
+					$key_like, $filter[ 'key' ], $form_id
1653 1653
 				) );
1654 1654
 
1655
-				if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) {
1655
+				if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) {
1656 1656
 					$choices = array_map( 'json_decode', $choices );
1657 1657
 					$_choices_array = array();
1658 1658
 					foreach ( $choices as $choice ) {
1659 1659
 						if ( is_array( $choice ) ) {
1660 1660
 							$_choices_array = array_merge( $_choices_array, $choice );
1661 1661
 						} else {
1662
-							$_choices_array []= $choice;
1662
+							$_choices_array [ ] = $choice;
1663 1663
 						}
1664 1664
 					}
1665 1665
 					$choices = array_unique( $_choices_array );
@@ -1669,9 +1669,9 @@  discard block
 block discarded – undo
1669 1669
 		endswitch;
1670 1670
 
1671 1671
 		$filter_choices = array();
1672
-		foreach ( $filter['choices'] as $choice ) {
1673
-			if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) {
1674
-				$filter_choices[] = $choice;
1672
+		foreach ( $filter[ 'choices' ] as $choice ) {
1673
+			if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) {
1674
+				$filter_choices[ ] = $choice;
1675 1675
 			}
1676 1676
 		}
1677 1677
 
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
 			 * @param \GV\View $view The view.
1707 1707
 			 */
1708 1708
 			$text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view );
1709
-			$choices[] = array(
1709
+			$choices[ ] = array(
1710 1710
 				'value' => $user->ID,
1711 1711
 				'text' => $text,
1712 1712
 			);
@@ -1726,9 +1726,9 @@  discard block
 block discarded – undo
1726 1726
 
1727 1727
 		$choices = array();
1728 1728
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1729
-			$choices[] = array(
1730
-				'value' => $status['value'],
1731
-				'text' => $status['label'],
1729
+			$choices[ ] = array(
1730
+				'value' => $status[ 'value' ],
1731
+				'text' => $status[ 'label' ],
1732 1732
 			);
1733 1733
 		}
1734 1734
 
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
 	 */
1781 1781
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1782 1782
 
1783
-		$js_dependencies[] = 'jquery-ui-datepicker';
1783
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1784 1784
 
1785 1785
 		return $js_dependencies;
1786 1786
 	}
@@ -1824,7 +1824,7 @@  discard block
 block discarded – undo
1824 1824
 			'isRTL'             => is_rtl(),
1825 1825
 		), $view_data );
1826 1826
 
1827
-		$localizations['datepicker'] = $datepicker_settings;
1827
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1828 1828
 
1829 1829
 		return $localizations;
1830 1830
 
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
 	 * @return void
1852 1852
 	 */
1853 1853
 	private function maybe_enqueue_flexibility() {
1854
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1854
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1855 1855
 			wp_enqueue_script( 'gv-flexibility' );
1856 1856
 		}
1857 1857
 	}
@@ -1873,7 +1873,7 @@  discard block
 block discarded – undo
1873 1873
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1874 1874
 
1875 1875
 		$scheme = is_ssl() ? 'https://' : 'http://';
1876
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1876
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1877 1877
 
1878 1878
 		/**
1879 1879
 		 * @filter `gravityview_search_datepicker_class`
@@ -1952,7 +1952,7 @@  discard block
 block discarded – undo
1952 1952
 	public function add_preview_inputs() {
1953 1953
 		global $wp;
1954 1954
 
1955
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
1955
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
1956 1956
 			return;
1957 1957
 		}
1958 1958
 
@@ -2004,7 +2004,7 @@  discard block
 block discarded – undo
2004 2004
  */
2005 2005
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
2006 2006
 	public function __construct( $filter, $view ) {
2007
-		$this->value = $filter['value'];
2007
+		$this->value = $filter[ 'value' ];
2008 2008
 		$this->view = $view;
2009 2009
 	}
2010 2010
 
@@ -2036,11 +2036,11 @@  discard block
 block discarded – undo
2036 2036
 		$conditions = array();
2037 2037
 
2038 2038
 		foreach ( $user_fields as $user_field ) {
2039
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
2039
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
2040 2040
 		}
2041 2041
 
2042 2042
 		foreach ( $user_meta_fields as $meta_field ) {
2043
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
2043
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
2044 2044
 		}
2045 2045
 
2046 2046
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$form = $gravityview_view->getForm();
32 32
 
33
-		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) {
33
+		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) {
34 34
 			/** Allow to fall through for back compatibility testing purposes. */
35 35
 		} else {
36 36
 			return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label );
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$label = '';
40 40
 
41
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
41
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
42 42
 
43
-			$label = $field['label'];
43
+			$label = $field[ 'label' ];
44 44
 
45 45
 			// Support Gravity Forms 1.9+
46
-			if( class_exists( 'GF_Field' ) ) {
46
+			if ( class_exists( 'GF_Field' ) ) {
47 47
 
48
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
48
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
49 49
 
50
-				if( $field_object ) {
50
+				if ( $field_object ) {
51 51
 
52
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
52
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
53 53
 
54 54
 					// This is a complex field, with labels on a per-input basis
55
-					if( $input ) {
55
+					if ( $input ) {
56 56
 
57 57
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
58
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
58
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
59 59
 
60 60
 					} else {
61 61
 
62 62
 						// This is a field with one label
63
-						$label = $field_object->get_field_label( true, $field['label'] );
63
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
64 64
 
65 65
 					}
66 66
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 			}
70 70
 
71 71
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
72
-			if ( !empty( $field['custom_label'] ) ) {
72
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
73 73
 
74
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
74
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
75 75
 
76 76
 			}
77 77
 
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 
134 134
 		$width = NULL;
135 135
 
136
-		if( !empty( $field['width'] ) ) {
137
-			$width = absint( $field['width'] );
136
+		if ( ! empty( $field[ 'width' ] ) ) {
137
+			$width = absint( $field[ 'width' ] );
138 138
 
139 139
 			// If using percentages, limit to 100%
140
-			if( '%d%%' === $format && $width > 100 ) {
140
+			if ( '%d%%' === $format && $width > 100 ) {
141 141
 				$width = 100;
142 142
 			}
143 143
 
@@ -157,42 +157,42 @@  discard block
 block discarded – undo
157 157
 	public static function field_class( $field, $form = NULL, $entry = NULL ) {
158 158
 		$classes = array();
159 159
 
160
-		if( !empty( $field['custom_class'] ) ) {
160
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
161 161
 
162
-            $custom_class = $field['custom_class'];
162
+            $custom_class = $field[ 'custom_class' ];
163 163
 
164
-            if( !empty( $entry ) ) {
164
+            if ( ! empty( $entry ) ) {
165 165
 
166 166
                 // We want the merge tag to be formatted as a class. The merge tag may be
167 167
                 // replaced by a multiple-word value that should be output as a single class.
168 168
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
169
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
169
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
170 170
 
171
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
171
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
172 172
 
173 173
                 // And then we want life to return to normal
174
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
174
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
175 175
             }
176 176
 
177 177
 			// And now we want the spaces to be handled nicely.
178
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
178
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
179 179
 
180 180
 		}
181 181
 
182
-		if(!empty($field['id'])) {
183
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
184
-				$form_id = '-'.$form['id'];
182
+		if ( ! empty( $field[ 'id' ] ) ) {
183
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
184
+				$form_id = '-' . $form[ 'id' ];
185 185
 			} else {
186 186
 				// @deprecated path. Form should always be given.
187 187
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
188 188
 				$gravityview_view = GravityView_View::getInstance();
189
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
189
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
190 190
 			}
191 191
 
192
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
192
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
193 193
 		}
194 194
 
195
-		return esc_attr(implode(' ', $classes));
195
+		return esc_attr( implode( ' ', $classes ) );
196 196
 	}
197 197
 
198 198
 	/**
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 	 * @return string Sanitized unique HTML `id` attribute for the field
208 208
 	 */
209 209
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
210
-		$id = $field['id'];
210
+		$id = $field[ 'id' ];
211 211
 
212 212
 		if ( ! empty( $id ) ) {
213
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
214
-				$form_id = '-' . $form['id'];
213
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
214
+				$form_id = '-' . $form[ 'id' ];
215 215
 			} else {
216 216
 				// @deprecated path. Form should always be given.
217 217
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
220 220
 			}
221 221
 
222
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
222
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
223 223
 		}
224 224
 
225 225
 		return esc_attr( $id );
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) {
260 260
 
261
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
261
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
262 262
 			gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) );
263 263
 			return NULL;
264 264
 		}
265 265
 
266 266
 		$href = self::entry_link( $entry, $base_id );
267 267
 
268
-		if( '' === $href ) {
268
+		if ( '' === $href ) {
269 269
 			return NULL;
270 270
 		}
271 271
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		} else {
303 303
 			$gravityview_view = GravityView_View::getInstance();
304 304
 
305
-			if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
305
+			if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
306 306
 				$is_search = true;
307 307
 			}
308 308
 		}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
 			$output = esc_html__( 'This search returned no results.', 'gravityview' );
315 315
 
316
-			if( $context ) {
316
+			if ( $context ) {
317 317
 				$setting = $context->view->settings->get( 'no_search_results_text', $output );
318 318
 			}
319 319
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
 			$output = esc_html__( 'No entries match your request.', 'gravityview' );
323 323
 
324
-			if( $context ) {
324
+			if ( $context ) {
325 325
 				$setting = $context->view->settings->get( 'no_results_text', $output );
326 326
 			}
327 327
 		}
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
 
440 440
 		// If we've saved the permalink in memory, use it
441 441
 		// @since 1.3
442
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
442
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
443 443
 
444
-		if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
444
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
445 445
 			$link = home_url();
446 446
 		}
447 447
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 
451 451
 			// If not yet saved, cache the permalink.
452 452
 			// @since 1.3
453
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
453
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
454 454
 		}
455 455
 
456 456
 		// Deal with returning to proper pagination for embedded views
@@ -458,13 +458,13 @@  discard block
 block discarded – undo
458 458
 
459 459
 			$args = array();
460 460
 
461
-			if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
462
-				$args['pagenum'] = intval( $pagenum );
461
+			if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
462
+				$args[ 'pagenum' ] = intval( $pagenum );
463 463
 			}
464 464
 
465
-			if( $sort = \GV\Utils::_GET( 'sort' ) ) {
466
-				$args['sort'] = $sort;
467
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
465
+			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
466
+				$args[ 'sort' ] = $sort;
467
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
468 468
 			}
469 469
 
470 470
 			$link = add_query_arg( $args, $link );
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
502 502
 
503 503
 		// Generate an unique hash to use as the default value
504
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
504
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
505 505
 
506 506
 		/**
507 507
 		 * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}`
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
513 513
 
514 514
 		// Make sure we have something - use the original ID as backup.
515
-		if( empty( $slug ) ) {
515
+		if ( empty( $slug ) ) {
516 516
 			$slug = $id;
517 517
 		}
518 518
 
@@ -606,15 +606,15 @@  discard block
 block discarded – undo
606 606
          * @param boolean $custom Should we process the custom entry slug?
607 607
          */
608 608
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
609
-        if( $custom ) {
609
+        if ( $custom ) {
610 610
             // create the gravityview_unique_id and save it
611 611
 
612 612
             // Get the entry hash
613
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
613
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
614 614
 
615
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
615
+	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) );
616 616
 
617
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
617
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
618 618
 
619 619
         }
620 620
     }
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 
641 641
 		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
642 642
 			$entry = GVCommon::get_entry( $entry );
643
-		} else if( empty( $entry ) ) {
643
+		} else if ( empty( $entry ) ) {
644 644
 			// @deprecated path
645 645
 			$entry = GravityView_frontend::getInstance()->getEntry();
646 646
 		}
@@ -660,32 +660,32 @@  discard block
 block discarded – undo
660 660
 
661 661
 		$query_arg_name = \GV\Entry::get_endpoint_name();
662 662
 
663
-		if ( ! empty( $entry['_multi'] ) ) {
663
+		if ( ! empty( $entry[ '_multi' ] ) ) {
664 664
 			$entry_slugs = array();
665 665
 
666
-			foreach ( $entry['_multi'] as $_multi ) {
666
+			foreach ( $entry[ '_multi' ] as $_multi ) {
667 667
 
668
-				if( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
669
-					$entry_slugs[] = $gv_multi->get_slug();
668
+				if ( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
669
+					$entry_slugs[ ] = $gv_multi->get_slug();
670 670
 				} else {
671 671
 					// TODO: This path isn't covered by unit tests
672
-					$entry_slugs[] = \GravityView_API::get_entry_slug( $_multi['id'], $_multi );
672
+					$entry_slugs[ ] = \GravityView_API::get_entry_slug( $_multi[ 'id' ], $_multi );
673 673
 				}
674 674
 
675 675
 				unset( $gv_multi );
676 676
 
677
-				$forms[] = $_multi['form_id'];
677
+				$forms[ ] = $_multi[ 'form_id' ];
678 678
 			}
679 679
 
680 680
 			$entry_slug = implode( ',', $entry_slugs );
681 681
 		} else {
682 682
 
683 683
 			// Fallback when
684
-			if( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
684
+			if ( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
685 685
 				$entry_slug = $gv_entry->get_slug();
686 686
 			} else {
687 687
 				// TODO: This path isn't covered by unit tests
688
-				$entry_slug = \GravityView_API::get_entry_slug( $entry['id'], $entry );
688
+				$entry_slug = \GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
689 689
 			}
690 690
 
691 691
 			unset( $gv_entry );
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 			$args = gv_get_query_args();
705 705
 		}
706 706
 
707
-		if ( get_option('permalink_structure') && ! is_preview() ) {
707
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
708 708
 
709 709
 			/**
710 710
 			 * Make sure the $directory_link doesn't contain any query otherwise it will break when adding the entry slug.
@@ -712,13 +712,13 @@  discard block
 block discarded – undo
712 712
 			 */
713 713
 			$link_parts = explode( '?', $directory_link );
714 714
 
715
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
715
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
716 716
 
717
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
717
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
718 718
 
719 719
 		} else {
720 720
 
721
-			$args[] = array( $query_arg_name => $entry_slug );
721
+			$args[ ] = array( $query_arg_name => $entry_slug );
722 722
 		}
723 723
 
724 724
 		/**
@@ -726,21 +726,21 @@  discard block
 block discarded – undo
726 726
 		 */
727 727
 		if ( $add_directory_args ) {
728 728
 
729
-			if ( ! empty( $_GET['pagenum'] ) ) {
730
-				$args['pagenum'] = intval( $_GET['pagenum'] );
729
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
730
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
731 731
 			}
732 732
 
733 733
 			/**
734 734
 			 * @since 1.7
735 735
 			 */
736 736
 			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
737
-				$args['sort'] = $sort;
738
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
737
+				$args[ 'sort' ] = $sort;
738
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
739 739
 			}
740 740
 
741 741
 		}
742 742
 
743
-		if( $post_id ) {
743
+		if ( $post_id ) {
744 744
 			$passed_post = get_post( $post_id );
745 745
 			$views       = \GV\View_Collection::from_post( $passed_post );
746 746
 			$has_multiple_views = $views->count() > 1;
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 		}
750 750
 
751 751
 		if ( $has_multiple_views ) {
752
-			$args['gvid'] = $view_id ? $view_id : gravityview_get_view_id();
752
+			$args[ 'gvid' ] = $view_id ? $view_id : gravityview_get_view_id();
753 753
 		}
754 754
 
755 755
 		return add_query_arg( $args, $directory_link );
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 }
820 820
 
821 821
 function gv_class( $field, $form = NULL, $entry = array() ) {
822
-	return GravityView_API::field_class( $field, $form, $entry  );
822
+	return GravityView_API::field_class( $field, $form, $entry );
823 823
 }
824 824
 
825 825
 /**
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 		$view_id = 0;
843 843
 		if ( $context->view ) {
844 844
 			$view_id = $context->view->ID;
845
-			if( $context->view->settings->get( 'hide_until_searched' ) ) {
845
+			if ( $context->view->settings->get( 'hide_until_searched' ) ) {
846 846
 				$hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() );
847 847
 			}
848 848
 		}
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 		$default_css_class .= ' ' . $context->view->settings->get( 'class', '' );
875 875
 	}
876 876
 
877
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
877
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
878 878
 
879 879
 	/**
880 880
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 
902 902
 	$value = GravityView_API::field_value( $entry, $field );
903 903
 
904
-	if( $value === '' ) {
904
+	if ( $value === '' ) {
905 905
 		/**
906 906
 		 * @filter `gravityview_empty_value` What to display when a field is empty
907 907
 		 * @param string $value (empty string)
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
  */
1015 1015
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
1016 1016
 
1017
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
1017
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
1018 1018
 
1019 1019
 		// For the complete field value as generated by Gravity Forms
1020 1020
 		return $display_value;
@@ -1048,16 +1048,16 @@  discard block
 block discarded – undo
1048 1048
 		$terms = explode( ', ', $value );
1049 1049
 	}
1050 1050
 
1051
-	foreach ($terms as $term_name ) {
1051
+	foreach ( $terms as $term_name ) {
1052 1052
 
1053 1053
 		// If we're processing a category,
1054
-		if( $taxonomy === 'category' ) {
1054
+		if ( $taxonomy === 'category' ) {
1055 1055
 
1056 1056
 			// Use rgexplode to prevent errors if : doesn't exist
1057 1057
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
1058 1058
 
1059 1059
 			// The explode was succesful; we have the category ID
1060
-			if( !empty( $term_id )) {
1060
+			if ( ! empty( $term_id ) ) {
1061 1061
 				$term = get_term_by( 'id', $term_id, $taxonomy );
1062 1062
 			} else {
1063 1063
 			// We have to fall back to the name
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 		}
1071 1071
 
1072 1072
 		// There's still a tag/category here.
1073
-		if( $term ) {
1073
+		if ( $term ) {
1074 1074
 
1075 1075
 			$term_link = get_term_link( $term, $taxonomy );
1076 1076
 
@@ -1079,11 +1079,11 @@  discard block
 block discarded – undo
1079 1079
 			    continue;
1080 1080
 			}
1081 1081
 
1082
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
1082
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
1083 1083
 		}
1084 1084
 	}
1085 1085
 
1086
-	return implode(', ', $output );
1086
+	return implode( ', ', $output );
1087 1087
 }
1088 1088
 
1089 1089
 /**
@@ -1097,8 +1097,8 @@  discard block
 block discarded – undo
1097 1097
 
1098 1098
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
1099 1099
 
1100
-	if( empty( $link ) ) {
1101
-		return strip_tags( $output);
1100
+	if ( empty( $link ) ) {
1101
+		return strip_tags( $output );
1102 1102
 	}
1103 1103
 
1104 1104
 	return $output;
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 	$fe = GravityView_frontend::getInstance();
1118 1118
 
1119 1119
 	// Solve problem when loading content via admin-ajax.php
1120
-	if( ! $fe->getGvOutputData() ) {
1120
+	if ( ! $fe->getGvOutputData() ) {
1121 1121
 
1122 1122
 		gravityview()->log->debug( 'gv_output_data not defined; parsing content.' );
1123 1123
 
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 	}
1126 1126
 
1127 1127
 	// Make 100% sure that we're dealing with a properly called situation
1128
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1128
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1129 1129
 
1130 1130
 		gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) );
1131 1131
 
@@ -1356,12 +1356,12 @@  discard block
 block discarded – undo
1356 1356
 function gravityview_get_files_array( $value, $gv_class = '', $context = null ) {
1357 1357
 	/** @define "GRAVITYVIEW_DIR" "../" */
1358 1358
 
1359
-	if( !class_exists( 'GravityView_Field' ) ) {
1360
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1359
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1360
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1361 1361
 	}
1362 1362
 
1363
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1364
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' );
1363
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1364
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' );
1365 1365
 	}
1366 1366
 
1367 1367
 	if ( is_null( $context ) ) {
@@ -1464,21 +1464,21 @@  discard block
 block discarded – undo
1464 1464
 	} else {
1465 1465
 		// @deprecated path
1466 1466
 		// Required fields.
1467
-		if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1467
+		if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1468 1468
 			gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) );
1469 1469
 			return '';
1470 1470
 		}
1471 1471
 	}
1472 1472
 
1473 1473
 	if ( $context instanceof \GV\Template_Context ) {
1474
-		$entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() );
1475
-		$field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() );
1476
-		$form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() );
1474
+		$entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() );
1475
+		$field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() );
1476
+		$form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() );
1477 1477
 	} else {
1478 1478
 		// @deprecated path
1479
-		$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1480
-		$field = $args['field'];
1481
-		$form = $args['form'];
1479
+		$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1480
+		$field = $args[ 'field' ];
1481
+		$form = $args[ 'form' ];
1482 1482
 	}
1483 1483
 
1484 1484
 	/**
@@ -1498,43 +1498,43 @@  discard block
 block discarded – undo
1498 1498
 	);
1499 1499
 
1500 1500
 	if ( $context instanceof \GV\Template_Context ) {
1501
-		$placeholders['value'] = \GV\Utils::get( $args, 'value', '' );
1501
+		$placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' );
1502 1502
 	} else {
1503 1503
 		// @deprecated path
1504
-		$placeholders['value'] = gv_value( $entry, $field );
1504
+		$placeholders[ 'value' ] = gv_value( $entry, $field );
1505 1505
 	}
1506 1506
 
1507 1507
 	// If the value is empty and we're hiding empty, return empty.
1508
-	if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1508
+	if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1509 1509
 		return '';
1510 1510
 	}
1511 1511
 
1512
-	if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1513
-		$placeholders['value'] = wpautop( $placeholders['value'] );
1512
+	if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1513
+		$placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] );
1514 1514
 	}
1515 1515
 
1516 1516
 	// Get width setting, if exists
1517
-	$placeholders['width'] = GravityView_API::field_width( $field );
1517
+	$placeholders[ 'width' ] = GravityView_API::field_width( $field );
1518 1518
 
1519 1519
 	// If replacing with CSS inline formatting, let's do it.
1520
-	$placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' );
1520
+	$placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' );
1521 1521
 
1522 1522
 	// Grab the Class using `gv_class`
1523
-	$placeholders['class'] = gv_class( $field, $form, $entry );
1524
-	$placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1523
+	$placeholders[ 'class' ] = gv_class( $field, $form, $entry );
1524
+	$placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1525 1525
 
1526 1526
 	if ( $context instanceof \GV\Template_Context ) {
1527
-		$placeholders['label_value'] = \GV\Utils::get( $args, 'label' );
1527
+		$placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' );
1528 1528
 	} else {
1529 1529
 		// Default Label value
1530
-		$placeholders['label_value'] = gv_label( $field, $entry );
1530
+		$placeholders[ 'label_value' ] = gv_label( $field, $entry );
1531 1531
 	}
1532 1532
 
1533
-	$placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders['label_value'] ) ) ) );
1534
-	$placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] );
1533
+	$placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders[ 'label_value' ] ) ) ) );
1534
+	$placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] );
1535 1535
 
1536
-	if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){
1537
-		$placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1536
+	if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) {
1537
+		$placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1538 1538
 	}
1539 1539
 
1540 1540
 	/**
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 	 * @since 2.0
1546 1546
 	 * @param \GV\Template_Context $context The context.
1547 1547
 	 */
1548
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context );
1548
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context );
1549 1549
 
1550 1550
 	/**
1551 1551
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
 	foreach ( $placeholders as $tag => $value ) {
1573 1573
 
1574 1574
 		// If the tag doesn't exist just skip it
1575
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1575
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1576 1576
 			continue;
1577 1577
 		}
1578 1578
 
Please login to merge, or discard this patch.