Completed
Pull Request — master (#651)
by Zack
04:36
created
includes/widgets/search-widget/templates/search-field-link.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
 $base_url = GravityView_Widget_Search::get_search_form_action();
14 14
 
15 15
 // Make sure that there are choices to display
16
-if ( empty( $search_field['choices'] ) ) {
16
+if ( empty( $search_field[ 'choices' ] ) ) {
17 17
 	do_action( 'gravityview_log_debug', 'search-field-link.php - No choices for field' );
18 18
 	return;
19 19
 }
20 20
 
21
-$links_label = empty( $search_field['label'] ) ? __( 'Show only:', 'gravityview' ) : $search_field['label'];
21
+$links_label = empty( $search_field[ 'label' ] ) ? __( 'Show only:', 'gravityview' ) : $search_field[ 'label' ];
22 22
 
23 23
 /**
24 24
  * @filter `gravityview/extension/search/links_sep` Change the label for the "Link" search bar input type
@@ -42,24 +42,24 @@  discard block
 block discarded – undo
42 42
 
43 43
         <?php
44 44
 
45
-        $search_value = rgget( $search_field['name'] );
45
+        $search_value = rgget( $search_field[ 'name' ] );
46 46
 
47
-        foreach ( $search_field['choices'] as $k => $choice ) {
47
+        foreach ( $search_field[ 'choices' ] as $k => $choice ) {
48 48
 
49 49
             if ( 0 != $k ) {
50 50
                 echo esc_html( $links_sep );
51 51
             }
52 52
 
53
-            $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false;
53
+            $active = ( '' !== $search_value && in_array( $search_value, array( $choice[ 'text' ], $choice[ 'value' ] ) ) ) ? ' class="active"' : false;
54 54
 
55 55
             if ( $active ) {
56
-                $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url );
56
+                $link = remove_query_arg( array( 'pagenum', $search_field[ 'name' ] ), $base_url );
57 57
             } else {
58
-                $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) );
58
+                $link = add_query_arg( array( $search_field[ 'name' ] => urlencode( $choice[ 'value' ] ) ), remove_query_arg( array( 'pagenum' ), $base_url ) );
59 59
             }
60 60
             ?>
61 61
 
62
-			<a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice['text'] ); ?></a>
62
+			<a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice[ 'text' ] ); ?></a>
63 63
 
64 64
 		<?php } ?>
65 65
 	</p>
Please login to merge, or discard this patch.
includes/class-admin-approve-entries.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
 		/** gf_entries page - entries table screen */
35 35
 
36 36
 		// capture bulk actions
37
-		add_action( 'init', array( $this, 'process_bulk_action') );
37
+		add_action( 'init', array( $this, 'process_bulk_action' ) );
38 38
 		// add hidden field with approve status
39 39
 		add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
40 40
 		// process ajax approve entry requests
41
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
41
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
42 42
 
43 43
 		// when using the User opt-in field, check on entry submission
44 44
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
45 45
 
46 46
 		// in case entry is edited (on admin or frontend)
47
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
47
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
48 48
 
49 49
 
50 50
 		add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
51 51
 
52 52
 		// adding styles and scripts
53
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
53
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
54 54
 		// bypass Gravity Forms no-conflict mode
55 55
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
56 56
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	function tooltips( $tooltips ) {
67 67
 
68
-		$tooltips['form_gravityview_fields'] = array(
69
-			'title' => __('GravityView Fields', 'gravityview'),
70
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
68
+		$tooltips[ 'form_gravityview_fields' ] = array(
69
+			'title' => __( 'GravityView Fields', 'gravityview' ),
70
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
71 71
 		);
72 72
 
73 73
 		return $tooltips;
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
 		}
183 183
 
184 184
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
185
-		if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) {
185
+		if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
186 186
 
187 187
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
188 188
 
189 189
 			// The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form.
190
-			$bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2'];
190
+			$bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ];
191 191
 
192 192
 			/**
193 193
 			 * The extra '-' is to make sure that there are at *least* two items in array.
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 			}
204 204
 
205 205
 			// All entries are set to be updated, not just the visible ones
206
-			if ( ! empty( $_POST['all_entries'] ) ) {
206
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
207 207
 
208 208
 				// Convert the current entry search into GF-formatted search criteria
209 209
 				$search = array(
210
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
211
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
212
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
210
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
211
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
212
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
213 213
 				);
214 214
 
215 215
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
 			} else {
221 221
 
222
-				$entries = $_POST['lead'];
222
+				$entries = $_POST[ 'lead' ];
223 223
 
224 224
 			}
225 225
 
@@ -260,12 +260,12 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	private static function update_bulk( $entries, $approved, $form_id ) {
262 262
 
263
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
263
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
264 264
 			do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries );
265 265
 			return false;
266 266
 		}
267 267
 
268
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
268
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
269 269
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
270 270
 			return false;
271 271
 		}
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		// calculate approved field id
276 276
 		$approved_column_id = self::get_approved_column( $form_id );
277 277
 
278
-		foreach( $entries as $entry_id ) {
278
+		foreach ( $entries as $entry_id ) {
279 279
 			self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
280 280
 		}
281 281
 	}
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
 	 * @param int $approvedcolumn (default: 0)
295 295
 	 * @return boolean True: It worked; False: it failed
296 296
 	 */
297
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
297
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
298 298
 
299
-		if( !class_exists( 'GFAPI' ) ) {
299
+		if ( ! class_exists( 'GFAPI' ) ) {
300 300
 			do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' );
301 301
 			return false;
302 302
 		}
303 303
 
304
-		if( empty( $approvedcolumn ) ) {
304
+		if ( empty( $approvedcolumn ) ) {
305 305
 			$approvedcolumn = self::get_approved_column( $form_id );
306 306
 		}
307 307
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 		self::update_approved_meta( $entry_id, $approved );
321 321
 
322 322
 		// add note to entry
323
-		if( $result === true ) {
323
+		if ( $result === true ) {
324 324
 
325 325
 			$note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' );
326 326
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 			 */
332 332
 			$add_note = apply_filters( 'gravityview/approve_entries/add-note', true );
333 333
 
334
-			if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
334
+			if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
335 335
 				$current_user = wp_get_current_user();
336 336
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
337 337
 			}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 			 */
344 344
 			do_action( 'gravityview_clear_form_cache', $form_id );
345 345
 
346
-		} else if( is_wp_error( $result ) ) {
346
+		} else if ( is_wp_error( $result ) ) {
347 347
 
348 348
 			do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) );
349 349
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 * @param $form array Gravity Forms form object
365 365
 	 */
366 366
 	public function after_submission( $entry, $form ) {
367
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
367
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
368 368
 	}
369 369
 
370 370
 
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
 	 */
381 381
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
382 382
 
383
-		$approvedcolumn = self::get_approved_column( $form['id'] );
383
+		$approvedcolumn = self::get_approved_column( $form[ 'id' ] );
384 384
 
385 385
         /**
386 386
          * If the form doesn't contain the approve field, don't assume anything.
387 387
          */
388
-        if( empty( $approvedcolumn ) ) {
388
+        if ( empty( $approvedcolumn ) ) {
389 389
             return;
390 390
         }
391 391
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 		$is_approved = empty( $is_approved ) ? 0 : 'Approved';
414 414
 
415 415
 		// update entry meta
416
-		if( function_exists('gform_update_meta') ) {
416
+		if ( function_exists( 'gform_update_meta' ) ) {
417 417
 
418 418
 			gform_update_meta( $entry_id, 'is_approved', $is_approved );
419 419
 
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 			 */
426 426
 			do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved );
427 427
 
428
-			if( empty( $is_approved ) ) {
428
+			if ( empty( $is_approved ) ) {
429 429
 
430 430
 				/**
431 431
 				 * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 
448 448
 		} else {
449 449
 
450
-			do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
450
+			do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
451 451
 
452 452
 		}
453 453
 	}
@@ -459,21 +459,21 @@  discard block
 block discarded – undo
459 459
 	 */
460 460
 	public function ajax_update_approved() {
461 461
 
462
-		if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) {
462
+		if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) {
463 463
 
464 464
 			do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST );
465 465
 
466 466
 			$result = false;
467 467
 		}
468 468
 
469
-		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
469
+		else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) {
470 470
 
471 471
 			do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST );
472 472
 
473 473
 			$result = false;
474 474
 		}
475 475
 
476
-		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
476
+		else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) {
477 477
 
478 478
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
479 479
 
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
 
483 483
 		else {
484 484
 
485
-			$result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] );
485
+			$result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] );
486 486
 
487
-			if( is_wp_error( $result ) ) {
487
+			if ( is_wp_error( $result ) ) {
488 488
 				/** @var WP_Error $result */
489
-				do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() );
489
+				do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() );
490 490
 				$result = false;
491 491
 			}
492 492
 
@@ -506,29 +506,29 @@  discard block
 block discarded – undo
506 506
 	 */
507 507
 	static public function get_approved_column( $form ) {
508 508
 
509
-        if( empty( $form ) ) {
509
+        if ( empty( $form ) ) {
510 510
             return null;
511 511
         }
512 512
 
513
-        if( !is_array( $form ) ) {
513
+        if ( ! is_array( $form ) ) {
514 514
             $form = GVCommon::get_form( $form );
515 515
         }
516 516
 
517
-		foreach( $form['fields'] as $key => $field ) {
517
+		foreach ( $form[ 'fields' ] as $key => $field ) {
518 518
 
519
-            $field = (array) $field;
519
+            $field = (array)$field;
520 520
 
521
-			if( !empty( $field['gravityview_approved'] ) ) {
522
-				if( !empty($field['inputs'][0]['id']) ) {
523
-					return $field['inputs'][0]['id'];
521
+			if ( ! empty( $field[ 'gravityview_approved' ] ) ) {
522
+				if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) {
523
+					return $field[ 'inputs' ][ 0 ][ 'id' ];
524 524
 				}
525 525
 			}
526 526
 
527 527
             // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
528
-            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
529
-                foreach ( $field['inputs'] as $key2 => $input ) {
530
-                    if ( strtolower( $input['label'] ) == 'approved' ) {
531
-                        return $input['id'];
528
+            if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) {
529
+                foreach ( $field[ 'inputs' ] as $key2 => $input ) {
530
+                    if ( strtolower( $input[ 'label' ] ) == 'approved' ) {
531
+                        return $input[ 'id' ];
532 532
                     }
533 533
                 }
534 534
             }
@@ -539,18 +539,18 @@  discard block
 block discarded – undo
539 539
 
540 540
 
541 541
 
542
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
542
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
543 543
 
544
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
544
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
545 545
 			return;
546 546
 		}
547 547
 
548
-		if( empty( $entry['id'] ) ) {
548
+		if ( empty( $entry[ 'id' ] ) ) {
549 549
 			return;
550 550
 		}
551 551
 
552
-		if( gform_get_meta( $entry['id'], 'is_approved' ) ) {
553
-			echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />';
552
+		if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
553
+			echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />';
554 554
 		}
555 555
 	}
556 556
 
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 
560 560
 	function add_scripts_and_styles( $hook ) {
561 561
 
562
-		if( !class_exists( 'RGForms' ) ) {
562
+		if ( ! class_exists( 'RGForms' ) ) {
563 563
 
564 564
 			do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' );
565 565
 
@@ -568,39 +568,39 @@  discard block
 block discarded – undo
568 568
 
569 569
 		// enqueue styles & scripts gf_entries
570 570
 		// But only if we're on the main Entries page, not on reports pages
571
-		if( RGForms::get_page() === 'entry_list' ) {
571
+		if ( RGForms::get_page() === 'entry_list' ) {
572 572
 
573
-			$form_id = RGForms::get('id');
573
+			$form_id = RGForms::get( 'id' );
574 574
 
575 575
 			// If there are no forms identified, use the first form. That's how GF does it.
576
-			if( empty( $form_id ) && class_exists('RGFormsModel') ) {
576
+			if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
577 577
 				$forms = gravityview_get_forms();
578
-				if( !empty( $forms ) ) {
579
-					$form_id = $forms[0]['id'];
578
+				if ( ! empty( $forms ) ) {
579
+					$form_id = $forms[ 0 ][ 'id' ];
580 580
 				}
581 581
 			}
582 582
 
583 583
 			$approvedcolumn = self::get_approved_column( $form_id );
584 584
 
585
-			wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
585
+			wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
586 586
 			wp_enqueue_style( 'gravityview_entries_list' );
587 587
 
588
-			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
588
+			$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
589 589
 
590
-			wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
590
+			wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
591 591
 			wp_enqueue_script( 'gravityview_gf_entries_scripts' );
592 592
 
593 593
 			wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
594
-				'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'),
594
+				'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ),
595 595
 				'form_id' => $form_id,
596 596
 				'show_column' => (int)$this->show_approve_entry_column( $form_id ),
597 597
 				'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
598 598
 				'bulk_actions' => $this->get_bulk_actions( $form_id ),
599 599
 				'bulk_message' => $this->bulk_update_message,
600
-				'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'),
601
-				'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'),
602
-				'column_title' => __( 'Show entry in directory view?', 'gravityview'),
603
-				'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ),
600
+				'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ),
601
+				'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ),
602
+				'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
603
+				'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ),
604 604
 			) );
605 605
 
606 606
 		}
@@ -643,8 +643,8 @@  discard block
 block discarded – undo
643 643
 		// Sanitize the values, just to be sure.
644 644
 		foreach ( $bulk_actions as $key => $group ) {
645 645
 			foreach ( $group as $i => $action ) {
646
-				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
647
-				$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
646
+				$bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] );
647
+				$bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] );
648 648
 			}
649 649
 		}
650 650
 
@@ -669,13 +669,13 @@  discard block
 block discarded – undo
669 669
 		 * @since 1.7.2
670 670
 		 * @param boolean $hide_if_no_connections
671 671
 		 */
672
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
672
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
673 673
 
674
-		if( $hide_if_no_connections ) {
674
+		if ( $hide_if_no_connections ) {
675 675
 
676 676
 			$connected_views = gravityview_get_connected_views( $form_id );
677 677
 
678
-			if( empty( $connected_views ) ) {
678
+			if ( empty( $connected_views ) ) {
679 679
 				$show_approve_column = false;
680 680
 			}
681 681
 		}
@@ -685,18 +685,18 @@  discard block
 block discarded – undo
685 685
 		 * @param boolean $show_approve_column Whether the column will be shown
686 686
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
687 687
 		 */
688
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
688
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
689 689
 
690 690
 		return $show_approve_column;
691 691
 	}
692 692
 
693 693
 	function register_gform_noconflict_script( $scripts ) {
694
-		$scripts[] = 'gravityview_gf_entries_scripts';
694
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
695 695
 		return $scripts;
696 696
 	}
697 697
 
698 698
 	function register_gform_noconflict_style( $styles ) {
699
-		$styles[] = 'gravityview_entries_list';
699
+		$styles[ ] = 'gravityview_entries_list';
700 700
 		return $styles;
701 701
 	}
702 702
 
Please login to merge, or discard this patch.
includes/class-gravityview-entry-notes.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		// Make sure the keys are all set
68 68
 		$note = wp_parse_args( $note, $default_note );
69 69
 
70
-		GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) );
70
+		GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) );
71 71
 
72 72
 		// If last_error is empty string, there was no error.
73
-		if( empty( $wpdb->last_error ) ) {
73
+		if ( empty( $wpdb->last_error ) ) {
74 74
 			$return = $wpdb->insert_id;
75 75
 		} else {
76 76
 			$return = new WP_Error( 'gravityview-add-note', $wpdb->last_error );
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public static function delete_notes( $note_ids = array() ) {
98 98
 
99
-		if( !is_array( $note_ids ) ) {
99
+		if ( ! is_array( $note_ids ) ) {
100 100
 
101 101
 			do_action( 'gravityview_log_error', __METHOD__ . ' - Note IDs not an array. Not processing delete request.', $note_ids );
102 102
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			)
152 152
 		);
153 153
 
154
-		return $results ? $results[0] : false;
154
+		return $results ? $results[ 0 ] : false;
155 155
 	}
156 156
 
157 157
 	/**
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	public static function filter_avatar( $avatar = '', $note ) {
166 166
 
167
-		if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
168
-			$avatar =  sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
167
+		if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
168
+			$avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
169 169
 		}
170 170
 
171 171
 		return $avatar;
Please login to merge, or discard this patch.
includes/extensions/entry-notes/partials/note-add-note.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@
 block discarded – undo
21 21
 		{email_fields}
22 22
 
23 23
 		<div class="gv-note-content-container">
24
-			<label for="gv-note-content-{entry_slug}" class="screen-reader-text"><?php echo GravityView_Field_Notes::strings('content-label'); ?></label>
24
+			<label for="gv-note-content-{entry_slug}" class="screen-reader-text"><?php echo GravityView_Field_Notes::strings( 'content-label' ); ?></label>
25 25
 			<textarea name="gv-note-content" id="gv-note-content-{entry_slug}"></textarea>
26 26
 		</div>
27 27
 
28
-		<button type="submit" class="button gv-add-note-submit"><?php echo GravityView_Field_Notes::strings('add-note'); ?></button>
28
+		<button type="submit" class="button gv-add-note-submit"><?php echo GravityView_Field_Notes::strings( 'add-note' ); ?></button>
29 29
 	</div>
30 30
 </form>
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-gravityview-roles-capabilities.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public static function get_instance() {
35 35
 
36
-		if( ! self::$instance ) {
36
+		if ( ! self::$instance ) {
37 37
 			self::$instance = new self;
38 38
 		}
39 39
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) );
57 57
 		add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 );
58 58
 		add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 );
59
-        add_action( 'admin_init', array( $this, 'add_caps') );
59
+        add_action( 'admin_init', array( $this, 'add_caps' ) );
60 60
 	}
61 61
 
62 62
 
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
 	public function filter_user_has_cap( $usercaps = array(), $caps = array(), $args = array(), $user = NULL ) {
78 78
 
79 79
 		// Empty caps_to_check array
80
-		if( ! $usercaps || ! $caps ) {
80
+		if ( ! $usercaps || ! $caps ) {
81 81
 			return $usercaps;
82 82
 		}
83 83
 
84 84
 		/**
85 85
 		 * Enable all GravityView caps_to_check if `gravityview_full_access` is enabled
86 86
 		 */
87
-		if( ! empty( $usercaps['gravityview_full_access'] ) ) {
87
+		if ( ! empty( $usercaps[ 'gravityview_full_access' ] ) ) {
88 88
 
89 89
 			$all_gravityview_caps = self::all_caps();
90 90
 
91
-			foreach( $all_gravityview_caps as $gv_cap ) {
91
+			foreach ( $all_gravityview_caps as $gv_cap ) {
92 92
 				$usercaps[ $gv_cap ] = true;
93 93
 			}
94 94
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		$all = $administrator;
307 307
 
308 308
 		// If role is set, return caps_to_check for just that role.
309
-		if( $single_role ) {
309
+		if ( $single_role ) {
310 310
 			$caps = isset( ${$single_role} ) ? ${$single_role} : false;
311 311
 			return $flat_array ? $caps : array( $single_role => $caps );
312 312
 		}
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public static function has_cap( $caps_to_check = '', $object_id = null, $user_id = null ) {
336 336
 
337
-		if( ! is_user_logged_in() || empty( $caps_to_check ) ) {
337
+		if ( ! is_user_logged_in() || empty( $caps_to_check ) ) {
338 338
 			return false;
339 339
 		}
340 340
 
@@ -344,13 +344,13 @@  discard block
 block discarded – undo
344 344
 		$caps_to_check = self::maybe_add_full_access_caps( $caps_to_check );
345 345
 
346 346
 		foreach ( $caps_to_check as $cap ) {
347
-			if( ! is_null( $object_id ) ) {
347
+			if ( ! is_null( $object_id ) ) {
348 348
 				$has_cap = $user_id ? user_can( $user_id, $cap, $object_id ) : current_user_can( $cap, $object_id );
349 349
 			} else {
350 350
 				$has_cap = $user_id ? user_can( $user_id, $cap ) : current_user_can( $cap );
351 351
 			}
352 352
 			// At the first successful response, stop checking
353
-			if( $has_cap ) {
353
+			if ( $has_cap ) {
354 354
 				break;
355 355
 			}
356 356
 		}
@@ -374,15 +374,15 @@  discard block
 block discarded – undo
374 374
 		$all_gravityview_caps = self::all_caps();
375 375
 
376 376
 		// Are there any $caps_to_check that are from GravityView?
377
-		if( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
378
-			$caps_to_check[] = 'gravityview_full_access';
377
+		if ( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
378
+			$caps_to_check[ ] = 'gravityview_full_access';
379 379
 		}
380 380
 
381 381
 		$all_gravity_forms_caps = class_exists( 'GFCommon' ) ? GFCommon::all_caps() : array();
382 382
 
383 383
 		// Are there any $caps_to_check that are from Gravity Forms?
384
-		if( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
385
-			$caps_to_check[] = 'gform_full_access';
384
+		if ( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
385
+			$caps_to_check[ ] = 'gform_full_access';
386 386
 		}
387 387
 
388 388
 		return array_unique( $caps_to_check );
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 			$capabilities = self::all_caps();
405 405
 
406 406
 			// Loop through each role and remove GV caps_to_check
407
-			foreach( $wp_roles->get_names() as $role_slug => $role_name ) {
407
+			foreach ( $wp_roles->get_names() as $role_slug => $role_name ) {
408 408
 				foreach ( $capabilities as $cap ) {
409 409
 					$wp_roles->remove_cap( $role_slug, $cap );
410 410
 				}
Please login to merge, or discard this patch.
includes/admin/field-types/type_html.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 	 * @return string
22 22
 	 */
23 23
 	function get_field_desc() {
24
-		return !empty( $this->field['desc'] ) ? $this->field['desc'] : '';
24
+		return ! empty( $this->field[ 'desc' ] ) ? $this->field[ 'desc' ] : '';
25 25
 	}
26 26
 
27 27
 }
Please login to merge, or discard this patch.
includes/admin/field-types/type_checkboxes.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	}
23 23
 
24 24
 	function render_input( $override_input = null ) {
25
-		if( isset( $override_input ) ) {
25
+		if ( isset( $override_input ) ) {
26 26
 			echo $override_input;
27 27
 			return;
28 28
 		}
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 		?>
31 31
 		<ul class="gv-setting-list">
32 32
 		<?php
33
-		foreach( $this->field['options'] as $value => $label ) { ?>
34
-			<li <?php if( isset( $label['requires'] ) ) { printf( 'class="gv-sub-setting" data-requires="%s"', $label['requires'] ); } ?>>
33
+		foreach ( $this->field[ 'options' ] as $value => $label ) { ?>
34
+			<li <?php if ( isset( $label[ 'requires' ] ) ) { printf( 'class="gv-sub-setting" data-requires="%s"', $label[ 'requires' ] ); } ?>>
35 35
 				<label>
36 36
 				<input name="<?php printf( '%s[%s]', esc_attr( $this->name ), esc_attr( $value ) ); ?>" type="hidden"
37 37
 				       value="0"/>
38 38
 				<input name="<?php printf( '%s[%s]', esc_attr( $this->name ), esc_attr( $value ) ); ?>"
39 39
 				       id="<?php echo $this->get_field_id(); ?>" type="checkbox"
40 40
 				       value="1" <?php checked( ! empty( $this->value[ $value ] ) ); ?> />
41
-				<?php echo esc_html( $label['label'] ); ?>
41
+				<?php echo esc_html( $label[ 'label' ] ); ?>
42 42
 				</label>
43
-				<?php if( ! empty( $label['desc'] ) ) {
44
-					printf( '<span class="howto">%s</span>', $label['desc'] );
43
+				<?php if ( ! empty( $label[ 'desc' ] ) ) {
44
+					printf( '<span class="howto">%s</span>', $label[ 'desc' ] );
45 45
 				}
46 46
 				?>
47 47
 			</li>
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 = GravityView_Entry_Notes::get_notes( $entry['id'] );
28
+$notes = 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/entry-notes/class-gravityview-field-notes.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -63,18 +63,18 @@  discard block
 block discarded – undo
63 63
 
64 64
 		add_shortcode( 'gv_note_add', array( 'GravityView_Field_Notes', 'get_add_note_part' ) );
65 65
 
66
-		add_action( 'wp', array( $this, 'maybe_delete_notes'), 1000 );
67
-		add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes') );
68
-		add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes') );
66
+		add_action( 'wp', array( $this, 'maybe_delete_notes' ), 1000 );
67
+		add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes' ) );
68
+		add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes' ) );
69 69
 
70
-		add_action( 'wp', array( $this, 'maybe_add_note'), 1000 );
71
-		add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note') );
72
-		add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note') );
70
+		add_action( 'wp', array( $this, 'maybe_add_note' ), 1000 );
71
+		add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note' ) );
72
+		add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note' ) );
73 73
 
74 74
 		// add template path to check for field
75 75
 		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
76 76
 
77
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
77
+		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
78 78
 		add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) );
79 79
 	}
80 80
 
@@ -100,23 +100,23 @@  discard block
 block discarded – undo
100 100
 	public function enqueue_scripts() {
101 101
 		global $wp_actions;
102 102
 
103
-		if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
103
+		if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
104 104
 			wp_enqueue_style( 'gravityview-notes' );
105 105
 			wp_enqueue_script( 'gravityview-notes' );
106 106
 		}
107 107
 
108
-		if( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
108
+		if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
109 109
 
110 110
 			$strings = self::strings();
111 111
 
112 112
 			wp_localize_script( 'gravityview-notes', 'GVNotes', array(
113 113
 				'ajaxurl' => admin_url( 'admin-ajax.php' ),
114 114
 				'text' => array(
115
-					'processing' => $strings['processing'],
116
-					'delete_confirm' => $strings['delete-confirm'],
117
-					'note_added' => $strings['added-note'],
118
-					'error_invalid' => $strings['error-invalid'],
119
-					'error_empty_note' => $strings['error-empty-note'],
115
+					'processing' => $strings[ 'processing' ],
116
+					'delete_confirm' => $strings[ 'delete-confirm' ],
117
+					'note_added' => $strings[ 'added-note' ],
118
+					'error_invalid' => $strings[ 'error-invalid' ],
119
+					'error_empty_note' => $strings[ 'error-empty-note' ],
120 120
 				),
121 121
 			) );
122 122
 		}
@@ -133,22 +133,22 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	function maybe_add_note() {
135 135
 
136
-		if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
136
+		if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
137 137
 			do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' );
138 138
 			return;
139 139
 		}
140 140
 
141
-		if( 'gv_note_add' === rgpost('action') ) {
141
+		if ( 'gv_note_add' === rgpost( 'action' ) ) {
142 142
 
143 143
 			$post = wp_unslash( $_POST );
144 144
 
145
-			if( $this->doing_ajax ) {
146
-				parse_str( $post['data'], $data );
145
+			if ( $this->doing_ajax ) {
146
+				parse_str( $post[ 'data' ], $data );
147 147
 			} else {
148 148
 				$data = $post;
149 149
 			}
150 150
 
151
-			$this->process_add_note( (array) $data );
151
+			$this->process_add_note( (array)$data );
152 152
 		}
153 153
 	}
154 154
 
@@ -175,23 +175,23 @@  discard block
 block discarded – undo
175 175
 		$error = false;
176 176
 		$success = false;
177 177
 
178
-		if( empty( $data['entry-slug'] ) ) {
178
+		if ( empty( $data[ 'entry-slug' ] ) ) {
179 179
 
180
-			$error = self::strings('error-invalid');
180
+			$error = self::strings( 'error-invalid' );
181 181
 			do_action( 'gravityview_log_error', __METHOD__ . ': The note is missing an Entry ID.' );
182 182
 
183 183
 		} else {
184 184
 
185
-			$valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] );
185
+			$valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] );
186 186
 			
187 187
 			$has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' );
188 188
 
189
-			if( ! $has_cap ) {
189
+			if ( ! $has_cap ) {
190 190
 				$error = self::strings( 'error-cap-add' );
191 191
 				do_action( 'gravityview_log_error', __METHOD__ . ': Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' );
192 192
 			} elseif ( $valid ) {
193 193
 
194
-				$entry = gravityview_get_entry( $data['entry-slug'], true, false );
194
+				$entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false );
195 195
 
196 196
 				$added = $this->add_note( $entry, $data );
197 197
 
@@ -209,22 +209,22 @@  discard block
 block discarded – undo
209 209
 					$this->maybe_send_entry_notes( $note, $entry, $data );
210 210
 
211 211
 					if ( $note ) {
212
-						$success = self::display_note( $note, ! empty( $data['show-delete'] ) );
213
-						do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact('note', 'data') );
212
+						$success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) );
213
+						do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact( 'note', 'data' ) );
214 214
 					} else {
215
-						$error = self::strings('error-add-note');
216
-						do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact('note', 'data') );
215
+						$error = self::strings( 'error-add-note' );
216
+						do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact( 'note', 'data' ) );
217 217
 					}
218 218
 				}
219 219
 			} else {
220
-				$error = self::strings('error-invalid');
220
+				$error = self::strings( 'error-invalid' );
221 221
 				do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed; the note was not created' );
222 222
 			}
223 223
 		}
224 224
 
225 225
 
226
-		if( $this->doing_ajax ) {
227
-			if( $success ) {
226
+		if ( $this->doing_ajax ) {
227
+			if ( $success ) {
228 228
 				wp_send_json_success( array( 'html' => $success ) );
229 229
 			} else {
230 230
 				$error = $error ? $error : self::strings( 'error-invalid' );
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 			return;
251 251
 		}
252 252
 
253
-		if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) {
253
+		if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) {
254 254
 
255 255
 			$post = wp_unslash( $_POST );
256 256
 			if ( $this->doing_ajax ) {
257
-				parse_str( $post['data'], $data );
257
+				parse_str( $post[ 'data' ], $data );
258 258
 			} else {
259 259
 				$data = $post;
260 260
 			}
@@ -285,18 +285,18 @@  discard block
 block discarded – undo
285 285
 	 */
286 286
 	function process_delete_notes( $data ) {
287 287
 
288
-		$valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] );
288
+		$valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] );
289 289
 		$has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' );
290 290
 		$success = false;
291 291
 
292 292
 		if ( $valid && $has_cap ) {
293
-			GravityView_Entry_Notes::delete_notes( $data['note'] );
293
+			GravityView_Entry_Notes::delete_notes( $data[ 'note' ] );
294 294
 			$success = true;
295 295
 		}
296 296
 
297
-		if( $this->doing_ajax ) {
297
+		if ( $this->doing_ajax ) {
298 298
 
299
-			if( $success ) {
299
+			if ( $success ) {
300 300
 				wp_send_json_success();
301 301
 			} else {
302 302
 				if ( ! $valid ) {
@@ -329,13 +329,13 @@  discard block
 block discarded – undo
329 329
 
330 330
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
331 331
 
332
-		unset( $field_options['show_as_link'] );
332
+		unset( $field_options[ 'show_as_link' ] );
333 333
 
334 334
 		$notes_options = array(
335 335
 			'notes' => array(
336 336
 				'type' => 'checkboxes',
337
-				'label' => __('Note Settings', 'gravityview'),
338
-				'desc' => sprintf( _x('Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ),
337
+				'label' => __( 'Note Settings', 'gravityview' ),
338
+				'desc' => sprintf( _x( 'Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ),
339 339
 				'options' => array(
340 340
 					'view' => array(
341 341
 						'label' => __( 'Display notes?', 'gravityview' ),
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 			'processing' => __( 'Processing&hellip;', 'gravityview' ),
388 388
 			'other-email' => __( 'Other email address', 'gravityview' ),
389 389
 			'email-label' => __( 'Email address', 'gravityview' ),
390
-			'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'),
390
+			'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ),
391 391
 			'subject-label' => __( 'Subject', 'gravityview' ),
392 392
 			'subject' => __( 'Email subject', 'gravityview' ),
393 393
 			'default-email-subject' => __( 'New entry note', 'gravityview' ),
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 		 */
407 407
 		$strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' );
408 408
 
409
-		if( $key ) {
409
+		if ( $key ) {
410 410
 			return isset( $strings[ $key ] ) ? $strings[ $key ] : '';
411 411
 		}
412 412
 
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	static public function display_note( $note, $show_delete = false ) {
427 427
 
428
-		if( ! is_object( $note ) ) {
428
+		if ( ! is_object( $note ) ) {
429 429
 			return '';
430 430
 		}
431 431
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 		$note_row = ob_get_clean();
467 467
 
468 468
 		$replacements = array(
469
-			'{note_id}' => $note_content['note_id'],
469
+			'{note_id}' => $note_content[ 'note_id' ],
470 470
 			'{row_class}' => 'gv-note',
471 471
 			'{note_detail}' => $note_detail_html
472 472
 		);
@@ -498,13 +498,13 @@  discard block
 block discarded – undo
498 498
 
499 499
 		$user_data = get_userdata( $current_user->ID );
500 500
 
501
-		$note_content = trim( $data['gv-note-content'] );
501
+		$note_content = trim( $data[ 'gv-note-content' ] );
502 502
 
503
-		if( empty( $note_content ) ) {
503
+		if ( empty( $note_content ) ) {
504 504
 			return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) );
505 505
 		}
506 506
 
507
-		$return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
507
+		$return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
508 508
 
509 509
 		return $return;
510 510
 	}
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 */
521 521
 	public static function get_add_note_part() {
522 522
 
523
-		if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
523
+		if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
524 524
 			do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to add entry notes ("gravityview_add_entry_notes").' );
525 525
 			return '';
526 526
 		}
@@ -533,19 +533,19 @@  discard block
 block discarded – undo
533 533
 
534 534
 		$visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' );
535 535
 		$entry = $gravityview_view->getCurrentEntry();
536
-		$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
536
+		$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
537 537
 		$nonce_field = wp_nonce_field( 'gv_note_add_' . $entry_slug, 'gv_note_add', false, false );
538 538
 
539 539
 		// Only generate the dropdown if the field settings allow it
540 540
 		$email_fields = '';
541
-		if( ! empty( $visibility_settings['email'] ) ) {
541
+		if ( ! empty( $visibility_settings[ 'email' ] ) ) {
542 542
 			$email_fields = self::get_note_email_fields( $entry_slug );
543 543
 		}
544 544
 
545 545
 		$add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html );
546 546
 		$add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html );
547
-		$add_note_html = str_replace( '{show_delete}', intval( $visibility_settings['delete'] ), $add_note_html );
548
-		$add_note_html   = str_replace( '{email_fields}', $email_fields, $add_note_html );
547
+		$add_note_html = str_replace( '{show_delete}', intval( $visibility_settings[ 'delete' ] ), $add_note_html );
548
+		$add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html );
549 549
 
550 550
 		return $add_note_html;
551 551
 	}
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
 		$note_emails = array();
570 570
 
571 571
 		foreach ( $email_fields as $email_field ) {
572
-			if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) {
573
-				$note_emails[] = $entry["{$email_field->id}"];
572
+			if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) {
573
+				$note_emails[ ] = $entry[ "{$email_field->id}" ];
574 574
 			}
575 575
 		}
576 576
 
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 		 */
583 583
 		$note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry );
584 584
 
585
-		return (array) $note_emails;
585
+		return (array)$note_emails;
586 586
 	}
587 587
 
588 588
 	/**
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 	 */
599 599
 	private static function get_note_email_fields( $entry_slug = '' ) {
600 600
 
601
-		if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
601
+		if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
602 602
 			do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to email entry notes ("gravityview_email_entry_notes").' );
603 603
 			return '';
604 604
 		}
@@ -620,27 +620,27 @@  discard block
 block discarded – undo
620 620
 
621 621
 		if ( ! empty( $note_emails ) || $include_custom ) { ?>
622 622
 			<div class="gv-note-email-container">
623
-				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email'];  ?></label>
623
+				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label>
624 624
 				<select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>">
625
-					<option value=""><?php echo $strings['also-email'];  ?></option>
625
+					<option value=""><?php echo $strings[ 'also-email' ]; ?></option>
626 626
 					<?php foreach ( $note_emails as  $email ) {
627 627
 						?>
628 628
 						<option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option>
629 629
 					<?php }
630
-					if( $include_custom ) { ?>
631
-					<option value="custom"><?php echo self::strings('other-email'); ?></option>
630
+					if ( $include_custom ) { ?>
631
+					<option value="custom"><?php echo self::strings( 'other-email' ); ?></option>
632 632
 					<?php } ?>
633 633
 				</select>
634 634
 				<fieldset class="gv-note-to-container">
635
-					<?php if( $include_custom ) { ?>
635
+					<?php if ( $include_custom ) { ?>
636 636
 					<div class='gv-note-to-custom-container'>
637
-						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label>
638
-						<input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings['email-placeholder']; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" />
637
+						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label>
638
+						<input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings[ 'email-placeholder' ]; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" />
639 639
 					</div>
640 640
 					<?php } ?>
641 641
 		            <div class='gv-note-subject-container'>
642
-		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label>
643
-		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
642
+		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label>
643
+		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
644 644
 		            </div>
645 645
 				</fieldset>
646 646
 			</div>
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 */
664 664
 	private function maybe_send_entry_notes( $note = false, $entry, $data ) {
665 665
 
666
-		if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) {
666
+		if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
667 667
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User doesnt have "gravityview_email_entry_notes" cap, or $note is empty', $note );
668 668
 			return;
669 669
 		}
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		do_action( 'gravityview_log_debug', __METHOD__ . ': $data', $data );
672 672
 
673 673
 		//emailing notes if configured
674
-		if ( ! empty( $data['gv-note-to'] ) ) {
674
+		if ( ! empty( $data[ 'gv-note-to' ] ) ) {
675 675
 
676 676
 			$default_data = array(
677 677
 				'gv-note-to' => '',
@@ -680,11 +680,11 @@  discard block
 block discarded – undo
680 680
 				'gv-note-content' => '',
681 681
 			);
682 682
 
683
-			$current_user  = wp_get_current_user();
683
+			$current_user = wp_get_current_user();
684 684
 			$email_data = wp_parse_args( $data, $default_data );
685 685
 
686
-			$from    = $current_user->user_email;
687
-			$to = $email_data['gv-note-to'];
686
+			$from = $current_user->user_email;
687
+			$to = $email_data[ 'gv-note-to' ];
688 688
 
689 689
 			/**
690 690
 			 * Documented in get_note_email_fields
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
 			 */
693 693
 			$include_custom = apply_filters( 'gravityview/field/notes/custom-email', true );
694 694
 
695
-			if( 'custom' === $to && $include_custom ) {
696
-				$to = $email_data['gv-note-to-custom'];
695
+			if ( 'custom' === $to && $include_custom ) {
696
+				$to = $email_data[ 'gv-note-to-custom' ];
697 697
 				do_action( 'gravityview_log_debug', __METHOD__ . ': Sending note to a custom email address: ' . $to );
698 698
 			}
699 699
 
@@ -704,12 +704,12 @@  discard block
 block discarded – undo
704 704
 
705 705
 			$bcc = false;
706 706
 			$reply_to = $from;
707
-			$subject = trim( $email_data['gv-note-subject'] );
707
+			$subject = trim( $email_data[ 'gv-note-subject' ] );
708 708
 
709 709
 			// We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF
710 710
 			$subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject;
711
-			$message = $email_data['gv-note-content'];
712
-			$from_name     = $current_user->display_name;
711
+			$message = $email_data[ 'gv-note-content' ];
712
+			$from_name = $current_user->display_name;
713 713
 			$message_format = 'html';
714 714
 
715 715
 			/**
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 
725 725
 			GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false );
726 726
 
727
-			$form  = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array();
727
+			$form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array();
728 728
 
729 729
 			/**
730 730
 			 * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms
Please login to merge, or discard this patch.