Completed
Push — develop ( 31cdb7...45dab0 )
by Zack
06:18
created
includes/class-admin-approve-entries.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
 		/** gf_entries page - entries table screen */
44 44
 
45 45
 		// capture bulk actions
46
-		add_action( 'gform_loaded', array( $this, 'process_bulk_action') );
46
+		add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) );
47 47
 
48 48
 		// add hidden field with approve status
49 49
 		add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
50 50
 
51 51
 		// process ajax approve entry requests
52
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
52
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
53 53
 
54 54
 		// when using the User opt-in field, check on entry submission
55 55
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
56 56
 
57 57
 		// in case entry is edited (on admin or frontend)
58
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
58
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
59 59
 
60 60
 
61 61
 		add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
62 62
 
63 63
 		// adding styles and scripts
64
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
64
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
65 65
 		// bypass Gravity Forms no-conflict mode
66 66
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
67 67
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		 * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them.
91 91
 		 * @param array $form GF Form object of current form
92 92
 		 */
93
-		if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
93
+		if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
94 94
 			return $filter_links;
95 95
 		}
96 96
 
@@ -111,19 +111,19 @@  discard block
 block discarded – undo
111 111
 		$approved_count = $disapproved_count = 0;
112 112
 
113 113
 		// Only count if necessary
114
-		if( $include_counts ) {
115
-			$approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
116
-			$disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
114
+		if ( $include_counts ) {
115
+			$approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
116
+			$disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
117 117
 		}
118 118
 
119
-		$filter_links[] = array(
119
+		$filter_links[ ] = array(
120 120
 			'id'            => 'gv_approved',
121 121
 			'field_filters' => $field_filters_approved,
122 122
 			'count'         => $approved_count,
123 123
 			'label'         => esc_html__( 'Approved', 'gravityview' ),
124 124
 		);
125 125
 
126
-		$filter_links[] = array(
126
+		$filter_links[ ] = array(
127 127
 			'id'            => 'gv_disapproved',
128 128
 			'field_filters' => $field_filters_disapproved,
129 129
 			'count'         => $disapproved_count,
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	function tooltips( $tooltips ) {
144 144
 
145
-		$tooltips['form_gravityview_fields'] = array(
146
-			'title' => __('GravityView Fields', 'gravityview'),
147
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
145
+		$tooltips[ 'form_gravityview_fields' ] = array(
146
+			'title' => __( 'GravityView Fields', 'gravityview' ),
147
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
148 148
 		);
149 149
 
150 150
 		return $tooltips;
@@ -255,15 +255,15 @@  discard block
 block discarded – undo
255 255
 
256 256
 		$gv_bulk_action = false;
257 257
 
258
-		if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
259
-			$bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2');
258
+		if ( version_compare( GFForms::$version, '2.0', '>=' ) ) {
259
+			$bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' );
260 260
 		} else {
261 261
 			// GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
262
-			$bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2');
262
+			$bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' );
263 263
 		}
264 264
 
265 265
 		// Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
266
-		if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
266
+		if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) {
267 267
 			$gv_bulk_action = $bulk_action;
268 268
 		}
269 269
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		
289 289
 		// gforms_entry_list is the nonce that confirms we're on the right page
290 290
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
291
-		if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) {
291
+		if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
292 292
 
293 293
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
294 294
 
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
 			}
307 307
 
308 308
 			// All entries are set to be updated, not just the visible ones
309
-			if ( ! empty( $_POST['all_entries'] ) ) {
309
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
310 310
 
311 311
 				// Convert the current entry search into GF-formatted search criteria
312 312
 				$search = array(
313
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
314
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
315
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
313
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
314
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
315
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
316 316
 				);
317 317
 
318 318
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 			} else {
324 324
 
325 325
 				// Changed from 'lead' to 'entry' in 2.0
326
-				$entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
326
+				$entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ];
327 327
 
328 328
 			}
329 329
 
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
 			$entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
336 336
 
337 337
 			switch ( $approved_status ) {
338
-				case $this->bulk_action_prefixes['approve']:
338
+				case $this->bulk_action_prefixes[ 'approve' ]:
339 339
 					self::update_bulk( $entries, 1, $form_id );
340 340
 					$this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
341 341
 					break;
342 342
 
343
-				case $this->bulk_action_prefixes['unapprove']:
343
+				case $this->bulk_action_prefixes[ 'unapprove' ]:
344 344
 					self::update_bulk( $entries, 0, $form_id );
345 345
 					$this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
346 346
 					break;
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	private static function update_bulk( $entries, $approved, $form_id ) {
366 366
 
367
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
367
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
368 368
 			do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries );
369 369
 			return false;
370 370
 		}
371 371
 
372
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
372
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
373 373
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
374 374
 			return false;
375 375
 		}
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 		// calculate approved field id once instead of looping through in the update_approved() method
380 380
 		$approved_column_id = self::get_approved_column( $form_id );
381 381
 
382
-		foreach( $entries as $entry_id ) {
382
+		foreach ( $entries as $entry_id ) {
383 383
 			self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
384 384
 		}
385 385
 	}
@@ -398,14 +398,14 @@  discard block
 block discarded – undo
398 398
 	 * @param int $approvedcolumn (default: 0)
399 399
 	 * @return boolean True: It worked; False: it failed
400 400
 	 */
401
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
401
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
402 402
 
403
-		if( !class_exists( 'GFAPI' ) ) {
403
+		if ( ! class_exists( 'GFAPI' ) ) {
404 404
 			do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' );
405 405
 			return false;
406 406
 		}
407 407
 
408
-		if( empty( $approvedcolumn ) ) {
408
+		if ( empty( $approvedcolumn ) ) {
409 409
 			$approvedcolumn = self::get_approved_column( $form_id );
410 410
 		}
411 411
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		self::update_approved_meta( $entry_id, $approved, $form_id );
425 425
 
426 426
 		// add note to entry
427
-		if( $result === true ) {
427
+		if ( $result === true ) {
428 428
 
429 429
 			$note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' );
430 430
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 			 */
436 436
 			$add_note = apply_filters( 'gravityview/approve_entries/add-note', true );
437 437
 
438
-			if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
438
+			if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
439 439
 				$current_user = wp_get_current_user();
440 440
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
441 441
 			}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			 */
448 448
 			do_action( 'gravityview_clear_form_cache', $form_id );
449 449
 
450
-		} else if( is_wp_error( $result ) ) {
450
+		} else if ( is_wp_error( $result ) ) {
451 451
 
452 452
 			do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) );
453 453
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	 * @param $form array Gravity Forms form object
469 469
 	 */
470 470
 	public function after_submission( $entry, $form ) {
471
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
471
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
472 472
 	}
473 473
 
474 474
 
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
 	 */
485 485
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
486 486
 
487
-		$approvedcolumn = self::get_approved_column( $form['id'] );
487
+		$approvedcolumn = self::get_approved_column( $form[ 'id' ] );
488 488
 
489 489
         /**
490 490
          * If the form doesn't contain the approve field, don't assume anything.
491 491
          */
492
-        if( empty( $approvedcolumn ) ) {
492
+        if ( empty( $approvedcolumn ) ) {
493 493
             return;
494 494
         }
495 495
 
496 496
 		$entry = GFAPI::get_entry( $entry_id );
497 497
 
498
-		self::update_approved_meta( $entry_id, $entry[ (string)$approvedcolumn ], $form['id'] );
498
+		self::update_approved_meta( $entry_id, $entry[ (string)$approvedcolumn ], $form[ 'id' ] );
499 499
 
500 500
 	}
501 501
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		$is_approved = empty( $is_approved ) ? 0 : 'Approved';
521 521
 
522 522
 		// update entry meta
523
-		if( function_exists('gform_update_meta') ) {
523
+		if ( function_exists( 'gform_update_meta' ) ) {
524 524
 
525 525
 			gform_update_meta( $entry_id, 'is_approved', $is_approved, $form_id );
526 526
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 			 */
533 533
 			do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved );
534 534
 
535
-			if( empty( $is_approved ) ) {
535
+			if ( empty( $is_approved ) ) {
536 536
 
537 537
 				/**
538 538
 				 * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 
555 555
 		} else {
556 556
 
557
-			do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
557
+			do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
558 558
 
559 559
 		}
560 560
 	}
@@ -566,21 +566,21 @@  discard block
 block discarded – undo
566 566
 	 */
567 567
 	public function ajax_update_approved() {
568 568
 
569
-		if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) {
569
+		if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) {
570 570
 
571 571
 			do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST );
572 572
 
573 573
 			$result = false;
574 574
 		}
575 575
 
576
-		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
576
+		else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) {
577 577
 
578 578
 			do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST );
579 579
 
580 580
 			$result = false;
581 581
 		}
582 582
 
583
-		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
583
+		else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) {
584 584
 
585 585
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
586 586
 
@@ -589,11 +589,11 @@  discard block
 block discarded – undo
589 589
 
590 590
 		else {
591 591
 
592
-			$result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] );
592
+			$result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] );
593 593
 
594
-			if( is_wp_error( $result ) ) {
594
+			if ( is_wp_error( $result ) ) {
595 595
 				/** @var WP_Error $result */
596
-				do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() );
596
+				do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() );
597 597
 				$result = false;
598 598
 			}
599 599
 
@@ -613,29 +613,29 @@  discard block
 block discarded – undo
613 613
 	 */
614 614
 	static public function get_approved_column( $form ) {
615 615
 
616
-        if( empty( $form ) ) {
616
+        if ( empty( $form ) ) {
617 617
             return null;
618 618
         }
619 619
 
620
-        if( !is_array( $form ) ) {
620
+        if ( ! is_array( $form ) ) {
621 621
             $form = GVCommon::get_form( $form );
622 622
         }
623 623
 
624
-		foreach( $form['fields'] as $key => $field ) {
624
+		foreach ( $form[ 'fields' ] as $key => $field ) {
625 625
 
626
-            $field = (array) $field;
626
+            $field = (array)$field;
627 627
 
628
-			if( !empty( $field['gravityview_approved'] ) ) {
629
-				if( !empty($field['inputs'][0]['id']) ) {
630
-					return $field['inputs'][0]['id'];
628
+			if ( ! empty( $field[ 'gravityview_approved' ] ) ) {
629
+				if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) {
630
+					return $field[ 'inputs' ][ 0 ][ 'id' ];
631 631
 				}
632 632
 			}
633 633
 
634 634
             // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
635
-            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
636
-                foreach ( $field['inputs'] as $key2 => $input ) {
637
-                    if ( strtolower( $input['label'] ) == 'approved' ) {
638
-                        return $input['id'];
635
+            if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) {
636
+                foreach ( $field[ 'inputs' ] as $key2 => $input ) {
637
+                    if ( strtolower( $input[ 'label' ] ) == 'approved' ) {
638
+                        return $input[ 'id' ];
639 639
                     }
640 640
                 }
641 641
             }
@@ -657,18 +657,18 @@  discard block
 block discarded – undo
657 657
 	 *
658 658
 	 * @return void
659 659
 	 */
660
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
660
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
661 661
 
662
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
662
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
663 663
 			return;
664 664
 		}
665 665
 
666
-		if( empty( $entry['id'] ) ) {
666
+		if ( empty( $entry[ 'id' ] ) ) {
667 667
 			return;
668 668
 		}
669 669
 
670
-		if( gform_get_meta( $entry['id'], 'is_approved' ) ) {
671
-			echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />';
670
+		if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
671
+			echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />';
672 672
 		}
673 673
 	}
674 674
 
@@ -681,10 +681,10 @@  discard block
 block discarded – undo
681 681
 	 */
682 682
 	private function get_form_id() {
683 683
 
684
-		$form_id = GFForms::get('id');
684
+		$form_id = GFForms::get( 'id' );
685 685
 
686 686
 		// If there are no forms identified, use the first form. That's how GF does it.
687
-		if( empty( $form_id ) && class_exists('RGFormsModel') ) {
687
+		if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
688 688
 			$form_id = $this->get_first_form_id();
689 689
 		}
690 690
 
@@ -704,14 +704,14 @@  discard block
 block discarded – undo
704 704
 
705 705
 		$forms = RGFormsModel::get_forms( null, 'title' );
706 706
 
707
-		if( ! isset( $forms[0] ) ) {
707
+		if ( ! isset( $forms[ 0 ] ) ) {
708 708
 			do_action( 'gravityview_log_error', __METHOD__ . ': No forms were found' );
709 709
 			return 0;
710 710
 		}
711 711
 
712
-		$first_form = $forms[0];
712
+		$first_form = $forms[ 0 ];
713 713
 
714
-		$form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id'];
714
+		$form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ];
715 715
 
716 716
 		return intval( $form_id );
717 717
 	}
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 
720 720
 	function add_scripts_and_styles( $hook ) {
721 721
 
722
-		if( ! class_exists( 'RGForms' ) ) {
722
+		if ( ! class_exists( 'RGForms' ) ) {
723 723
 
724 724
 			do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' );
725 725
 
@@ -728,34 +728,34 @@  discard block
 block discarded – undo
728 728
 
729 729
 		// enqueue styles & scripts gf_entries
730 730
 		// But only if we're on the main Entries page, not on reports pages
731
-		if( GFForms::get_page() !== 'entry_list' ) {
731
+		if ( GFForms::get_page() !== 'entry_list' ) {
732 732
 			return;
733 733
 		}
734 734
 
735 735
 		$form_id = $this->get_form_id();
736 736
 
737 737
 		// Things are broken; no forms were found
738
-		if( empty( $form_id ) ) {
738
+		if ( empty( $form_id ) ) {
739 739
 			return;
740 740
 		}
741 741
 
742
-		wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
742
+		wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
743 743
 
744
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
744
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
745 745
 
746
-		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
746
+		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
747 747
 
748 748
 		wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
749
-			'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'),
749
+			'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ),
750 750
 			'form_id' => $form_id,
751 751
 			'show_column' => (int)$this->show_approve_entry_column( $form_id ),
752 752
 			'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
753 753
 			'bulk_actions' => $this->get_bulk_actions( $form_id ),
754 754
 			'bulk_message' => $this->bulk_update_message,
755
-			'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'),
756
-			'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'),
757
-			'column_title' => __( 'Show entry in directory view?', 'gravityview'),
758
-			'column_link' => esc_url( add_query_arg( array('sort' => self::get_approved_column( $form_id ) ) ) ),
755
+			'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ),
756
+			'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ),
757
+			'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
758
+			'column_link' => esc_url( add_query_arg( array( 'sort' => self::get_approved_column( $form_id ) ) ) ),
759 759
 		) );
760 760
 
761 761
 	}
@@ -775,11 +775,11 @@  discard block
 block discarded – undo
775 775
 			'GravityView' => array(
776 776
 				array(
777 777
 					'label' => __( 'Approve', 'gravityview' ),
778
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ),
778
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ),
779 779
 				),
780 780
 				array(
781 781
 					'label' => __( 'Disapprove', 'gravityview' ),
782
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ),
782
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ),
783 783
 				),
784 784
 			),
785 785
 		);
@@ -796,8 +796,8 @@  discard block
 block discarded – undo
796 796
 		// Sanitize the values, just to be sure.
797 797
 		foreach ( $bulk_actions as $key => $group ) {
798 798
 			foreach ( $group as $i => $action ) {
799
-				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
800
-				$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
799
+				$bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] );
800
+				$bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] );
801 801
 			}
802 802
 		}
803 803
 
@@ -822,13 +822,13 @@  discard block
 block discarded – undo
822 822
 		 * @since 1.7.2
823 823
 		 * @param boolean $hide_if_no_connections
824 824
 		 */
825
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
825
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
826 826
 
827
-		if( $hide_if_no_connections ) {
827
+		if ( $hide_if_no_connections ) {
828 828
 
829 829
 			$connected_views = gravityview_get_connected_views( $form_id );
830 830
 
831
-			if( empty( $connected_views ) ) {
831
+			if ( empty( $connected_views ) ) {
832 832
 				$show_approve_column = false;
833 833
 			}
834 834
 		}
@@ -838,18 +838,18 @@  discard block
 block discarded – undo
838 838
 		 * @param boolean $show_approve_column Whether the column will be shown
839 839
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
840 840
 		 */
841
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
841
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
842 842
 
843 843
 		return $show_approve_column;
844 844
 	}
845 845
 
846 846
 	function register_gform_noconflict_script( $scripts ) {
847
-		$scripts[] = 'gravityview_gf_entries_scripts';
847
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
848 848
 		return $scripts;
849 849
 	}
850 850
 
851 851
 	function register_gform_noconflict_style( $styles ) {
852
-		$styles[] = 'gravityview_entries_list';
852
+		$styles[ ] = 'gravityview_entries_list';
853 853
 		return $styles;
854 854
 	}
855 855
 
Please login to merge, or discard this patch.