Completed
Push — develop ( 31c9ca...168da6 )
by Zack
38:08 queued 17:59
created
includes/extensions/delete-entry/class-delete-entry.php 1 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/edit-entry/class-edit-entry.php 1 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/extensions/duplicate-entry/class-duplicate-entry.php 1 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/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.
future/includes/class-gv-view.php 1 patch
Spacing   +81 added lines, -82 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		$supports = array( 'title', 'revisions' );
126 126
 
127 127
 		if ( $is_hierarchical ) {
128
-			$supports[] = 'page-attributes';
128
+			$supports[ ] = 'page-attributes';
129 129
 		}
130 130
 
131 131
 		/**
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
 		$tsv_rule = array( sprintf( '%s/([^/]+)/tsv/?', $slug ), 'index.php?gravityview=$matches[1]&tsv=1', 'top' );
230 230
 
231 231
 		add_filter( 'query_vars', function( $query_vars ) {
232
-			$query_vars[] = 'csv';
233
-			$query_vars[] = 'tsv';
232
+			$query_vars[ ] = 'csv';
233
+			$query_vars[ ] = 'tsv';
234 234
 			return $query_vars;
235 235
 		} );
236 236
 
237
-		if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[0] ] ) ) {
237
+		if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[ 0 ] ] ) ) {
238 238
 			call_user_func_array( 'add_rewrite_rule', $csv_rule );
239 239
 			call_user_func_array( 'add_rewrite_rule', $tsv_rule );
240 240
 		}
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 						$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
297 297
 
298
-						$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) );
298
+						$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) );
299 299
 
300 300
 						return \GVCommon::generate_notice( '<h3>' . $title . '</h3>' . wpautop( $message . $image ), 'notice' );
301 301
 					}
@@ -321,13 +321,13 @@  discard block
 block discarded – undo
321 321
 			return $content;
322 322
 		}
323 323
 
324
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
324
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
325 325
 
326 326
 		/**
327 327
 		 * Editing a single entry.
328 328
 		 */
329 329
 		if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) {
330
-			if ( $entry['status'] != 'active' ) {
330
+			if ( $entry[ 'status' ] != 'active' ) {
331 331
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
332 332
 				return __( 'You are not allowed to view this content.', 'gravityview' );
333 333
 			}
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 			}
339 339
 
340 340
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
341
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
341
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
342 342
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
343 343
 					return __( 'You are not allowed to view this content.', 'gravityview' );
344 344
 				}
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 
362 362
 			foreach ( $entryset as $e ) {
363 363
 
364
-				if ( 'active' !== $e['status'] ) {
364
+				if ( 'active' !== $e[ 'status' ] ) {
365 365
 					gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) );
366 366
 					return __( 'You are not allowed to view this content.', 'gravityview' );
367 367
 				}
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 				}
373 373
 
374 374
 				if ( $show_only_approved && ! $is_admin_and_can_view ) {
375
-					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
375
+					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
376 376
 						gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) );
377 377
 						return __( 'You are not allowed to view this content.', 'gravityview' );
378 378
 					}
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 			$join_column    = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column );
548 548
 			$join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column );
549 549
 
550
-			$joins [] = new Join( $join, $join_column, $join_on, $join_on_column );
550
+			$joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column );
551 551
 		}
552 552
 
553 553
 		return $joins;
@@ -637,13 +637,13 @@  discard block
 block discarded – undo
637 637
 			}
638 638
 
639 639
 			foreach ( $_fields as $field ) {
640
-				if ( ! empty( $field['unions'] ) ) {
641
-					foreach ( $field['unions'] as $form_id => $field_id ) {
640
+				if ( ! empty( $field[ 'unions' ] ) ) {
641
+					foreach ( $field[ 'unions' ] as $form_id => $field_id ) {
642 642
 						if ( ! isset( $unions[ $form_id ] ) ) {
643 643
 							$unions[ $form_id ] = array();
644 644
 						}
645 645
 
646
-						$unions[ $form_id ][ $field['id'] ] =
646
+						$unions[ $form_id ][ $field[ 'id' ] ] =
647 647
 							is_numeric( $field_id ) ? \GV\GF_Field::by_id( \GV\GF_Form::by_id( $form_id ), $field_id ) : \GV\Internal_Field::by_id( $field_id );
648 648
 					}
649 649
 				}
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 		if ( ! $view->form ) {
699 699
 			gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array(
700 700
 				'view_id' => $view->ID,
701
-				'form_id' => $view->_gravityview_form_id ? : 0,
701
+				'form_id' => $view->_gravityview_form_id ?: 0,
702 702
 			) );
703 703
 		}
704 704
 
@@ -937,11 +937,11 @@  discard block
 block discarded – undo
937 937
 			 * Remove multiple sorting before calling legacy filters.
938 938
 			 * This allows us to fake it till we make it.
939 939
 			 */
940
-			if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) {
940
+			if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) {
941 941
 				$has_multisort = true;
942
-				$parameters['sort_field'] = reset( $parameters['sort_field'] );
943
-				if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) {
944
-					$parameters['sort_direction'] = reset( $parameters['sort_direction'] );
942
+				$parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] );
943
+				if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) {
944
+					$parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] );
945 945
 				}
946 946
 			}
947 947
 
@@ -950,31 +950,30 @@  discard block
 block discarded – undo
950 950
 			 */
951 951
 			$parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID );
952 952
 
953
-			$parameters['context_view_id'] = $this->ID;
953
+			$parameters[ 'context_view_id' ] = $this->ID;
954 954
 			$parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID );
955 955
 
956 956
 			if ( ! is_array( $parameters ) ) {
957 957
 				$parameters = array();
958 958
 			}
959 959
 
960
-			if ( ! is_array( $parameters['search_criteria'] ) ) {
961
-				$parameters['search_criteria'] = array();
960
+			if ( ! is_array( $parameters[ 'search_criteria' ] ) ) {
961
+				$parameters[ 'search_criteria' ] = array();
962 962
 			}
963 963
 
964
-			if ( ( ! isset( $parameters['search_criteria']['field_filters'] ) ) || ( ! is_array( $parameters['search_criteria']['field_filters'] ) ) ) {
965
-				$parameters['search_criteria']['field_filters'] = array();
964
+			if ( ( ! isset( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) || ( ! is_array( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) ) {
965
+				$parameters[ 'search_criteria' ][ 'field_filters' ] = array();
966 966
 			}
967 967
 
968 968
 			if ( $request instanceof REST\Request ) {
969 969
 				$atts = $this->settings->as_atts();
970 970
 				$paging_parameters = wp_parse_args( $request->get_paging(), array(
971
-						'paging' => array( 'page_size' => $atts['page_size'] ),
971
+						'paging' => array( 'page_size' => $atts[ 'page_size' ] ),
972 972
 					) );
973
-				$parameters['paging'] = $paging_parameters['paging'];
973
+				$parameters[ 'paging' ] = $paging_parameters[ 'paging' ];
974 974
 			}
975 975
 
976
-			$page = Utils::get( $parameters['paging'], 'current_page' ) ?
977
-				: ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 );
976
+			$page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 );
978 977
 
979 978
 			/**
980 979
 			 * Cleanup duplicate field_filter parameters to simplify the query.
@@ -982,14 +981,14 @@  discard block
 block discarded – undo
982 981
 			$unique_field_filters = array();
983 982
 			foreach ( Utils::get( $parameters, 'search_criteria/field_filters', array() ) as $key => $filter ) {
984 983
 				if ( 'mode' === $key ) {
985
-					$unique_field_filters['mode'] = $filter;
984
+					$unique_field_filters[ 'mode' ] = $filter;
986 985
 				} else if ( ! in_array( $filter, $unique_field_filters ) ) {
987
-					$unique_field_filters[] = $filter;
986
+					$unique_field_filters[ ] = $filter;
988 987
 				}
989 988
 			}
990
-			$parameters['search_criteria']['field_filters'] = $unique_field_filters;
989
+			$parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters;
991 990
 
992
-			if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) {
991
+			if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) {
993 992
 				gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' );
994 993
 			}
995 994
 
@@ -998,7 +997,7 @@  discard block
 block discarded – undo
998 997
 				$query_class = $this->get_query_class();
999 998
 
1000 999
 				/** @type \GF_Query $query */
1001
-				$query = new $query_class( $this->form->ID, $parameters['search_criteria'], Utils::get( $parameters, 'sorting' ) );
1000
+				$query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], Utils::get( $parameters, 'sorting' ) );
1002 1001
 
1003 1002
 				/**
1004 1003
 				 * Apply multisort.
@@ -1009,15 +1008,15 @@  discard block
 block discarded – undo
1009 1008
 					$view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() );
1010 1009
 					$view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() );
1011 1010
 
1012
-					$has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] );
1011
+					$has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] );
1013 1012
 
1014
-					if( $has_sort_query_param ) {
1015
-						$has_sort_query_param = array_filter( array_values( $_GET['sort'] ) );
1013
+					if ( $has_sort_query_param ) {
1014
+						$has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) );
1016 1015
 					}
1017 1016
 
1018 1017
 					if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) {
1019
-						$sort_field_ids = array_keys( $_GET['sort'] );
1020
-						$sort_directions = array_values( $_GET['sort'] );
1018
+						$sort_field_ids = array_keys( $_GET[ 'sort' ] );
1019
+						$sort_directions = array_values( $_GET[ 'sort' ] );
1021 1020
 					} else {
1022 1021
 						$sort_field_ids = $view_setting_sort_field_ids;
1023 1022
 						$sort_directions = $view_setting_sort_directions;
@@ -1025,7 +1024,7 @@  discard block
 block discarded – undo
1025 1024
 
1026 1025
 					$skip_first = false;
1027 1026
 
1028
-					foreach ( (array) $sort_field_ids as $key => $sort_field_id ) {
1027
+					foreach ( (array)$sort_field_ids as $key => $sort_field_id ) {
1029 1028
 
1030 1029
 						if ( ! $skip_first && ! $has_sort_query_param ) {
1031 1030
 							$skip_first = true; // Skip the first one, it's already in the query
@@ -1055,15 +1054,15 @@  discard block
 block discarded – undo
1055 1054
 
1056 1055
 					$merged_time = false;
1057 1056
 
1058
-					foreach ( $q['order'] as $oid => $order ) {
1059
-						if ( $order[0] instanceof \GF_Query_Column ) {
1060
-							$column = $order[0];
1061
-						} else if ( $order[0] instanceof \GF_Query_Call ) {
1062
-							if ( count( $order[0]->columns ) != 1 || ! $order[0]->columns[0] instanceof \GF_Query_Column ) {
1057
+					foreach ( $q[ 'order' ] as $oid => $order ) {
1058
+						if ( $order[ 0 ] instanceof \GF_Query_Column ) {
1059
+							$column = $order[ 0 ];
1060
+						} else if ( $order[ 0 ] instanceof \GF_Query_Call ) {
1061
+							if ( count( $order[ 0 ]->columns ) != 1 || ! $order[ 0 ]->columns[ 0 ] instanceof \GF_Query_Column ) {
1063 1062
 								$orders[ $oid ] = $order;
1064 1063
 								continue; // Need something that resembles a single sort
1065 1064
 							}
1066
-							$column = $order[0]->columns[0];
1065
+							$column = $order[ 0 ]->columns[ 0 ];
1067 1066
 						}
1068 1067
 
1069 1068
 						if ( ( ! $field = \GFAPI::get_field( $column->source, $column->field_id ) ) || $field->type !== 'time' ) {
@@ -1077,7 +1076,7 @@  discard block
 block discarded – undo
1077 1076
 
1078 1077
 						$orders[ $oid ] = array(
1079 1078
 							new \GV\Mocks\GF_Query_Call_TIMESORT( 'timesort', array( $column, $sql ) ),
1080
-							$order[1] // Mock it!
1079
+							$order[ 1 ] // Mock it!
1081 1080
 						);
1082 1081
 
1083 1082
 						$merged_time = true;
@@ -1088,15 +1087,15 @@  discard block
 block discarded – undo
1088 1087
 						 * ORDER again.
1089 1088
 						 */
1090 1089
 						if ( ! empty( $orders ) && $_orders = $query->_order_generate( $orders ) ) {
1091
-							$sql['order'] = 'ORDER BY ' . implode( ', ', $_orders );
1090
+							$sql[ 'order' ] = 'ORDER BY ' . implode( ', ', $_orders );
1092 1091
 						}
1093 1092
 					}
1094 1093
 
1095 1094
 					return $sql;
1096 1095
 				} );
1097 1096
 
1098
-				$query->limit( $parameters['paging']['page_size'] )
1099
-					->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) );
1097
+				$query->limit( $parameters[ 'paging' ][ 'page_size' ] )
1098
+					->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) );
1100 1099
 
1101 1100
 				/**
1102 1101
 				 * Any joins?
@@ -1119,7 +1118,7 @@  discard block
 block discarded – undo
1119 1118
 
1120 1119
 							$query_parameters = $query->_introspect();
1121 1120
 
1122
-							$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
1121
+							$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
1123 1122
 						}
1124 1123
 
1125 1124
 						/**
@@ -1153,7 +1152,7 @@  discard block
 block discarded – undo
1153 1152
 						}
1154 1153
 
1155 1154
 						$q = $query->_introspect();
1156
-						$query->where( \GF_Query_Condition::_and( $q['where'], $condition ) );
1155
+						$query->where( \GF_Query_Condition::_and( $q[ 'where' ], $condition ) );
1157 1156
 
1158 1157
 						if ( $this->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
1159 1158
 
@@ -1178,7 +1177,7 @@  discard block
 block discarded – undo
1178 1177
 
1179 1178
 							$query_parameters = $query->_introspect();
1180 1179
 
1181
-							$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
1180
+							$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
1182 1181
 						}
1183 1182
 					}
1184 1183
 
@@ -1202,7 +1201,7 @@  discard block
 block discarded – undo
1202 1201
 							$conditions = array();
1203 1202
 
1204 1203
 							foreach ( $condition->expressions as $_condition ) {
1205
-								$conditions[] = $recurse( $_condition, $fields, $recurse );
1204
+								$conditions[ ] = $recurse( $_condition, $fields, $recurse );
1206 1205
 							}
1207 1206
 
1208 1207
 							return call_user_func_array(
@@ -1231,10 +1230,10 @@  discard block
 block discarded – undo
1231 1230
 						$q = new $query_class( $form_id );
1232 1231
 
1233 1232
 						// Copy the WHERE clauses but substitute the field_ids to the respective ones
1234
-						$q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) );
1233
+						$q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) );
1235 1234
 
1236 1235
 						// Copy the ORDER clause and substitute the field_ids to the respective ones
1237
-						foreach ( $query_parameters['order'] as $order ) {
1236
+						foreach ( $query_parameters[ 'order' ] as $order ) {
1238 1237
 							list( $column, $_order ) = $order;
1239 1238
 
1240 1239
 							if ( $column && $column instanceof \GF_Query_Column ) {
@@ -1248,15 +1247,15 @@  discard block
 block discarded – undo
1248 1247
 
1249 1248
 						add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) {
1250 1249
 							// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1251
-							$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1250
+							$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1252 1251
 
1253 1252
 							// Record the SQL
1254
-							$unions_sql[] = array(
1253
+							$unions_sql[ ] = array(
1255 1254
 								// Remove columns, we'll rebuild them
1256 1255
 								'select'  => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ),
1257
-								'from'    => $sql['from'],
1258
-								'join'    => $sql['join'],
1259
-								'where'   => $sql['where'],
1256
+								'from'    => $sql[ 'from' ],
1257
+								'join'    => $sql[ 'join' ],
1258
+								'where'   => $sql[ 'where' ],
1260 1259
 								// Remove order and limit
1261 1260
 							);
1262 1261
 
@@ -1273,11 +1272,11 @@  discard block
 block discarded – undo
1273 1272
 
1274 1273
 					add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) {
1275 1274
 						// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1276
-						$sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1275
+						$sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1277 1276
 
1278 1277
 						// Remove columns, we'll rebuild them
1279
-						preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match );
1280
-						$sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] );
1278
+						preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match );
1279
+						$sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] );
1281 1280
 
1282 1281
 						$unions = array();
1283 1282
 
@@ -1288,30 +1287,30 @@  discard block
 block discarded – undo
1288 1287
 						};
1289 1288
 
1290 1289
 						// Add all the order columns into the selects, so we can order by the whole union group
1291
-						preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches );
1290
+						preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches );
1292 1291
 
1293 1292
 						$columns = array(
1294
-							sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) )
1293
+							sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) )
1295 1294
 						);
1296 1295
 
1297 1296
 						foreach ( array_slice( $order_matches, 1 ) as $match ) {
1298
-							$columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) );
1297
+							$columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) );
1299 1298
 
1300 1299
 							// Rewrite the order columns to the shared aliases
1301
-							$sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] );
1300
+							$sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] );
1302 1301
 						}
1303 1302
 
1304 1303
 						$columns = array_unique( $columns );
1305 1304
 
1306 1305
 						// Add the columns to every UNION
1307 1306
 						foreach ( $unions_sql as $union_sql ) {
1308
-							$union_sql['select'] .= implode( ', ', $columns );
1309
-							$unions []= implode( ' ', $union_sql );
1307
+							$union_sql[ 'select' ] .= implode( ', ', $columns );
1308
+							$unions [ ] = implode( ' ', $union_sql );
1310 1309
 						}
1311 1310
 
1312 1311
 						// Add the columns to the main SELECT, but only grab the entry id column
1313
-						$sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns );
1314
-						$sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order'];
1312
+						$sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns );
1313
+						$sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ];
1315 1314
 
1316 1315
 						return $sql;
1317 1316
 					} );
@@ -1356,20 +1355,20 @@  discard block
 block discarded – undo
1356 1355
 				} );
1357 1356
 			} else {
1358 1357
 				$entries = $this->form->entries
1359
-					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) )
1358
+					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) )
1360 1359
 					->offset( $this->settings->get( 'offset' ) )
1361
-					->limit( $parameters['paging']['page_size'] )
1360
+					->limit( $parameters[ 'paging' ][ 'page_size' ] )
1362 1361
 					->page( $page );
1363 1362
 
1364
-				if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) {
1363
+				if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) {
1365 1364
 					// Pluck off multisort arrays
1366
-					$parameters['sorting'] = $parameters['sorting'][0];
1365
+					$parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ];
1367 1366
 				}
1368 1367
 
1369
-				if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) {
1368
+				if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) {
1370 1369
 					$field = new \GV\Field();
1371
-					$field->ID = $parameters['sorting']['key'];
1372
-					$direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1370
+					$field->ID = $parameters[ 'sorting' ][ 'key' ];
1371
+					$direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1373 1372
 					$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
1374 1373
 				}
1375 1374
 			}
@@ -1454,7 +1453,7 @@  discard block
 block discarded – undo
1454 1453
 		$allowed = $headers = array();
1455 1454
 
1456 1455
 		foreach ( $view->fields->by_position( "directory_*" )->by_visible( $view )->all() as $id => $field ) {
1457
-			$allowed[] = $field;
1456
+			$allowed[ ] = $field;
1458 1457
 		}
1459 1458
 
1460 1459
 		$renderer = new Field_Renderer();
@@ -1476,17 +1475,17 @@  discard block
 block discarded – undo
1476 1475
 			} );
1477 1476
 
1478 1477
 			foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) {
1479
-				$allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
1478
+				$allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
1480 1479
 			}
1481 1480
 
1482 1481
 			foreach ( $allowed as $field ) {
1483 1482
 				$source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source();
1484 1483
 
1485
-				$return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' );
1484
+				$return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' );
1486 1485
 
1487 1486
 				if ( ! $headers_done ) {
1488 1487
 					$label = $field->get_label( $view, $source, $entry );
1489
-					$headers[] = $label ? $label : $field->ID;
1488
+					$headers[ ] = $label ? $label : $field->ID;
1490 1489
 				}
1491 1490
 			}
1492 1491
 
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			'search_clear' => array(
55 55
 				'type'  => 'checkbox',
56 56
 				'label' => __( 'Show Clear button', 'gravityview' ),
57
-				'desc'  => __( 'When a search is performed, display a button that removes all search values.', 'gravityview'),
57
+				'desc'  => __( 'When a search is performed, display a button that removes all search values.', 'gravityview' ),
58 58
 				'value' => true,
59 59
 			),
60 60
 			'search_fields' => array(
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 				'type' => 'radio',
68 68
 				'full_width' => true,
69 69
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
70
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
70
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
71 71
 				'value' => 'any',
72 72
 				'class' => 'hide-if-js',
73 73
 				'options' => array(
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
88 88
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
89
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
89
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
90 90
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
91 91
 
92 92
 			// ajax - get the searchable fields
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function add_reserved_args( $args ) {
124 124
 
125
-		$args[] = 'gv_search';
126
-		$args[] = 'gv_start';
127
-		$args[] = 'gv_end';
128
-		$args[] = 'gv_id';
129
-		$args[] = 'gv_by';
130
-		$args[] = 'mode';
125
+		$args[ ] = 'gv_search';
126
+		$args[ ] = 'gv_start';
127
+		$args[ ] = 'gv_end';
128
+		$args[ ] = 'gv_id';
129
+		$args[ ] = 'gv_by';
130
+		$args[ ] = 'mode';
131 131
 
132
-		$get = (array) $_GET;
132
+		$get = (array)$_GET;
133 133
 
134 134
 		// If the fields being searched as reserved; not to be considered user-passed variables
135 135
 		foreach ( $get as $key => $value ) {
136 136
 			if ( $key !== $this->convert_request_key_to_filter_key( $key ) ) {
137
-				$args[] = $key;
137
+				$args[ ] = $key;
138 138
 			}
139 139
 		}
140 140
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
259 259
 		$script_source = empty( $script_min ) ? '/source' : '';
260 260
 
261
-		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 );
261
+		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 );
262 262
 
263 263
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
264 264
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
281 281
 	 */
282 282
 	public function register_no_conflict( $allowed ) {
283
-		$allowed[] = 'gravityview_searchwidget_admin';
283
+		$allowed[ ] = 'gravityview_searchwidget_admin';
284 284
 		return $allowed;
285 285
 	}
286 286
 
@@ -292,24 +292,24 @@  discard block
 block discarded – undo
292 292
 	 */
293 293
 	public static function get_searchable_fields() {
294 294
 
295
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
295
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
296 296
 			exit( '0' );
297 297
 		}
298 298
 
299 299
 		$form = '';
300 300
 
301 301
 		// Fetch the form for the current View
302
-		if ( ! empty( $_POST['view_id'] ) ) {
302
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
303 303
 
304
-			$form = gravityview_get_form_id( $_POST['view_id'] );
304
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
305 305
 
306
-		} elseif ( ! empty( $_POST['formid'] ) ) {
306
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
307 307
 
308
-			$form = (int) $_POST['formid'];
308
+			$form = (int)$_POST[ 'formid' ];
309 309
 
310
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
310
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
311 311
 
312
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
312
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
313 313
 
314 314
 		}
315 315
 
@@ -359,14 +359,14 @@  discard block
 block discarded – undo
359 359
 		);
360 360
 
361 361
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
362
-			$custom_fields['is_approved'] = array(
362
+			$custom_fields[ 'is_approved' ] = array(
363 363
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
364 364
 				'type' => 'multi',
365 365
 			);
366 366
 		}
367 367
 
368
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
369
-			$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'] );
368
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
369
+			$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' ] );
370 370
 		}
371 371
 
372 372
 		// Get fields with sub-inputs and no parent
@@ -388,13 +388,13 @@  discard block
 block discarded – undo
388 388
 
389 389
 			foreach ( $fields as $id => $field ) {
390 390
 
391
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
391
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
392 392
 					continue;
393 393
 				}
394 394
 
395
-				$types = self::get_search_input_types( $id, $field['type'] );
395
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
396 396
 
397
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
397
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
398 398
 			}
399 399
 		}
400 400
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
418 418
 
419 419
 		// @todo - This needs to be improved - many fields have . including products and addresses
420
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
420
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
421 421
 			$input_type = 'boolean'; // on/off checkbox
422 422
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
423 423
 			$input_type = 'multi'; //multiselect
@@ -463,19 +463,19 @@  discard block
 block discarded – undo
463 463
 			$post_id = 0;
464 464
 
465 465
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
466
-			if ( ! empty( $widget_args['post_id'] ) ) {
467
-				$post_id = absint( $widget_args['post_id'] );
466
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
467
+				$post_id = absint( $widget_args[ 'post_id' ] );
468 468
 			}
469 469
 			// We're in the WordPress Widget context, and the base View ID should be used
470
-			else if ( ! empty( $widget_args['view_id'] ) ) {
471
-				$post_id = absint( $widget_args['view_id'] );
470
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
471
+				$post_id = absint( $widget_args[ 'view_id' ] );
472 472
 			}
473 473
 
474 474
 			$args = gravityview_get_permalink_query_args( $post_id );
475 475
 
476 476
 			// Add hidden fields to the search form
477 477
 			foreach ( $args as $key => $value ) {
478
-				$search_fields[] = array(
478
+				$search_fields[ ] = array(
479 479
 					'name'  => $key,
480 480
 					'input' => 'hidden',
481 481
 					'value' => $value,
@@ -514,28 +514,28 @@  discard block
 block discarded – undo
514 514
 		/**
515 515
 		 * Include the sidebar Widgets.
516 516
 		 */
517
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
517
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
518 518
 
519 519
 		foreach ( $widgets as $widget ) {
520
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
521
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
520
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
521
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
522 522
 					foreach ( $_fields as $field ) {
523
-						if ( empty( $field['form_id'] ) ) {
524
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
523
+						if ( empty( $field[ 'form_id' ] ) ) {
524
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
525 525
 						}
526
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
526
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
527 527
 					}
528 528
 				}
529 529
 			}
530 530
 		}
531 531
 
532 532
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
533
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
533
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
534 534
 				foreach ( $_fields as $field ) {
535
-					if ( empty( $field['form_id'] ) ) {
536
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
535
+					if ( empty( $field[ 'form_id' ] ) ) {
536
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
537 537
 					}
538
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
538
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
539 539
 				}
540 540
 			}
541 541
 		}
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
574 574
 		}
575 575
 
576
-		if( 'post' === $this->search_method ) {
576
+		if ( 'post' === $this->search_method ) {
577 577
 			$get = $_POST;
578 578
 		} else {
579 579
 			$get = $_GET;
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		$get = gv_map_deep( $get, 'rawurldecode' );
593 593
 
594 594
 		// Make sure array key is set up
595
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
595
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
596 596
 
597 597
 		$searchable_fields = $this->get_view_searchable_fields( $view );
598 598
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
 		$trim_search_value = apply_filters( 'gravityview/search-trim-input', true );
613 613
 
614 614
 		// add free search
615
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
615
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
616 616
 
617
-			$search_all_value = $trim_search_value ? trim( $get['gv_search'] ) : $get['gv_search'];
617
+			$search_all_value = $trim_search_value ? trim( $get[ 'gv_search' ] ) : $get[ 'gv_search' ];
618 618
 
619 619
 			if ( $split_words ) {
620 620
 				// Search for a piece
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 			}
631 631
 
632 632
 			foreach ( $words as $word ) {
633
-				$search_criteria['field_filters'][] = array(
633
+				$search_criteria[ 'field_filters' ][ ] = array(
634 634
 					'key' => null, // The field ID to search
635 635
 					'value' => $word, // The value to search
636 636
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -643,14 +643,14 @@  discard block
 block discarded – undo
643 643
 			/**
644 644
 			 * Get and normalize the dates according to the input format.
645 645
 			 */
646
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
647
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
646
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
647
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
648 648
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
649 649
 				}
650 650
 			}
651 651
 
652
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
653
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
652
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
653
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
654 654
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
655 655
 				}
656 656
 			}
@@ -686,22 +686,22 @@  discard block
 block discarded – undo
686 686
 			 */
687 687
 			if ( ! empty( $curr_start ) ) {
688 688
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
689
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
689
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
690 690
 			}
691 691
 
692 692
 			if ( ! empty( $curr_end ) ) {
693 693
 				// Fast-forward 24 hour on the end time
694 694
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
695
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
696
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
697
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
695
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
696
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
697
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
698 698
 				}
699 699
 			}
700 700
 		}
701 701
 
702 702
 		// search for a specific entry ID
703 703
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
704
-			$search_criteria['field_filters'][] = array(
704
+			$search_criteria[ 'field_filters' ][ ] = array(
705 705
 				'key' => 'id',
706 706
 				'value' => absint( $get[ 'gv_id' ] ),
707 707
 				'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ),
@@ -710,15 +710,15 @@  discard block
 block discarded – undo
710 710
 
711 711
 		// search for a specific Created_by ID
712 712
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
713
-			$search_criteria['field_filters'][] = array(
713
+			$search_criteria[ 'field_filters' ][ ] = array(
714 714
 				'key' => 'created_by',
715
-				'value' => $get['gv_by'],
715
+				'value' => $get[ 'gv_by' ],
716 716
 				'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ),
717 717
 			);
718 718
 		}
719 719
 
720 720
 		// Get search mode passed in URL
721
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
721
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
722 722
 
723 723
 		// get the other search filters
724 724
 		foreach ( $get as $key => $value ) {
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 				$value = is_array( $value ) ? array_map( 'trim', $value ) : trim( $value );
728 728
 			}
729 729
 
730
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
730
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
731 731
 				continue; // Not a filter, or empty
732 732
 			}
733 733
 
@@ -741,21 +741,21 @@  discard block
 block discarded – undo
741 741
 				continue;
742 742
 			}
743 743
 
744
-			if ( ! isset( $filter['operator'] ) ) {
745
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
744
+			if ( ! isset( $filter[ 'operator' ] ) ) {
745
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
746 746
 			}
747 747
 
748
-			if ( isset( $filter[0]['value'] ) ) {
749
-				$filter[0]['value'] = $trim_search_value ? trim( $filter[0]['value'] ) : $filter[0]['value'];
748
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
749
+				$filter[ 0 ][ 'value' ] = $trim_search_value ? trim( $filter[ 0 ][ 'value' ] ) : $filter[ 0 ][ 'value' ];
750 750
 
751
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
751
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
752 752
 
753 753
 				// if date range type, set search mode to ALL
754
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
754
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
755 755
 					$mode = 'all';
756 756
 				}
757
-			} elseif( !empty( $filter ) ) {
758
-				$search_criteria['field_filters'][] = $filter;
757
+			} elseif ( ! empty( $filter ) ) {
758
+				$search_criteria[ 'field_filters' ][ ] = $filter;
759 759
 			}
760 760
 		}
761 761
 
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 		 * @since 1.5.1
765 765
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
766 766
 		 */
767
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
767
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
768 768
 
769 769
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
770 770
 
@@ -798,19 +798,19 @@  discard block
 block discarded – undo
798 798
 
799 799
 		$query_class = $view->get_query_class();
800 800
 
801
-		if ( empty( $search_criteria['field_filters'] ) ) {
801
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
802 802
 			return;
803 803
 		}
804 804
 
805 805
 		$widgets = $view->widgets->by_id( $this->widget_id );
806 806
 		if ( $widgets->count() ) {
807 807
 			$widgets = $widgets->all();
808
-			$widget  = $widgets[0];
808
+			$widget  = $widgets[ 0 ];
809 809
 
810 810
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
811 811
 
812
-			foreach ( (array) $search_fields as $search_field ) {
813
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
812
+			foreach ( (array)$search_fields as $search_field ) {
813
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
814 814
 					$created_by_text_mode = true;
815 815
 				}
816 816
 			}
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 		$extra_conditions = array();
820 820
 		$mode = 'any';
821 821
 
822
-		foreach ( $search_criteria['field_filters'] as &$filter ) {
822
+		foreach ( $search_criteria[ 'field_filters' ] as &$filter ) {
823 823
 			if ( ! is_array( $filter ) ) {
824 824
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
825 825
 					$mode = $filter;
@@ -828,13 +828,13 @@  discard block
 block discarded – undo
828 828
 			}
829 829
 
830 830
 			// Construct a manual query for unapproved statuses
831
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
832
-				$_tmp_query       = new $query_class( $view->form->ID, array(
831
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
832
+				$_tmp_query = new $query_class( $view->form->ID, array(
833 833
 					'field_filters' => array(
834 834
 						array(
835 835
 							'operator' => 'in',
836 836
 							'key'      => 'is_approved',
837
-							'value'    => (array) $filter['value'],
837
+							'value'    => (array)$filter[ 'value' ],
838 838
 						),
839 839
 						array(
840 840
 							'operator' => 'is',
@@ -846,30 +846,30 @@  discard block
 block discarded – undo
846 846
 				) );
847 847
 				$_tmp_query_parts = $_tmp_query->_introspect();
848 848
 
849
-				$extra_conditions[] = $_tmp_query_parts['where'];
849
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
850 850
 
851 851
 				$filter = false;
852 852
 				continue;
853 853
 			}
854 854
 
855 855
 			// Construct manual query for text mode creator search
856
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
857
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
856
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
857
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
858 858
 				$filter = false;
859 859
 				continue;
860 860
 			}
861 861
 
862 862
 			// By default, we want searches to be wildcard for each field.
863
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
863
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
864 864
 
865 865
 			// For multichoice, let's have an in (OR) search.
866
-			if ( is_array( $filter['value'] ) ) {
867
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
866
+			if ( is_array( $filter[ 'value' ] ) ) {
867
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
868 868
 			}
869 869
 
870 870
 			// Default form with joins functionality
871
-			if ( empty( $filter['form_id'] ) ) {
872
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
871
+			if ( empty( $filter[ 'form_id' ] ) ) {
872
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
873 873
 			}
874 874
 
875 875
 			/**
@@ -879,28 +879,28 @@  discard block
 block discarded – undo
879 879
 			 * @since develop
880 880
 			 * @param \GV\View $view The View we're operating on.
881 881
 			 */
882
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );
882
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view );
883 883
 		}
884 884
 
885
-		if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) {
885
+		if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) {
886 886
 			$date_criteria = array();
887 887
 
888
-			if ( isset( $search_criteria['start_date'] ) ) {
889
-				$date_criteria['start_date'] = $search_criteria['start_date'];
888
+			if ( isset( $search_criteria[ 'start_date' ] ) ) {
889
+				$date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ];
890 890
 			}
891 891
 
892
-			if ( isset( $search_criteria['end_date'] ) ) {
893
-				$date_criteria['end_date'] = $search_criteria['end_date'];
892
+			if ( isset( $search_criteria[ 'end_date' ] ) ) {
893
+				$date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ];
894 894
 			}
895 895
 
896 896
 			$_tmp_query         = new $query_class( $view->form->ID, $date_criteria );
897 897
 			$_tmp_query_parts   = $_tmp_query->_introspect();
898
-			$extra_conditions[] = $_tmp_query_parts['where'];
898
+			$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
899 899
 		}
900 900
 
901 901
 		$search_conditions = array();
902 902
 
903
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
903
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
904 904
 			foreach ( $filters as &$filter ) {
905 905
 				if ( ! is_array( $filter ) ) {
906 906
 					continue;
@@ -912,12 +912,12 @@  discard block
 block discarded – undo
912 912
 				 * code by reusing what's inside GF_Query already as they
913 913
 				 * take care of many small things like forcing numeric, etc.
914 914
 				 */
915
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
915
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
916 916
 				$_tmp_query_parts = $_tmp_query->_introspect();
917
-				$search_condition = $_tmp_query_parts['where'];
917
+				$search_condition = $_tmp_query_parts[ 'where' ];
918 918
 
919
-				if ( empty( $filter['key'] ) && $search_condition->expressions ) {
920
-					$search_conditions[] = $search_condition;
919
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
920
+					$search_conditions[ ] = $search_condition;
921 921
 				} else {
922 922
 					$left = $search_condition->left;
923 923
 					$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 							$on = $_join->join_on;
928 928
 							$join = $_join->join;
929 929
 
930
-							$search_conditions[] = GF_Query_Condition::_or(
930
+							$search_conditions[ ] = GF_Query_Condition::_or(
931 931
 								// Join
932 932
 								new GF_Query_Condition(
933 933
 									new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ),
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 							);
944 944
 						}
945 945
 					} else {
946
-						$search_conditions[] = new GF_Query_Condition(
946
+						$search_conditions[ ] = new GF_Query_Condition(
947 947
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
948 948
 							$search_condition->operator,
949 949
 							$search_condition->right
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 		/**
966 966
 		 * Combine the parts as a new WHERE clause.
967 967
 		 */
968
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
968
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
969 969
 		$query->where( $where );
970 970
 	}
971 971
 
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 		$field_id = str_replace( 'filter_', '', $key );
989 989
 
990 990
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
991
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
991
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
992 992
 			$field_id = str_replace( '_', '.', $field_id );
993 993
 		}
994 994
 
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
 			// form is in searchable fields
1046 1046
 			$found = false;
1047 1047
 			foreach ( $searchable_fields as $field ) {
1048
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
1048
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
1049 1049
 					$found = true;
1050 1050
 					break;
1051 1051
 				}
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 
1086 1086
 			case 'select':
1087 1087
 			case 'radio':
1088
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1088
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1089 1089
 				break;
1090 1090
 
1091 1091
 			case 'post_category':
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 				foreach ( $value as $val ) {
1101 1101
 					$cat = get_term( $val, 'category' );
1102
-					$filter[] = array(
1102
+					$filter[ ] = array(
1103 1103
 						'key'      => $field_id,
1104 1104
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
1105 1105
 						'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
 				$filter = array();
1119 1119
 
1120 1120
 				foreach ( $value as $val ) {
1121
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1121
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1122 1122
 				}
1123 1123
 
1124 1124
 				break;
@@ -1127,9 +1127,9 @@  discard block
 block discarded – undo
1127 1127
 				// convert checkbox on/off into the correct search filter
1128 1128
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1129 1129
 					foreach ( $form_field->inputs as $k => $input ) {
1130
-						if ( $input['id'] == $field_id ) {
1131
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1132
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1130
+						if ( $input[ 'id' ] == $field_id ) {
1131
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1132
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1133 1133
 							break;
1134 1134
 						}
1135 1135
 					}
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 					$filter = array();
1140 1140
 
1141 1141
 					foreach ( $value as $val ) {
1142
-						$filter[] = array(
1142
+						$filter[ ] = array(
1143 1143
 							'key'      => $field_id,
1144 1144
 							'value'    => $val,
1145 1145
 							'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1160,9 +1160,9 @@  discard block
 block discarded – undo
1160 1160
 					foreach ( $words as $word ) {
1161 1161
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1162 1162
 							// Keep the same key for each filter
1163
-							$filter['value'] = $word;
1163
+							$filter[ 'value' ] = $word;
1164 1164
 							// Add a search for the value
1165
-							$filters[] = $filter;
1165
+							$filters[ ] = $filter;
1166 1166
 						}
1167 1167
 					}
1168 1168
 
@@ -1176,19 +1176,19 @@  discard block
 block discarded – undo
1176 1176
 
1177 1177
 					foreach ( $searchable_fields as $searchable_field ) {
1178 1178
 
1179
-						if( $form_field->ID !== $searchable_field['field'] ) {
1179
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1180 1180
 							continue;
1181 1181
 						}
1182 1182
 
1183 1183
 						// Only exact-match dropdowns, not text search
1184
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1184
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1185 1185
 							continue;
1186 1186
 						}
1187 1187
 
1188 1188
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1189 1189
 
1190 1190
 						if ( 4 === $input_id ) {
1191
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1191
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1192 1192
 						};
1193 1193
 					}
1194 1194
 				}
@@ -1216,12 +1216,12 @@  discard block
 block discarded – undo
1216 1216
 						 * @since 1.16.3
1217 1217
 						 * Safeguard until GF implements '<=' operator
1218 1218
 						 */
1219
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1219
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1220 1220
 							$operator = '<';
1221 1221
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1222 1222
 						}
1223 1223
 
1224
-						$filter[] = array(
1224
+						$filter[ ] = array(
1225 1225
 							'key'      => $field_id,
1226 1226
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1227 1227
 							'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ),
@@ -1229,12 +1229,12 @@  discard block
 block discarded – undo
1229 1229
 					}
1230 1230
 				} else {
1231 1231
 					$date = $value;
1232
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1233
-					$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1232
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1233
+					$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1234 1234
 				}
1235 1235
 
1236
-				if ('payment_date' === $key) {
1237
-					$filter['operator'] = 'contains';
1236
+				if ( 'payment_date' === $key ) {
1237
+					$filter[ 'operator' ] = 'contains';
1238 1238
 				}
1239 1239
 
1240 1240
 				break;
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 			'ymd_dot' => 'Y.m.d',
1264 1264
 		);
1265 1265
 
1266
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1266
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1267 1267
 			$format = $datepicker[ $field->dateFormat ];
1268 1268
 		}
1269 1269
 
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
 	public function add_template_path( $file_paths ) {
1301 1301
 
1302 1302
 		// Index 100 is the default GravityView template path.
1303
-		$file_paths[102] = self::$file . 'templates/';
1303
+		$file_paths[ 102 ] = self::$file . 'templates/';
1304 1304
 
1305 1305
 		return $file_paths;
1306 1306
 	}
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 		$has_date = false;
1320 1320
 
1321 1321
 		foreach ( $search_fields as $k => $field ) {
1322
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1322
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1323 1323
 				$has_date = true;
1324 1324
 				break;
1325 1325
 			}
@@ -1348,7 +1348,7 @@  discard block
 block discarded – undo
1348 1348
 		$view = \GV\View::by_id( $gravityview_view->view_id );
1349 1349
 
1350 1350
 		// get configured search fields
1351
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1351
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1352 1352
 
1353 1353
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1354 1354
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1362,40 +1362,40 @@  discard block
 block discarded – undo
1362 1362
 
1363 1363
 			$updated_field = $this->get_search_filter_details( $updated_field, $context );
1364 1364
 
1365
-			switch ( $field['field'] ) {
1365
+			switch ( $field[ 'field' ] ) {
1366 1366
 
1367 1367
 				case 'search_all':
1368
-					$updated_field['key'] = 'search_all';
1369
-					$updated_field['input'] = 'search_all';
1370
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1368
+					$updated_field[ 'key' ] = 'search_all';
1369
+					$updated_field[ 'input' ] = 'search_all';
1370
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1371 1371
 					break;
1372 1372
 
1373 1373
 				case 'entry_date':
1374
-					$updated_field['key'] = 'entry_date';
1375
-					$updated_field['input'] = 'entry_date';
1376
-					$updated_field['value'] = array(
1374
+					$updated_field[ 'key' ] = 'entry_date';
1375
+					$updated_field[ 'input' ] = 'entry_date';
1376
+					$updated_field[ 'value' ] = array(
1377 1377
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1378 1378
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1379 1379
 					);
1380 1380
 					break;
1381 1381
 
1382 1382
 				case 'entry_id':
1383
-					$updated_field['key'] = 'entry_id';
1384
-					$updated_field['input'] = 'entry_id';
1385
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1383
+					$updated_field[ 'key' ] = 'entry_id';
1384
+					$updated_field[ 'input' ] = 'entry_id';
1385
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1386 1386
 					break;
1387 1387
 
1388 1388
 				case 'created_by':
1389
-					$updated_field['key'] = 'created_by';
1390
-					$updated_field['name'] = 'gv_by';
1391
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1392
-					$updated_field['choices'] = self::get_created_by_choices( $view );
1389
+					$updated_field[ 'key' ] = 'created_by';
1390
+					$updated_field[ 'name' ] = 'gv_by';
1391
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1392
+					$updated_field[ 'choices' ] = self::get_created_by_choices( $view );
1393 1393
 					break;
1394 1394
 
1395 1395
 				case 'is_approved':
1396
-					$updated_field['key'] = 'is_approved';
1397
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1398
-					$updated_field['choices'] = self::get_is_approved_choices();
1396
+					$updated_field[ 'key' ] = 'is_approved';
1397
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1398
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1399 1399
 					break;
1400 1400
 			}
1401 1401
 
@@ -1416,16 +1416,16 @@  discard block
 block discarded – undo
1416 1416
 
1417 1417
 		$gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args );
1418 1418
 
1419
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1419
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1420 1420
 
1421 1421
 		/** @since 1.14 */
1422
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1422
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1423 1423
 
1424
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1424
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1425 1425
 
1426 1426
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1427 1427
 
1428
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1428
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1429 1429
 
1430 1430
 		if ( $this->has_date_field( $search_fields ) ) {
1431 1431
 			// enqueue datepicker stuff only if needed!
@@ -1447,10 +1447,10 @@  discard block
 block discarded – undo
1447 1447
 	public static function get_search_class( $custom_class = '' ) {
1448 1448
 		$gravityview_view = GravityView_View::getInstance();
1449 1449
 
1450
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1450
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1451 1451
 
1452
-		if ( ! empty( $custom_class )  ) {
1453
-			$search_class .= ' '.$custom_class;
1452
+		if ( ! empty( $custom_class ) ) {
1453
+			$search_class .= ' ' . $custom_class;
1454 1454
 		}
1455 1455
 
1456 1456
 		/**
@@ -1501,9 +1501,9 @@  discard block
 block discarded – undo
1501 1501
 
1502 1502
 		if ( ! $label ) {
1503 1503
 
1504
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1504
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1505 1505
 
1506
-			switch( $field['field'] ) {
1506
+			switch ( $field[ 'field' ] ) {
1507 1507
 				case 'search_all':
1508 1508
 					$label = __( 'Search Entries:', 'gravityview' );
1509 1509
 					break;
@@ -1515,10 +1515,10 @@  discard block
 block discarded – undo
1515 1515
 					break;
1516 1516
 				default:
1517 1517
 					// If this is a field input, not a field
1518
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1518
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1519 1519
 
1520 1520
 						// Get the label for the field in question, which returns an array
1521
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1521
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1522 1522
 
1523 1523
 						// Get the item with the `label` key
1524 1524
 						$values = wp_list_pluck( $items, 'label' );
@@ -1559,13 +1559,13 @@  discard block
 block discarded – undo
1559 1559
 		$form = $gravityview_view->getForm();
1560 1560
 
1561 1561
 		// for advanced field ids (eg, first name / last name )
1562
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1562
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1563 1563
 
1564 1564
 		// get searched value from $_GET/$_POST (string or array)
1565 1565
 		$value = $this->rgget_or_rgpost( $name );
1566 1566
 
1567 1567
 		// get form field details
1568
-		$form_field = gravityview_get_field( $form, $field['field'] );
1568
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1569 1569
 
1570 1570
 		$form_field_type = \GV\Utils::get( $form_field, 'type' );
1571 1571
 
@@ -1579,17 +1579,17 @@  discard block
 block discarded – undo
1579 1579
 		);
1580 1580
 
1581 1581
 		// collect choices
1582
-		if ( 'post_category' === $form_field_type && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1583
-			$filter['choices'] = gravityview_get_terms_choices();
1584
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1585
-			$filter['choices'] = $form_field['choices'];
1582
+		if ( 'post_category' === $form_field_type && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1583
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1584
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1585
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1586 1586
 		}
1587 1587
 
1588
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1589
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1588
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1589
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1590 1590
 		}
1591 1591
 
1592
-		if ( ! empty( $filter['choices'] ) ) {
1592
+		if ( ! empty( $filter[ 'choices' ] ) ) {
1593 1593
 			/**
1594 1594
 			 * @filter `gravityview/search/sieve_choices` Only output used choices for this field.
1595 1595
 			 * @param[in,out] bool Yes or no.
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
 			 * @param \GV\Context The context.
1598 1598
 			 */
1599 1599
 			if ( apply_filters( 'gravityview/search/sieve_choices', false, $field, $context ) ) {
1600
-				$filter['choices'] = $this->sieve_filter_choices( $filter, $context );
1600
+				$filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context );
1601 1601
 			}
1602 1602
 		}
1603 1603
 
@@ -1626,11 +1626,11 @@  discard block
 block discarded – undo
1626 1626
 	 * @return array The filter choices.
1627 1627
 	 */
1628 1628
 	private function sieve_filter_choices( $filter, $context ) {
1629
-		if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) {
1629
+		if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) {
1630 1630
 			return $filter; // @todo Populate plugins might give us empty choices
1631 1631
 		}
1632 1632
 
1633
-		if ( ! is_numeric( $filter['key'] ) ) {
1633
+		if ( ! is_numeric( $filter[ 'key' ] ) ) {
1634 1634
 			return $filter;
1635 1635
 		}
1636 1636
 
@@ -1640,29 +1640,29 @@  discard block
 block discarded – undo
1640 1640
 
1641 1641
 		$table = GFFormsModel::get_entry_meta_table_name();
1642 1642
 
1643
-		$key_like = $wpdb->esc_like( $filter['key'] ) . '.%';
1643
+		$key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%';
1644 1644
 
1645 1645
 		switch ( \GV\Utils::get( $filter, 'type' ) ):
1646 1646
 			case 'post_category':
1647 1647
 				$choices = $wpdb->get_col( $wpdb->prepare(
1648 1648
 					"SELECT DISTINCT SUBSTRING_INDEX(meta_value, ':', 1) FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1649
-					$key_like, $filter['key'], $form_id
1649
+					$key_like, $filter[ 'key' ], $form_id
1650 1650
 				) );
1651 1651
 				break;
1652 1652
 			default:
1653 1653
 				$choices = $wpdb->get_col( $wpdb->prepare(
1654 1654
 					"SELECT DISTINCT meta_value FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1655
-					$key_like, $filter['key'], $form_id
1655
+					$key_like, $filter[ 'key' ], $form_id
1656 1656
 				) );
1657 1657
 
1658
-				if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) {
1658
+				if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) {
1659 1659
 					$choices = array_map( 'json_decode', $choices );
1660 1660
 					$_choices_array = array();
1661 1661
 					foreach ( $choices as $choice ) {
1662 1662
 						if ( is_array( $choice ) ) {
1663 1663
 							$_choices_array = array_merge( $_choices_array, $choice );
1664 1664
 						} else {
1665
-							$_choices_array []= $choice;
1665
+							$_choices_array [ ] = $choice;
1666 1666
 						}
1667 1667
 					}
1668 1668
 					$choices = array_unique( $_choices_array );
@@ -1672,9 +1672,9 @@  discard block
 block discarded – undo
1672 1672
 		endswitch;
1673 1673
 
1674 1674
 		$filter_choices = array();
1675
-		foreach ( $filter['choices'] as $choice ) {
1676
-			if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) {
1677
-				$filter_choices[] = $choice;
1675
+		foreach ( $filter[ 'choices' ] as $choice ) {
1676
+			if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) {
1677
+				$filter_choices[ ] = $choice;
1678 1678
 			}
1679 1679
 		}
1680 1680
 
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
 			 * @param \GV\View $view The view.
1710 1710
 			 */
1711 1711
 			$text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view );
1712
-			$choices[] = array(
1712
+			$choices[ ] = array(
1713 1713
 				'value' => $user->ID,
1714 1714
 				'text' => $text,
1715 1715
 			);
@@ -1729,9 +1729,9 @@  discard block
 block discarded – undo
1729 1729
 
1730 1730
 		$choices = array();
1731 1731
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1732
-			$choices[] = array(
1733
-				'value' => $status['value'],
1734
-				'text' => $status['label'],
1732
+			$choices[ ] = array(
1733
+				'value' => $status[ 'value' ],
1734
+				'text' => $status[ 'label' ],
1735 1735
 			);
1736 1736
 		}
1737 1737
 
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
 	 */
1784 1784
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1785 1785
 
1786
-		$js_dependencies[] = 'jquery-ui-datepicker';
1786
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1787 1787
 
1788 1788
 		return $js_dependencies;
1789 1789
 	}
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
 			'isRTL'             => is_rtl(),
1828 1828
 		), $view_data );
1829 1829
 
1830
-		$localizations['datepicker'] = $datepicker_settings;
1830
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1831 1831
 
1832 1832
 		return $localizations;
1833 1833
 
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
 	 * @return void
1855 1855
 	 */
1856 1856
 	private function maybe_enqueue_flexibility() {
1857
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1857
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1858 1858
 			wp_enqueue_script( 'gv-flexibility' );
1859 1859
 		}
1860 1860
 	}
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1877 1877
 
1878 1878
 		$scheme = is_ssl() ? 'https://' : 'http://';
1879
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1879
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1880 1880
 
1881 1881
 		/**
1882 1882
 		 * @filter `gravityview_search_datepicker_class`
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 	public function add_preview_inputs() {
1956 1956
 		global $wp;
1957 1957
 
1958
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
1958
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
1959 1959
 			return;
1960 1960
 		}
1961 1961
 
@@ -2007,7 +2007,7 @@  discard block
 block discarded – undo
2007 2007
  */
2008 2008
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
2009 2009
 	public function __construct( $filter, $view ) {
2010
-		$this->value = $filter['value'];
2010
+		$this->value = $filter[ 'value' ];
2011 2011
 		$this->view = $view;
2012 2012
 	}
2013 2013
 
@@ -2039,11 +2039,11 @@  discard block
 block discarded – undo
2039 2039
 		$conditions = array();
2040 2040
 
2041 2041
 		foreach ( $user_fields as $user_field ) {
2042
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
2042
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
2043 2043
 		}
2044 2044
 
2045 2045
 		foreach ( $user_meta_fields as $meta_field ) {
2046
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
2046
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
2047 2047
 		}
2048 2048
 
2049 2049
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-sequence.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		$this->label = esc_html__( 'Number Sequence', 'gravityview' );
42 42
 		$this->description = esc_html__( 'Display a sequential result number for each entry.', 'gravityview' );
43 43
 
44
-		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips') );
44
+		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips' ) );
45 45
 
46 46
 		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
47 47
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 			return $entry_default_fields;
66 66
 		}
67 67
 
68
-		$entry_default_fields['sequence'] = array(
68
+		$entry_default_fields[ 'sequence' ] = array(
69 69
 			'label' => __( 'Result Number', 'gravityview' ),
70 70
 			'type'  => $this->name,
71 71
 			'desc'  => $this->description,
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 
85 85
 		$return = $tooltips;
86 86
 
87
-		$return['reverse_sequence'] = array(
88
-			'title' => __('Reverse the order of the result numbers', 'gravityview'),
89
-			'value' => __('Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview'),
87
+		$return[ 'reverse_sequence' ] = array(
88
+			'title' => __( 'Reverse the order of the result numbers', 'gravityview' ),
89
+			'value' => __( 'Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview' ),
90 90
 		);
91 91
 
92 92
 		return $return;
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
96 96
 
97
-		unset ( $field_options['search_filter'] );
97
+		unset ( $field_options[ 'search_filter' ] );
98 98
 
99 99
 		$new_fields = array(
100 100
 			'start' => array(
101 101
 				'type' => 'number',
102 102
 				'label' => __( 'First Number in the Sequence', 'gravityview' ),
103
-				'desc' => __('For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview'),
103
+				'desc' => __( 'For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview' ),
104 104
 				'value' => '1',
105 105
 				'merge_tags' => false,
106 106
 			),
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 		$return = $text;
157 157
 
158 158
 		$context = new \GV\Template_Context();
159
-		$context->view = \GV\View::by_id( $view_data['view_id'] );
159
+		$context->view = \GV\View::by_id( $view_data[ 'view_id' ] );
160 160
 		$context->entry = \GV\GF_Entry::from_entry( $entry );
161 161
 
162 162
 		$gv_field = \GV\Internal_Field::by_id( 'sequence' );
163 163
 		$merge_tag_context = \GV\Utils::get( $legacy_field, 'UID' );
164
-		$merge_tag_context = $entry['id'] . "/{$merge_tag_context}";
164
+		$merge_tag_context = $entry[ 'id' ] . "/{$merge_tag_context}";
165 165
 
166 166
 		foreach ( $matches as $match ) {
167 167
 
168
-			$full_tag = $match[0];
169
-			$property = $match[1];
168
+			$full_tag = $match[ 0 ];
169
+			$property = $match[ 1 ];
170 170
 
171 171
 			$gv_field->reverse = false;
172 172
 			$gv_field->start = 1;
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
 
186 186
 				// If there is a field with the ID of the start number, the merge tag won't work.
187 187
 				// In that case, you can use "=" instead: `{sequence start=10}`
188
-				if( 1 === sizeof( $maybe_start ) ) {
188
+				if ( 1 === sizeof( $maybe_start ) ) {
189 189
 					$maybe_start = explode( '=', $modifier );
190 190
 				}
191 191
 
192 192
 				if ( 'start' === rgar( $maybe_start, 0 ) && is_numeric( rgar( $maybe_start, 1 ) ) ) {
193
-					$gv_field->start = (int) rgar( $maybe_start, 1 );
193
+					$gv_field->start = (int)rgar( $maybe_start, 1 );
194 194
 				}
195 195
 			}
196 196
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			$merge_tag_context_modifiers = $merge_tag_context . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
202 202
 
203 203
 			if ( ! isset( $merge_tag_sequences[ $merge_tag_context_modifiers ] ) ) {
204
-				$gv_field->UID = $legacy_field['UID'] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
204
+				$gv_field->UID = $legacy_field[ 'UID' ] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
205 205
 				$context->field = $gv_field;
206 206
 				$sequence = $merge_tag_sequences[ $merge_tag_context_modifiers ] = $this->get_sequence( $context );
207 207
 			} else {
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			$total = $context->view->get_entries()->total();
247 247
 			remove_filter( 'gform_gf_query_sql', $callback );
248 248
 
249
-			unset( $sql_query['paginate'] );
249
+			unset( $sql_query[ 'paginate' ] );
250 250
 
251 251
 			global $wpdb;
252 252
 
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/select-template.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -26,52 +26,52 @@
 block discarded – undo
26 26
 
27 27
 <?php // list all the available templates (type= fresh or custom ) ?>
28 28
 <div class="gv-grid">
29
-	<?php foreach( $templates as $id => $template ) {
29
+	<?php foreach ( $templates as $id => $template ) {
30 30
 		$selected     = ( $id == $current_template ) ? ' gv-selected' : '';
31
-		$placeholder  = ! empty( $template['buy_source'] );
32
-		$is_included  = ! empty( $template['included'] );
31
+		$placeholder  = ! empty( $template[ 'buy_source' ] );
32
+		$is_included  = ! empty( $template[ 'included' ] );
33 33
 		$plugin_data  = GravityView_Admin_Installer::get_wp_plugins_data( \GV\Utils::get( $template, 'textdomain', '' ) );
34 34
 		$button_text  = empty( $plugin_data ) ? esc_html__( 'Install Layout', 'gravityview' ) : esc_html__( 'Activate & Select Layout', 'gravityview' );
35 35
 		$button_class = 'gv-layout-' . ( empty( $plugin_data ) ? 'install' : 'activate' );
36
-		$template_path = isset($plugin_data['path']) ? $plugin_data['path'] : '';
36
+		$template_path = isset( $plugin_data[ 'path' ] ) ? $plugin_data[ 'path' ] : '';
37 37
 
38 38
 		?>
39 39
 		<div class="gv-grid-col-1-4">
40
-			<div class="gv-view-types-module<?php echo $selected; if( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>">
40
+			<div class="gv-view-types-module<?php echo $selected; if ( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template[ 'type' ] ); ?>">
41 41
 				<div class="gv-view-types-normal">
42
-					<img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>">
43
-					<h5><?php echo esc_html( $template['label'] ); ?></h5>
44
-					<p class="description"><?php echo esc_html( $template['description'] ); ?></p>
42
+					<img src="<?php echo esc_url( $template[ 'logo' ] ); ?>" alt="<?php echo esc_attr( $template[ 'label' ] ); ?>">
43
+					<h5><?php echo esc_html( $template[ 'label' ] ); ?></h5>
44
+					<p class="description"><?php echo esc_html( $template[ 'description' ] ); ?></p>
45 45
 				</div>
46 46
 				<div class="gv-view-types-hover">
47 47
 					<div>
48 48
 						<?php
49
-						if( $is_included ) {
49
+						if ( $is_included ) {
50 50
 						?>
51 51
 							<p><a href="<?php echo esc_url( admin_url( 'edit.php?post_type=gravityview&page=gv-admin-installer' ) ); ?>" class="button button-secondary button-hero <?php echo $button_class; ?>" rel="internal" data-template-path="<?php echo $template_path; ?>"><?php echo $button_text; ?></a></p>
52
-							<?php if( !empty( $template['license'] ) ) { ?>
53
-								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', '&nbsp;', $template['license'] ) ) ); ?></p>
52
+							<?php if ( ! empty( $template[ 'license' ] ) ) { ?>
53
+								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', '&nbsp;', $template[ 'license' ] ) ) ); ?></p>
54 54
 							<?php } ?>
55 55
 						<?php
56
-						} elseif( $placeholder ) {
57
-							$utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template['license'] ) . '&utm_content=' . urlencode( $template['slug'] );
56
+						} elseif ( $placeholder ) {
57
+							$utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template[ 'license' ] ) . '&utm_content=' . urlencode( $template[ 'slug' ] );
58 58
 							?>
59
-							<p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p>
59
+							<p><a href="<?php echo esc_url( $template[ 'buy_source' ] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview' ); ?></a></p>
60 60
 
61
-							<?php if( !empty( $template['preview'] ) ) { ?>
62
-								<p><a href="<?php echo esc_url( $template['preview'] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview'); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p>
61
+							<?php if ( ! empty( $template[ 'preview' ] ) ) { ?>
62
+								<p><a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview' ); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p>
63 63
 							<?php } ?>
64 64
 
65
-							<?php if( ! empty( $template['license'] ) ) { ?>
66
-								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://gravityview.co/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', '&nbsp;', $template['license'] ) ) . '</a>' ); ?></p>
65
+							<?php if ( ! empty( $template[ 'license' ] ) ) { ?>
66
+								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://gravityview.co/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', '&nbsp;', $template[ 'license' ] ) ) . '</a>' ); ?></p>
67 67
 							<?php } ?>
68 68
 						<?php }
69 69
 
70
-						if ($placeholder || $is_included) { ?> </div><div class="hidden"> <?php } ?>
70
+						if ( $placeholder || $is_included ) { ?> </div><div class="hidden"> <?php } ?>
71 71
 
72
-                        <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p>
73
-                        <?php if( !empty( $template['preview'] ) ) { ?>
74
-                            <a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a>
72
+                        <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview' ); ?></a></p>
73
+                        <?php if ( ! empty( $template[ 'preview' ] ) ) { ?>
74
+                            <a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview' ); ?>"></i></a>
75 75
                         <?php } ?>
76 76
 					</div>
77 77
 				</div>
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-consent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,13 +97,13 @@
 block discarded – undo
97 97
 		// Set the $_field_id var
98 98
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id );
99 99
 
100
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
100
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
101 101
 			$default = 'tick';
102 102
 		} else {
103 103
 			$default = 'both';
104 104
 		}
105 105
 
106
-		$field_options['choice_display'] = array(
106
+		$field_options[ 'choice_display' ] = array(
107 107
 			'type'    => 'radio',
108 108
 			'class'   => 'vertical',
109 109
 			'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.