Completed
Pull Request — develop (#1800)
by Zack
15:47
created
future/includes/rest/class-gv-rest-views-route.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			'total' => wp_count_posts( 'gravityview' )->publish,
64 64
 		);
65 65
 		foreach ( $items as $item ) {
66
-			$data['views'][] = $this->prepare_view_for_response( $item, $request );
66
+			$data[ 'views' ][ ] = $this->prepare_view_for_response( $item, $request );
67 67
 		}
68 68
 
69 69
 		return new \WP_REST_Response( $data, 200 );
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 		$url = $request->get_url_params();
84 84
 
85
-		$view_id = intval( $url['id'] );
85
+		$view_id = intval( $url[ 'id' ] );
86 86
 
87 87
 		$item = get_post( $view_id );
88 88
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		// Only output the fields that should be displayed.
115 115
 		$allowed = array();
116 116
 		foreach ( $view->fields->by_position( "{$context}_*" )->by_visible( $view )->all() as $field ) {
117
-			$allowed[] = $field;
117
+			$allowed[ ] = $field;
118 118
 		}
119 119
 
120 120
 		/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 		// Tack on additional fields if needed
135 135
 		foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) {
136
-			$allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
136
+			$allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
137 137
 		}
138 138
 
139 139
 		$r = new Request( $request );
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
 	public function get_sub_items( $request ) {
212 212
 
213 213
 		$url     = $request->get_url_params();
214
-		$view_id = intval( $url['id'] );
214
+		$view_id = intval( $url[ 'id' ] );
215 215
 		$format  = \GV\Utils::get( $url, 'format', 'json' );
216 216
 
217
-		if( $post_id = $request->get_param('post_id') ) {
217
+		if ( $post_id = $request->get_param( 'post_id' ) ) {
218 218
 			global $post;
219 219
 
220 220
 			$post = get_post( $post_id );
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
 		$data = array( 'entries' => $entries->all(), 'total' => $entries->total() );
321 321
 
322
-		foreach ( $data['entries'] as &$entry ) {
322
+		foreach ( $data[ 'entries' ] as &$entry ) {
323 323
 			$entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory' );
324 324
 		}
325 325
 
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
 	 */
339 339
 	public function get_sub_item( $request ) {
340 340
 		$url      = $request->get_url_params();
341
-		$view_id  = intval( $url['id'] );
342
-		$entry_id = intval( $url['s_id'] );
341
+		$view_id  = intval( $url[ 'id' ] );
342
+		$entry_id = intval( $url[ 's_id' ] );
343 343
 		$format   = \GV\Utils::get( $url, 'format', 'json' );
344 344
 
345 345
 		$view  = \GV\View::by_id( $view_id );
@@ -374,32 +374,32 @@  discard block
 block discarded – undo
374 374
 		// Add all the WP_Post data
375 375
 		$view_post = $view_post->to_array();
376 376
 
377
-		unset( $view_post['to_ping'], $view_post['ping_status'], $view_post['pinged'], $view_post['post_type'], $view_post['filter'], $view_post['post_category'], $view_post['tags_input'], $view_post['post_content'], $view_post['post_content_filtered'] );
377
+		unset( $view_post[ 'to_ping' ], $view_post[ 'ping_status' ], $view_post[ 'pinged' ], $view_post[ 'post_type' ], $view_post[ 'filter' ], $view_post[ 'post_category' ], $view_post[ 'tags_input' ], $view_post[ 'post_content' ], $view_post[ 'post_content_filtered' ] );
378 378
 
379 379
 		$return = wp_parse_args( $item, $view_post );
380 380
 
381
-		$return['title'] = $return['post_title'];
381
+		$return[ 'title' ] = $return[ 'post_title' ];
382 382
 
383
-		$return['settings'] = isset( $return['atts'] ) ? $return['atts'] : array();
384
-		unset( $return['atts'], $return['view_id'] );
383
+		$return[ 'settings' ] = isset( $return[ 'atts' ] ) ? $return[ 'atts' ] : array();
384
+		unset( $return[ 'atts' ], $return[ 'view_id' ] );
385 385
 
386
-		$return['search_criteria'] = array(
386
+		$return[ 'search_criteria' ] = array(
387 387
 			'page_size' => rgars( $return, 'settings/page_size' ),
388 388
 			'sort_field' => rgars( $return, 'settings/sort_field' ),
389 389
 			'sort_direction' => rgars( $return, 'settings/sort_direction' ),
390 390
 			'offset' => rgars( $return, 'settings/offset' ),
391 391
 		);
392 392
 
393
-		unset( $return['settings']['page_size'], $return['settings']['sort_field'], $return['settings']['sort_direction'] );
393
+		unset( $return[ 'settings' ][ 'page_size' ], $return[ 'settings' ][ 'sort_field' ], $return[ 'settings' ][ 'sort_direction' ] );
394 394
 
395 395
 		// Redact for non-logged ins
396 396
 		if ( ! \GVCommon::has_cap( 'edit_others_gravityviews' ) ) {
397
-			unset( $return['settings'] );
398
-			unset( $return['search_criteria'] );
397
+			unset( $return[ 'settings' ] );
398
+			unset( $return[ 'search_criteria' ] );
399 399
 		}
400 400
 		
401 401
 		if ( ! \GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) {
402
-			unset( $return['form'] );
402
+			unset( $return[ 'form' ] );
403 403
 		}
404 404
 
405 405
 		return $return;
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 			$view_id = func_get_arg( 1 ); // $view_id override
416 416
 		} else {
417 417
 			$url     = $request->get_url_params();
418
-			$view_id = intval( $url['id'] );
418
+			$view_id = intval( $url[ 'id' ] );
419 419
 		}
420 420
 
421 421
 		if ( ! $view = \GV\View::by_id( $view_id ) ) {
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 		}
462 462
 
463 463
 		$url     = $request->get_url_params();
464
-		$view_id = intval( $url['id'] );
465
-		$entry_id = intval( $url['s_id'] );
464
+		$view_id = intval( $url[ 'id' ] );
465
+		$entry_id = intval( $url[ 's_id' ] );
466 466
 
467 467
 		$view = \GV\View::by_id( $view_id );
468 468
 
@@ -470,11 +470,11 @@  discard block
 block discarded – undo
470 470
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
471 471
 		}
472 472
 
473
-		if ( $entry['form_id'] != $view->form->ID ) {
473
+		if ( $entry[ 'form_id' ] != $view->form->ID ) {
474 474
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
475 475
 		}
476 476
 
477
-		if ( $entry['status'] != 'active' ) {
477
+		if ( $entry[ 'status' ] != 'active' ) {
478 478
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
479 479
 		}
480 480
 
@@ -482,10 +482,10 @@  discard block
 block discarded – undo
482 482
 			return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
483 483
 		}
484 484
 
485
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
485
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
486 486
 
487 487
 		if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
488
-			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
488
+			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
489 489
 				return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' );
490 490
 			}
491 491
 		}
Please login to merge, or discard this patch.
includes/extensions/entry-notes/fields/notes.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 $gravityview_view = GravityView_View::getInstance();
10 10
 
11 11
 $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' );
12
-$show_notes_logged_out = ( ! empty( $visibility_settings['view'] ) && ! empty( $visibility_settings['view_loggedout'] ) );
12
+$show_notes_logged_out = ( ! empty( $visibility_settings[ 'view' ] ) && ! empty( $visibility_settings[ 'view_loggedout' ] ) );
13 13
 
14
-if(	! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) {
14
+if ( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) {
15 15
 	return;
16 16
 }
17 17
 
@@ -25,20 +25,20 @@  discard block
 block discarded – undo
25 25
 do_action( 'gravityview/field/notes/scripts' );
26 26
 
27 27
 $entry      = $gravityview_view->getCurrentEntry();
28
-$notes      = (array) GravityView_Entry_Notes::get_notes( $entry['id'] );
28
+$notes      = (array)GravityView_Entry_Notes::get_notes( $entry[ 'id' ] );
29 29
 $strings    = GravityView_Field_Notes::strings();
30
-$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
30
+$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
31 31
 
32
-$show_add = ! empty( $visibility_settings['add'] );
33
-$show_delete = ( ! empty( $visibility_settings['delete'] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) );
34
-$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings['view'] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) );
32
+$show_add = ! empty( $visibility_settings[ 'add' ] );
33
+$show_delete = ( ! empty( $visibility_settings[ 'delete' ] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) );
34
+$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings[ 'view' ] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) );
35 35
 
36 36
 $container_class = ( sizeof( $notes ) > 0 ? 'gv-has-notes' : 'gv-no-notes' );
37 37
 $container_class .= $show_notes ? ' gv-show-notes' : ' gv-hide-notes';
38 38
 ?>
39 39
 <div class="gv-notes <?php echo $container_class; ?>">
40 40
 <?php
41
-	if( $show_notes ) {
41
+	if ( $show_notes ) {
42 42
 ?>
43 43
 	<form method="post" class="gv-notes-list">
44 44
 		<?php if ( $show_delete ) { wp_nonce_field( 'gv_delete_notes_' . $entry_slug, 'gv_delete_notes' ); } ?>
@@ -46,21 +46,21 @@  discard block
 block discarded – undo
46 46
 			<input type="hidden" name="action" value="gv_delete_notes" />
47 47
 			<input type="hidden" name="entry-slug" value="<?php echo esc_attr( $entry_slug ); ?>" />
48 48
 			<table>
49
-				<caption><?php echo $strings['caption']; ?></caption>
49
+				<caption><?php echo $strings[ 'caption' ]; ?></caption>
50 50
 				<?php
51 51
 				if ( $show_delete ) {
52 52
 				?>
53 53
 				<thead>
54 54
 					<tr>
55 55
 						<th colspan="2">
56
-							<label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings['toggle-notes']; ?>"><span class="screen-reader-text"><?php echo $strings['toggle-notes']; ?></span></label>
57
-							<button type="submit" class="button button-small gv-notes-delete"><?php echo $strings['delete']; ?></button>
56
+							<label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings[ 'toggle-notes' ]; ?>"><span class="screen-reader-text"><?php echo $strings[ 'toggle-notes' ]; ?></span></label>
57
+							<button type="submit" class="button button-small gv-notes-delete"><?php echo $strings[ 'delete' ]; ?></button>
58 58
 						</th>
59 59
 					</tr>
60 60
 				</thead>
61 61
 				<?php } ?>
62 62
 				<tbody>
63
-					<tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings['no-notes']; ?></td></tr>
63
+					<tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings[ 'no-notes' ]; ?></td></tr>
64 64
 					<?php
65 65
 						foreach ( $notes as $note ) {
66 66
 							echo GravityView_Field_Notes::display_note( $note, $show_delete );
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 <?php
74 74
 	} // End if can view notes
75 75
 
76
-	if( $show_add ) {
76
+	if ( $show_add ) {
77 77
 		echo do_shortcode( '[gv_note_add]' );
78 78
 	}
79 79
 ?>
Please login to merge, or discard this patch.
includes/extensions/duplicate-entry/class-duplicate-entry.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public static function get_duplicate_link( $entry, $view_id, $post_id = null ) {
248 248
 
249
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
249
+		$base = GravityView_API::directory_link( $post_id ? : $view_id, true );
250 250
 
251 251
 		if ( empty( $base ) ) {
252 252
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 			'action'	=> 'duplicate',
258 258
 			'entry_id'	=> $entry['id'],
259 259
 			'gvid' => $view_id,
260
-            'view_id' => $view_id,
260
+			'view_id' => $view_id,
261 261
 		), $base );
262 262
 
263 263
 		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl );
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 		 * @since 2.5
461 461
 		 * @param  array $duplicated_entry The duplicated entry
462 462
 		 * @param  array $entry The original entry
463
-		*/
463
+		 */
464 464
 		do_action( 'gravityview/duplicate-entry/duplicated', $duplicated_entry, $entry );
465 465
 
466 466
 		gravityview()->log->debug( 'Duplicate response: {duplicate_response}', array( 'duplicate_response' => $duplicate_response ) );
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 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', 'gk-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:', 'gk-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', 'gk-gravityview' ),
241 241
 				'type'  => 'duplicate_link',
242 242
 				'desc'  => __( 'A link to duplicate the entry. Respects the Duplicate Entry permissions.', 'gk-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', 'gk-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', 'gk-gravityview' );
296
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gk-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.', 'gk-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.', 'gk-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', 'gk-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', 'gk-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.', 'gk-gravityview' );
845
+				$messages[ ] = esc_html__( 'Entry duplicated.', 'gk-gravityview' );
846 846
 				return $messages;
847 847
 			} );
848 848
 		}
@@ -854,9 +854,9 @@  discard block
 block discarded – undo
854 854
 			);
855 855
 
856 856
 			add_filter( 'gform_admin_error_messages', function( $messages ) use ( $check_logs_message ) {
857
-				$messages = (array) $messages;
857
+				$messages = (array)$messages;
858 858
 
859
-				$messages[] = esc_html__( 'There was an error duplicating the entry.', 'gk-gravityview' ) . $check_logs_message;
859
+				$messages[ ] = esc_html__( 'There was an error duplicating the entry.', 'gk-gravityview' ) . $check_logs_message;
860 860
 
861 861
 				return $messages;
862 862
 			} );
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/view-configuration.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 
32 32
 			<?php
33 33
 
34
-                do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID );
34
+				do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID );
35 35
 
36
-    			do_action('gravityview_render_field_pickers', 'directory' );
36
+				do_action('gravityview_render_field_pickers', 'directory' );
37 37
 
38
-            ?>
38
+			?>
39 39
 
40 40
 			<?php // list of available widgets to be shown in the popup ?>
41 41
             <div id="directory-available-widgets" class="hide-if-js gv-tooltip">
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 
61 61
 			<div id="single-active-fields" class="gv-grid">
62 62
 				<?php
63
-                if(!empty( $curr_template ) ) {
64
-				    do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true );
65
-                }
66
-			    ?>
63
+				if(!empty( $curr_template ) ) {
64
+					do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true );
65
+				}
66
+				?>
67 67
 			</div>
68 68
             <?php
69
-                do_action('gravityview_render_field_pickers', 'single' );
69
+				do_action('gravityview_render_field_pickers', 'single' );
70 70
 			?>
71 71
 		</div>
72 72
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			</div>
86 86
 
87 87
 			<?php
88
-			    do_action('gravityview_render_field_pickers', 'edit' );
88
+				do_action('gravityview_render_field_pickers', 'edit' );
89 89
 			?>
90 90
 
91 91
 		</div>
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -15,25 +15,25 @@  discard block
 block discarded – undo
15 15
 
16 16
 		<div id="directory-fields" class="gv-section">
17 17
 
18
-			<h4><?php esc_html_e( 'Top Widgets', 'gk-gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gk-gravityview'); ?></span></h4>
18
+			<h4><?php esc_html_e( 'Top Widgets', 'gk-gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gk-gravityview' ); ?></span></h4>
19 19
 
20
-			<?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?>
20
+			<?php do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?>
21 21
 
22
-			<h4><?php esc_html_e( 'Entries Fields', 'gk-gravityview'); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gk-gravityview'); ?></span></h4>
22
+			<h4><?php esc_html_e( 'Entries Fields', 'gk-gravityview' ); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gk-gravityview' ); ?></span></h4>
23 23
 
24 24
 			<div id="directory-active-fields" class="gv-grid">
25
-				<?php if(!empty( $curr_template ) ) {
26
-					do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true );
25
+				<?php if ( ! empty( $curr_template ) ) {
26
+					do_action( 'gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true );
27 27
 				} ?>
28 28
 			</div>
29 29
 
30
-			<h4><?php esc_html_e( 'Bottom Widgets', 'gk-gravityview'); ?> <i class="gf_tooltip gv_tooltip" title="<?php esc_attr_e( 'These widgets will be shown below entries.', 'gk-gravityview'); ?>"></i></h4>
30
+			<h4><?php esc_html_e( 'Bottom Widgets', 'gk-gravityview' ); ?> <i class="gf_tooltip gv_tooltip" title="<?php esc_attr_e( 'These widgets will be shown below entries.', 'gk-gravityview' ); ?>"></i></h4>
31 31
 
32 32
 			<?php
33 33
 
34
-                do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID );
34
+                do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID );
35 35
 
36
-    			do_action('gravityview_render_field_pickers', 'directory' );
36
+    			do_action( 'gravityview_render_field_pickers', 'directory' );
37 37
 
38 38
             ?>
39 39
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             <div id="directory-available-widgets" class="hide-if-js gv-tooltip">
42 42
 				<div aria-live="polite" role="listbox" class="gv-items-picker-container gv-widget-picker-container" data-layout="grid" data-cols="2">
43 43
                 	<button class="close" role="button" aria-label="<?php esc_html_e( 'Close', 'gk-gravityview' ); ?>"><i class="dashicons dashicons-dismiss"></i></button>
44
-					<?php do_action('gravityview_render_available_widgets' ); ?>
44
+					<?php do_action( 'gravityview_render_available_widgets' ); ?>
45 45
 				</div>
46 46
             </div>
47 47
 
@@ -59,21 +59,21 @@  discard block
 block discarded – undo
59 59
 		<div id="single-fields" class="gv-section">
60 60
 
61 61
 			<div class="notice notice-warning inline is-dismissible">
62
-				<h3><?php printf( esc_html__( 'Note: %s', 'gk-gravityview' ), sprintf( esc_html__( 'No fields link to the %s layout.', 'gk-gravityview'), esc_html__( 'Single Entry', 'gk-gravityview' ) ) ); ?></h3>
62
+				<h3><?php printf( esc_html__( 'Note: %s', 'gk-gravityview' ), sprintf( esc_html__( 'No fields link to the %s layout.', 'gk-gravityview' ), esc_html__( 'Single Entry', 'gk-gravityview' ) ) ); ?></h3>
63 63
 				<p><a data-beacon-article-modal="54c67bbae4b0512429885516" href="https://docs.gravityview.co/article/70-linking-to-a-single-entry"><?php printf( esc_html__( 'Learn how to link to %s', 'gk-gravityview' ), esc_html__( 'Single Entry', 'gk-gravityview' ) ); ?></a></p>
64 64
 			</div>
65 65
 
66
-			<h4><?php esc_html_e( 'These fields will be shown in Single Entry layout.', 'gk-gravityview'); ?></h4>
66
+			<h4><?php esc_html_e( 'These fields will be shown in Single Entry layout.', 'gk-gravityview' ); ?></h4>
67 67
 
68 68
 			<div id="single-active-fields" class="gv-grid">
69 69
 				<?php
70
-                if(!empty( $curr_template ) ) {
71
-				    do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true );
70
+                if ( ! empty( $curr_template ) ) {
71
+				    do_action( 'gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true );
72 72
                 }
73 73
 			    ?>
74 74
 			</div>
75 75
             <?php
76
-                do_action('gravityview_render_field_pickers', 'single' );
76
+                do_action( 'gravityview_render_field_pickers', 'single' );
77 77
 			?>
78 78
 		</div>
79 79
 
@@ -84,20 +84,20 @@  discard block
 block discarded – undo
84 84
 		<div id="edit-fields" class="gv-section">
85 85
 
86 86
 			<div class="notice notice-warning inline is-dismissible">
87
-				<h3><?php printf( esc_html__( 'Note: %s', 'gk-gravityview' ), sprintf( esc_html__( 'No fields link to the %s layout.', 'gk-gravityview'), esc_html__( 'Edit Entry', 'gk-gravityview' ) ) ); ?></h3>
87
+				<h3><?php printf( esc_html__( 'Note: %s', 'gk-gravityview' ), sprintf( esc_html__( 'No fields link to the %s layout.', 'gk-gravityview' ), esc_html__( 'Edit Entry', 'gk-gravityview' ) ) ); ?></h3>
88 88
 				<p><a data-beacon-article-modal="54c67bb9e4b0512429885513" href="https://docs.gravityview.co/article/67-configuring-the-edit-entry-screen"><?php printf( esc_html__( 'Learn how to link to %s', 'gk-gravityview' ), esc_html__( 'Edit Entry', 'gk-gravityview' ) ); ?></a></p>
89 89
 			</div>
90 90
 
91
-			<h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gk-gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gk-gravityview'); ?></span></h4>
91
+			<h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gk-gravityview' ); ?> <span><?php esc_html_e( 'If not configured, all form fields will be displayed.', 'gk-gravityview' ); ?></span></h4>
92 92
 
93 93
 			<div id="edit-active-fields" class="gv-grid">
94 94
 				<?php
95
-				do_action('gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true );
95
+				do_action( 'gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true );
96 96
 				?>
97 97
 			</div>
98 98
 
99 99
 			<?php
100
-			    do_action('gravityview_render_field_pickers', 'edit' );
100
+			    do_action( 'gravityview_render_field_pickers', 'edit' );
101 101
 			?>
102 102
 
103 103
 		</div>
Please login to merge, or discard this patch.
includes/class-gravityview-powered-by.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 
70 70
 		$url = add_query_arg( array(
71 71
 			'utm_source' => 'powered_by',
72
-            'utm_term' => get_bloginfo('name' ),
72
+			'utm_term' => get_bloginfo('name' ),
73 73
 		), $url );
74 74
 
75 75
 		/**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 		$powered_by = gravityview()->plugin->settings->get_gravitykit_setting( 'powered_by', 0 );
34 34
 
35
-		if( empty( $powered_by ) ) {
35
+		if ( empty( $powered_by ) ) {
36 36
 			return;
37 37
 		}
38 38
 
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	protected function get_url() {
61 61
 
62
-		$url = sprintf( self::url, get_bloginfo('name' ) );
62
+		$url = sprintf( self::url, get_bloginfo( 'name' ) );
63 63
 
64 64
 		$affiliate_id = gravityview()->plugin->settings->get_gravitykit_setting( 'affiliate_id', '' );
65 65
 
66
-		if( $affiliate_id && is_numeric( $affiliate_id ) ) {
66
+		if ( $affiliate_id && is_numeric( $affiliate_id ) ) {
67 67
 			$url = add_query_arg( array( 'ref' => $affiliate_id ), $url );
68 68
 		}
69 69
 
70 70
 		$url = add_query_arg( array(
71 71
 			'utm_source' => 'powered_by',
72
-            'utm_term' => get_bloginfo('name' ),
72
+            'utm_term' => get_bloginfo( 'name' ),
73 73
 		), $url );
74 74
 
75 75
 		/**
Please login to merge, or discard this patch.
future/includes/class-gv-entry.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$args = array();
115 115
 
116
-		$view_id = is_null ( $view ) ? null : $view->ID;
116
+		$view_id = is_null( $view ) ? null : $view->ID;
117 117
 
118 118
 		$permalink = null;
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
 				$view_collection = View_Collection::from_post( $post );
128 128
 
129
-				if( 1 < $view_collection->count() ) {
130
-					$args['gvid'] = $view_id;
129
+				if ( 1 < $view_collection->count() ) {
130
+					$args[ 'gvid' ] = $view_id;
131 131
 				}
132 132
 			}
133 133
 		}
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 			 */
158 158
 			$link_parts = explode( '?', $permalink );
159 159
 
160
-			$query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : '';
160
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
161 161
 
162
-			$permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query;
162
+			$permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query;
163 163
 		} else {
164 164
 			$args[ $entry_endpoint_name ] = $entry_slug;
165 165
 		}
166 166
 
167 167
 		if ( $track_directory ) {
168
-			if ( ! empty( $_GET['pagenum'] ) ) {
169
-				$args['pagenum'] = intval( $_GET['pagenum'] );
168
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
169
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
170 170
 			}
171 171
 
172 172
 			if ( $sort = Utils::_GET( 'sort' ) ) {
173
-				$args['sort'] = $sort;
174
-				$args['dir'] = Utils::_GET( 'dir' );
173
+				$args[ 'sort' ] = $sort;
174
+				$args[ 'dir' ] = Utils::_GET( 'dir' );
175 175
 			}
176 176
 		}
177 177
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
 		$entry_slug = \GravityView_API::get_entry_slug( $this->ID, $this->as_entry() );
211 211
 
212
-		if( ! $apply_filter ) {
212
+		if ( ! $apply_filter ) {
213 213
 			return $entry_slug;
214 214
 		}
215 215
 
Please login to merge, or discard this patch.
includes/class-frontend-views.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 		}
452 452
 
453 453
 		// WooCommerce doesn't $post_id
454
-		if ( empty( $passed_post_id ) )  {
454
+		if ( empty( $passed_post_id ) ) {
455 455
 			return $passed_title;
456 456
 		}
457 457
 
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 					 */
1207 1207
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1208 1208
 
1209
-					switch( strtolower( $address_part ) ){
1209
+					switch( strtolower( $address_part ) ) {
1210 1210
 						case 'street':
1211 1211
 							$sort_field_id .= '.1';
1212 1212
 							break;
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 		 */
1297 1297
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1298 1298
 
1299
-		if ( empty( $single_entry ) ){
1299
+		if ( empty( $single_entry ) ) {
1300 1300
 			return false;
1301 1301
 		} else {
1302 1302
 			return $single_entry;
Please login to merge, or discard this patch.
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 	private function __construct() {}
86 86
 
87 87
 	private function initialize() {
88
-		add_action( 'wp', array( $this, 'parse_content'), 11 );
88
+		add_action( 'wp', array( $this, 'parse_content' ), 11 );
89 89
 		add_filter( 'render_block', array( $this, 'detect_views_in_block_content' ) );
90 90
 		add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 );
91
-		add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 );
91
+		add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 );
92 92
 
93 93
 		// Enqueue scripts and styles after GravityView_Template::register_styles()
94 94
 		add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 );
@@ -235,18 +235,18 @@  discard block
 block discarded – undo
235 235
 
236 236
 		if ( ! empty( $view_id ) ) {
237 237
 
238
-			$this->context_view_id = (int) $view_id;
238
+			$this->context_view_id = (int)$view_id;
239 239
 
240
-		} elseif ( isset( $_GET['gvid'] ) && $multiple_views ) {
240
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) {
241 241
 			/**
242 242
 			 * used on a has_multiple_views context
243 243
 			 * @see GravityView_API::entry_link
244 244
 			 */
245
-			$this->context_view_id = (int) $_GET['gvid'];
245
+			$this->context_view_id = (int)$_GET[ 'gvid' ];
246 246
 
247 247
 		} elseif ( ! $multiple_views ) {
248 248
 			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
249
-			$this->context_view_id = (int) array_pop( $array_keys );
249
+			$this->context_view_id = (int)array_pop( $array_keys );
250 250
 			unset( $array_keys );
251 251
 		}
252 252
 
@@ -279,25 +279,25 @@  discard block
 block discarded – undo
279 279
 		global $wp_rewrite;
280 280
 
281 281
 		$is_front_page = ( $query->is_home || $query->is_page );
282
-		$show_on_front = ( 'page' === get_option('show_on_front') );
283
-		$front_page_id = get_option('page_on_front');
282
+		$show_on_front = ( 'page' === get_option( 'show_on_front' ) );
283
+		$front_page_id = get_option( 'page_on_front' );
284 284
 
285
-		if (  $is_front_page && $show_on_front && $front_page_id ) {
285
+		if ( $is_front_page && $show_on_front && $front_page_id ) {
286 286
 
287 287
 			// Force to be an array, potentially a query string ( entry=16 )
288 288
 			$_query = wp_parse_args( $query->query );
289 289
 
290 290
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
291
-			if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) {
292
-				unset( $_query['pagename'] );
291
+			if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) {
292
+				unset( $_query[ 'pagename' ] );
293 293
 			}
294 294
 
295 295
 			// this is where will break from core wordpress
296 296
 			/** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */
297 297
 			$ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query );
298 298
 			$endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' );
299
-			foreach ( (array) $endpoints as $endpoint ) {
300
-				$ignore[] = $endpoint[1];
299
+			foreach ( (array)$endpoints as $endpoint ) {
300
+				$ignore[ ] = $endpoint[ 1 ];
301 301
 			}
302 302
 			unset( $endpoints );
303 303
 
@@ -307,21 +307,21 @@  discard block
 block discarded – undo
307 307
 			// - The query includes keys that are associated with registered endpoints. `entry`, for example.
308 308
 			if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) {
309 309
 
310
-				$qv =& $query->query_vars;
310
+				$qv = & $query->query_vars;
311 311
 
312 312
 				// Prevent redirect when on the single entry endpoint
313
-				if( self::is_single_entry() ) {
313
+				if ( self::is_single_entry() ) {
314 314
 					add_filter( 'redirect_canonical', '__return_false' );
315 315
 				}
316 316
 
317 317
 				$query->is_page = true;
318 318
 				$query->is_home = false;
319
-				$qv['page_id']  = $front_page_id;
319
+				$qv[ 'page_id' ]  = $front_page_id;
320 320
 
321 321
 				// Correct <!--nextpage--> for page_on_front
322
-				if ( ! empty( $qv['paged'] ) ) {
323
-					$qv['page'] = $qv['paged'];
324
-					unset( $qv['paged'] );
322
+				if ( ! empty( $qv[ 'paged' ] ) ) {
323
+					$qv[ 'page' ] = $qv[ 'paged' ];
324
+					unset( $qv[ 'paged' ] );
325 325
 				}
326 326
 			}
327 327
 
@@ -383,11 +383,11 @@  discard block
 block discarded – undo
383 383
 			$blocks = parse_blocks( $post_content );
384 384
 
385 385
 			foreach ( $blocks as $block ) {
386
-				if ( empty( $block['attrs']['ref'] ) ) {
386
+				if ( empty( $block[ 'attrs' ][ 'ref' ] ) ) {
387 387
 					continue;
388 388
 				}
389 389
 
390
-				$block_post = get_post( $block['attrs']['ref'] );
390
+				$block_post = get_post( $block[ 'attrs' ][ 'ref' ] );
391 391
 
392 392
 				if ( $block_post ) {
393 393
 					$post_content .= $block_post->post_content;
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
 		$search_method = GravityView_Widget_Search::getInstance()->get_search_method();
442 442
 
443
-		if( 'post' === $search_method ) {
443
+		if ( 'post' === $search_method ) {
444 444
 			$get = $_POST;
445 445
 		} else {
446 446
 			$get = $_GET;
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 		$gventry = gravityview()->request->is_entry();
493 493
 
494 494
 		// If this is the directory view, return.
495
-		if( ! $gventry ) {
495
+		if ( ! $gventry ) {
496 496
 			return $passed_title;
497 497
 		}
498 498
 
@@ -510,19 +510,19 @@  discard block
 block discarded – undo
510 510
 		}
511 511
 
512 512
 		// WooCommerce doesn't $post_id
513
-		if ( empty( $passed_post_id ) )  {
513
+		if ( empty( $passed_post_id ) ) {
514 514
 			return $passed_title;
515 515
 		}
516 516
 
517 517
 		// Don't modify the title for anything other than the current view/post.
518 518
 		// This is true for embedded shortcodes and Views.
519
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
519
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
520 520
 			return $passed_title;
521 521
 		}
522 522
 
523 523
 		$view = gravityview()->request->is_view();
524 524
 
525
-		if( $view ) {
525
+		if ( $view ) {
526 526
 			return $this->_get_single_entry_title( $view, $entry, $passed_title );
527 527
 		}
528 528
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 		$view_collection = \GV\View_Collection::from_post( $post );
546 546
 
547 547
 		// We have multiple Views, but no gvid...this isn't valid security
548
-		if( 1 < $view_collection->count() ) {
548
+		if ( 1 < $view_collection->count() ) {
549 549
 			return $passed_title;
550 550
 		}
551 551
 
@@ -579,18 +579,18 @@  discard block
 block discarded – undo
579 579
 		 */
580 580
 		$check_entry_display = apply_filters( 'gravityview/single/title/check_entry_display', true, $entry, $view );
581 581
 
582
-		if( $check_entry_display ) {
582
+		if ( $check_entry_display ) {
583 583
 
584 584
 			$check_display = GVCommon::check_entry_display( $entry, $view );
585 585
 
586
-			if( is_wp_error( $check_display ) ) {
586
+			if ( is_wp_error( $check_display ) ) {
587 587
 				return $passed_title;
588 588
 			}
589 589
 		}
590 590
 
591 591
 		$title = $view->settings->get( 'single_title', $passed_title );
592 592
 
593
-		$form = GVCommon::get_form( $entry['form_id'] );
593
+		$form = GVCommon::get_form( $entry[ 'form_id' ] );
594 594
 
595 595
 		// We are allowing HTML in the fields, so no escaping the output
596 596
 		$title = GravityView_API::replace_variables( $title, $form, $entry );
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 
662 662
 		$context = GravityView_View::getInstance()->getContext();
663 663
 
664
-		switch( $context ) {
664
+		switch ( $context ) {
665 665
 			case 'directory':
666 666
 				$tab = __( 'Multiple Entries', 'gk-gravityview' );
667 667
 				break;
@@ -675,12 +675,12 @@  discard block
 block discarded – undo
675 675
 		}
676 676
 
677 677
 
678
-		$title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gk-gravityview' ), $tab );
678
+		$title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gk-gravityview' ), $tab );
679 679
 		$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) );
680
-		$action_text = sprintf( esc_html__('Add fields to %s', 'gk-gravityview' ), $tab );
680
+		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gk-gravityview' ), $tab );
681 681
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gk-gravityview' );
682 682
 
683
-		$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
683
+		$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
684 684
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
685 685
 
686 686
 		echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id );
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 		$direct_access = apply_filters( 'gravityview_direct_access', true, $view->ID );
728 728
 		$embed_only = $view->settings->get( 'embed_only' );
729 729
 
730
-		if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
730
+		if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
731 731
 			return __( 'You are not allowed to view this content.', 'gk-gravityview' );
732 732
 		}
733 733
 
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 				$datetime_format = 'Y-m-d H:i:s';
775 775
 				$search_is_outside_view_bounds = false;
776 776
 
777
-				if( ! empty( $search_criteria[ $key ] ) ) {
777
+				if ( ! empty( $search_criteria[ $key ] ) ) {
778 778
 
779 779
 					$search_date = strtotime( $search_criteria[ $key ], GFCommon::get_local_timestamp() );
780 780
 
@@ -802,14 +802,14 @@  discard block
 block discarded – undo
802 802
 				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
803 803
 
804 804
 					// Then we override the search and re-set the start date
805
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
805
+					$return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true );
806 806
 				}
807 807
 			}
808 808
 		}
809 809
 
810
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
810
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
811 811
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
812
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
812
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
813 813
 				gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) );
814 814
 			}
815 815
 		}
@@ -828,19 +828,19 @@  discard block
 block discarded – undo
828 828
 	public static function process_search_only_approved( $args, $search_criteria ) {
829 829
 
830 830
 		/** @since 1.19 */
831
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
831
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
832 832
 			gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' );
833 833
 			return $search_criteria;
834 834
 		}
835 835
 
836
-		if ( ! empty( $args['show_only_approved'] ) ) {
836
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
837 837
 
838
-			$search_criteria['field_filters'][] = array(
838
+			$search_criteria[ 'field_filters' ][ ] = array(
839 839
 				'key' => GravityView_Entry_Approval::meta_key,
840 840
 				'value' => GravityView_Entry_Approval_Status::APPROVED
841 841
 			);
842 842
 
843
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
843
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
844 844
 
845 845
 			gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) );
846 846
 		}
@@ -867,18 +867,18 @@  discard block
 block discarded – undo
867 867
 	 */
868 868
 	public static function is_entry_approved( $entry, $args = array() ) {
869 869
 
870
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
870
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
871 871
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
872 872
 			return true;
873 873
 		}
874 874
 
875 875
 		/** @since 1.19 */
876
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
876
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
877 877
 			gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' );
878 878
 			return true;
879 879
 		}
880 880
 
881
-		$is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key );
881
+		$is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key );
882 882
 
883 883
 		return GravityView_Entry_Approval_Status::is_approved( $is_approved );
884 884
 	}
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 		 * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`.
903 903
 		 */
904 904
 		$criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) );
905
-		$search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() );
905
+		$search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() );
906 906
 
907 907
 		/**
908 908
 		 * @filter `gravityview_fe_search_criteria` Modify the search criteria
@@ -922,29 +922,29 @@  discard block
 block discarded – undo
922 922
 		gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' =>$search_criteria ) );
923 923
 
924 924
 		// implicity search
925
-		if ( ! empty( $args['search_value'] ) ) {
925
+		if ( ! empty( $args[ 'search_value' ] ) ) {
926 926
 
927 927
 			// Search operator options. Options: `is` or `contains`
928
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
928
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
929 929
 
930
-			$search_criteria['field_filters'][] = array(
930
+			$search_criteria[ 'field_filters' ][ ] = array(
931 931
 				'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search
932
-				'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes.
932
+				'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes.
933 933
 				'operator' => $operator,
934 934
 			);
935 935
 
936 936
 			// Lock search mode to "all" with implicit presearch filter.
937
-			$search_criteria['field_filters']['mode'] = 'all';
937
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all';
938 938
 		}
939 939
 
940
-		if( $search_criteria !== $original_search_criteria ) {
940
+		if ( $search_criteria !== $original_search_criteria ) {
941 941
 			gravityview()->log->debug( '[get_search_criteria] Search Criteria after implicity search: ', array( 'data' => $search_criteria ) );
942 942
 		}
943 943
 
944 944
 		// Handle setting date range
945 945
 		$search_criteria = self::process_search_dates( $args, $search_criteria );
946 946
 
947
-		if( $search_criteria !== $original_search_criteria ) {
947
+		if ( $search_criteria !== $original_search_criteria ) {
948 948
 			gravityview()->log->debug( '[get_search_criteria] Search Criteria after date params: ', array( 'data' => $search_criteria ) );
949 949
 		}
950 950
 
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
956 956
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
957 957
 		 */
958
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
958
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
959 959
 
960 960
 		return $search_criteria;
961 961
 	}
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 			'search_criteria' => $search_criteria,
1068 1068
 			'sorting' => self::updateViewSorting( $args, $form_id ),
1069 1069
 			'paging' => $paging,
1070
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
1070
+			'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
1071 1071
 		);
1072 1072
 
1073 1073
 		/**
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
1093 1093
 		 * @param array $args View configuration args.
1094 1094
 		 */
1095
-		$parameters = apply_filters( 'gravityview_get_entries_'.\GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id );
1095
+		$parameters = apply_filters( 'gravityview_get_entries_' . \GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id );
1096 1096
 
1097 1097
 		gravityview()->log->debug( '$parameters passed to gravityview_get_entries(): ', array( 'data' => $parameters ) );
1098 1098
 
@@ -1117,17 +1117,17 @@  discard block
 block discarded – undo
1117 1117
 		$default_page_size = apply_filters( 'gravityview_default_page_size', 25 );
1118 1118
 
1119 1119
 		// Paging & offset
1120
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size;
1120
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size;
1121 1121
 
1122 1122
 		if ( -1 === $page_size ) {
1123 1123
 			$page_size = PHP_INT_MAX;
1124 1124
 		}
1125 1125
 
1126
-		$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
1126
+		$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
1127 1127
 		$offset = ( $curr_page - 1 ) * $page_size;
1128 1128
 
1129
-		if ( ! empty( $args['offset'] ) ) {
1130
-			$offset += intval( $args['offset'] );
1129
+		if ( ! empty( $args[ 'offset' ] ) ) {
1130
+			$offset += intval( $args[ 'offset' ] );
1131 1131
 		}
1132 1132
 
1133 1133
 		$paging = array(
@@ -1152,11 +1152,11 @@  discard block
 block discarded – undo
1152 1152
 	public static function updateViewSorting( $args, $form_id ) {
1153 1153
 		$sorting = array();
1154 1154
 
1155
-		$has_values = isset( $_GET['sort'] );
1155
+		$has_values = isset( $_GET[ 'sort' ] );
1156 1156
 
1157
-		if ( $has_values && is_array( $_GET['sort'] ) ) {
1158
-			$sorts = array_keys( $_GET['sort'] );
1159
-			$dirs  = array_values( $_GET['sort'] );
1157
+		if ( $has_values && is_array( $_GET[ 'sort' ] ) ) {
1158
+			$sorts = array_keys( $_GET[ 'sort' ] );
1159
+			$dirs  = array_values( $_GET[ 'sort' ] );
1160 1160
 
1161 1161
 			if ( $has_values = array_filter( $dirs ) ) {
1162 1162
 				$sort_field_id = end( $sorts );
@@ -1165,11 +1165,11 @@  discard block
 block discarded – undo
1165 1165
 		}
1166 1166
 
1167 1167
 		if ( ! isset( $sort_field_id ) ) {
1168
-			$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' );
1168
+			$sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' );
1169 1169
 		}
1170 1170
 
1171 1171
 		if ( ! isset( $sort_direction ) ) {
1172
-			$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' );
1172
+			$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' );
1173 1173
 		}
1174 1174
 
1175 1175
 		if ( is_array( $sort_field_id ) ) {
@@ -1201,10 +1201,10 @@  discard block
 block discarded – undo
1201 1201
 				$form = GFAPI::get_form( $form_id );
1202 1202
 
1203 1203
 				// Get the first GF_Field field ID, set as the key for entry randomization
1204
-				if ( ! empty( $form['fields'] ) ) {
1204
+				if ( ! empty( $form[ 'fields' ] ) ) {
1205 1205
 
1206 1206
 					/** @var GF_Field $field */
1207
-					foreach ( $form['fields'] as $field ) {
1207
+					foreach ( $form[ 'fields' ] as $field ) {
1208 1208
 						if ( ! is_a( $field, 'GF_Field' ) ) {
1209 1209
 							continue;
1210 1210
 						}
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 		if ( is_array( $sort_field_id ) ) {
1254 1254
 			$modified_ids = array();
1255 1255
 			foreach ( $sort_field_id as $_sort_field_id ) {
1256
-				$modified_ids []= self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id );
1256
+				$modified_ids [ ] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id );
1257 1257
 			}
1258 1258
 			return $modified_ids;
1259 1259
 		}
@@ -1262,11 +1262,11 @@  discard block
 block discarded – undo
1262 1262
 
1263 1263
 		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1264 1264
 
1265
-		if( ! $sort_field ) {
1265
+		if ( ! $sort_field ) {
1266 1266
 			return $sort_field_id;
1267 1267
 		}
1268 1268
 
1269
-		switch ( $sort_field['type'] ) {
1269
+		switch ( $sort_field[ 'type' ] ) {
1270 1270
 
1271 1271
 			case 'address':
1272 1272
 				// Sorting by full address
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
 					 */
1284 1284
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1285 1285
 
1286
-					switch( strtolower( $address_part ) ){
1286
+					switch ( strtolower( $address_part ) ) {
1287 1287
 						case 'street':
1288 1288
 							$sort_field_id .= '.1';
1289 1289
 							break;
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
 		if ( ! class_exists( '\GV\Entry' ) ) {
1357 1357
 
1358 1358
 			// Not using gravityview()->log->error(), since that may not exist yet either!
1359
-			do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary()  );
1359
+			do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary() );
1360 1360
 
1361 1361
 			return null;
1362 1362
 		}
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
 		 */
1374 1374
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1375 1375
 
1376
-		if ( empty( $single_entry ) ){
1376
+		if ( empty( $single_entry ) ) {
1377 1377
 			return false;
1378 1378
 		} else {
1379 1379
 			return $single_entry;
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
 			$views = $this->getGvOutputData()->get_views();
1395 1395
 
1396 1396
 			foreach ( $views as $view_id => $data ) {
1397
-				$view = \GV\View::by_id( $data['id'] );
1397
+				$view = \GV\View::by_id( $data[ 'id' ] );
1398 1398
 				$view_id = $view->ID;
1399 1399
 				$template_id = gravityview_get_template_id( $view->ID );
1400 1400
 				$data = $view->as_data();
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
 					 * @param \GV\View The View.
1425 1425
 					 */
1426 1426
 					$js_dependency = apply_filters( 'gravityview_lightbox_script', $js_dependency, $view );
1427
-					$js_dependencies[] = $js_dependency;
1427
+					$js_dependencies[ ] = $js_dependency;
1428 1428
 
1429 1429
 					/**
1430 1430
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 					 * @param \GV\View The View.
1441 1441
 					 */
1442 1442
 					$css_dependency = apply_filters( 'gravityview_lightbox_style', $css_dependency, $view );
1443
-					$css_dependencies[] = $css_dependency;
1443
+					$css_dependencies[ ] = $css_dependency;
1444 1444
 				}
1445 1445
 
1446 1446
 				/**
@@ -1448,19 +1448,19 @@  discard block
 block discarded – undo
1448 1448
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1449 1449
 				 * @since 1.15
1450 1450
 				 */
1451
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1452
-					$css_dependencies[] = 'dashicons';
1451
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1452
+					$css_dependencies[ ] = 'dashicons';
1453 1453
 				}
1454 1454
 
1455 1455
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GV_PLUGIN_VERSION, true );
1456 1456
 
1457 1457
 				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1458 1458
 
1459
-				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GV_PLUGIN_VERSION, true );
1459
+				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GV_PLUGIN_VERSION, true );
1460 1460
 
1461 1461
 				wp_enqueue_script( 'gravityview-fe-view' );
1462 1462
 
1463
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1463
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1464 1464
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GV_PLUGIN_VERSION, 'all' );
1465 1465
 				}
1466 1466
 
@@ -1523,7 +1523,7 @@  discard block
 block discarded – undo
1523 1523
 	public static function add_style( $template_id ) {
1524 1524
 
1525 1525
 		if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) {
1526
-			gravityview()->log->debug(  'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) );
1526
+			gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) );
1527 1527
 			wp_enqueue_style( 'gravityview_style_' . $template_id );
1528 1528
 		} elseif ( empty( $template_id ) ) {
1529 1529
 			gravityview()->log->error( 'Cannot add template style; template_id is empty' );
@@ -1554,11 +1554,11 @@  discard block
 block discarded – undo
1554 1554
 		 * Not a table-based template; don't add sort icons
1555 1555
 		 * @since 1.12
1556 1556
 		 */
1557
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1557
+		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1558 1558
 			return $label;
1559 1559
 		}
1560 1560
 
1561
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1561
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1562 1562
 			return $label;
1563 1563
 		}
1564 1564
 
@@ -1566,29 +1566,29 @@  discard block
 block discarded – undo
1566 1566
 
1567 1567
 		$class = 'gv-sort';
1568 1568
 
1569
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1569
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1570 1570
 
1571 1571
 		$sort_args = array(
1572
-			'sort' => $field['id'],
1572
+			'sort' => $field[ 'id' ],
1573 1573
 			'dir' => 'asc',
1574 1574
 		);
1575 1575
 
1576
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1576
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1577 1577
 			//toggle sorting direction.
1578
-			if ( 'asc' === $sorting['direction'] ) {
1579
-				$sort_args['dir'] = 'desc';
1578
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1579
+				$sort_args[ 'dir' ] = 'desc';
1580 1580
 				$class .= ' gv-icon-sort-desc';
1581 1581
 			} else {
1582
-				$sort_args['dir'] = 'asc';
1582
+				$sort_args[ 'dir' ] = 'asc';
1583 1583
 				$class .= ' gv-icon-sort-asc';
1584 1584
 			}
1585 1585
 		} else {
1586 1586
 			$class .= ' gv-icon-caret-up-down';
1587 1587
 		}
1588 1588
 
1589
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1589
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
1590 1590
 
1591
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1591
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $label;
1592 1592
 
1593 1593
 	}
1594 1594
 
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
 
1607 1607
 		$field_type = $field_id;
1608 1608
 
1609
-		if( is_numeric( $field_id ) ) {
1609
+		if ( is_numeric( $field_id ) ) {
1610 1610
 			$field = GFFormsModel::get_field( $form, $field_id );
1611 1611
 			$field_type = $field ? $field->type : $field_id;
1612 1612
 		}
@@ -1635,7 +1635,7 @@  discard block
 block discarded – undo
1635 1635
 			return false;
1636 1636
 		}
1637 1637
 
1638
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1638
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1639 1639
 
1640 1640
 	}
1641 1641
 
Please login to merge, or discard this patch.
includes/class-gravityview-entry-list.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 	public function get_output() {
191 191
 
192 192
 		// No Entries
193
-		if( empty( $this->entries ) ) {
194
-			return '<div class="gv-no-results">'.$this->empty_message.'</div>';
193
+		if ( empty( $this->entries ) ) {
194
+			return '<div class="gv-no-results">' . $this->empty_message . '</div>';
195 195
 		}
196 196
 
197 197
 		$output = '';
@@ -202,22 +202,22 @@  discard block
 block discarded – undo
202 202
 			$current_entry = GravityView_View::getInstance()->getCurrentEntry();
203 203
 		}
204 204
 
205
-		$output .= '<'. $this->wrapper_tag .'>';
205
+		$output .= '<' . $this->wrapper_tag . '>';
206 206
 
207
-		foreach( $this->entries as $entry ) {
207
+		foreach ( $this->entries as $entry ) {
208 208
 
209 209
 			if ( $entry instanceof \GV\Entry ) {
210 210
 				$entry = $entry->as_entry();
211 211
 			}
212 212
 
213
-			if( $this->skip_entry( $entry, $current_entry ) ) {
213
+			if ( $this->skip_entry( $entry, $current_entry ) ) {
214 214
 				continue;
215 215
 			}
216 216
 
217 217
 			$output .= $this->get_item_output( $entry );
218 218
 		}
219 219
 
220
-		$output .= '</'. $this->wrapper_tag .'>';
220
+		$output .= '</' . $this->wrapper_tag . '>';
221 221
 
222 222
 		/**
223 223
 		 * @filter `gravityview/widget/recent-entries/output` Modify the HTML of the Recent Entries widget output
@@ -240,15 +240,15 @@  discard block
 block discarded – undo
240 240
 	private function skip_entry( $entry, $current_entry ) {
241 241
 
242 242
 		// If skip entry is off, or there's no current entry, return false
243
-		if( empty( $this->skip_current_entry ) || empty( $current_entry ) ) {
243
+		if ( empty( $this->skip_current_entry ) || empty( $current_entry ) ) {
244 244
 			return false;
245 245
 		}
246 246
 
247 247
 		// If in Single or Edit mode, $current_entry will be an array.
248
-		$current_entry_id = is_array( $current_entry ) ? $current_entry['id'] : $current_entry;
248
+		$current_entry_id = is_array( $current_entry ) ? $current_entry[ 'id' ] : $current_entry;
249 249
 
250 250
 		// If the entry ID matches the current entry, yes: skip
251
-		if( $entry['id'] === $current_entry_id ) {
251
+		if ( $entry[ 'id' ] === $current_entry_id ) {
252 252
 			return true;
253 253
 		}
254 254
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
 		$item_output = gravityview_get_link( $link, $this->link_format );
285 285
 
286
-		if( !empty( $this->after_link ) ) {
286
+		if ( ! empty( $this->after_link ) ) {
287 287
 
288 288
 			/**
289 289
 			 * @filter `gravityview/entry-list/after-link` Modify the content displayed after the entry link in an entry list
@@ -292,14 +292,14 @@  discard block
 block discarded – undo
292 292
 			 * @param array $entry Gravity Forms entry array
293 293
 			 * @param GravityView_Entry_List $this The current class instance
294 294
 			 */
295
-			$after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this );
295
+			$after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>' . $this->after_link . '</div>', $entry, $this );
296 296
 
297 297
 			$item_output .= $after_link;
298 298
 		}
299 299
 
300 300
 		$item_output = GravityView_API::replace_variables( $item_output, $this->form, $entry );
301 301
 
302
-		$item_output = '<'. $this->item_tag .'>'. $item_output .'</'. $this->item_tag .'>';
302
+		$item_output = '<' . $this->item_tag . '>' . $item_output . '</' . $this->item_tag . '>';
303 303
 
304 304
 		/**
305 305
 		 * @filter `gravityview/entry-list/item` Modify each item's output in an entry list
Please login to merge, or discard this patch.
includes/presets/default-table/class-gravityview-default-template-table.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,15 +88,15 @@
 block discarded – undo
88 88
 	 */
89 89
 	public function maybe_modify_button_label( $label = '', $atts = array() ) {
90 90
 
91
-		if( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) {
91
+		if ( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) {
92 92
 			return $label;
93 93
 		}
94 94
 
95
-		if( 'field' !== \GV\Utils::get( $atts, 'type' ) ) {
95
+		if ( 'field' !== \GV\Utils::get( $atts, 'type' ) ) {
96 96
 			return $label;
97 97
 		}
98 98
 
99
-		if( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) {
99
+		if ( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) {
100 100
 			return $label;
101 101
 		}
102 102
 
Please login to merge, or discard this patch.