Completed
Pull Request — develop (#843)
by Zack
05:39
created
includes/class-admin-approve-entries.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @uses  GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request.
267 267
 	 * @access public
268
-	 * @return void|boolean
268
+	 * @return false|null
269 269
 	 */
270 270
 	public function process_bulk_action() {
271 271
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column
363 363
      * @see GravityView_Entry_Approval::get_approved_column
364 364
      *
365
-	 * @param mixed $form GF Form or Form ID
365
+	 * @param integer $form GF Form or Form ID
366 366
 	 * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set.
367 367
 	 */
368 368
 	static public function get_approved_column( $form ) {
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
 	/**
347 347
 	 * update_approved function.
348 348
 	 *
349
-     * @since 1.18 Moved to GravityView_Entry_Approval::update_approved
349
+	 * @since 1.18 Moved to GravityView_Entry_Approval::update_approved
350 350
 	 * @see GravityView_Entry_Approval::update_approved
351
-     *
351
+	 *
352 352
 	 * @param int $entry_id (default: 0)
353 353
 	 * @param int $approved (default: 0)
354 354
 	 * @param int $form_id (default: 0)
355 355
 	 * @param int $approvedcolumn (default: 0)
356
-     *
356
+	 *
357 357
 	 * @return boolean True: It worked; False: it failed
358 358
 	 */
359 359
 	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
 	/**
364 364
 	 * Calculate the approve field.input id
365 365
 	 *
366
-     * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column
367
-     * @see GravityView_Entry_Approval::get_approved_column
368
-     *
366
+	 * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column
367
+	 * @see GravityView_Entry_Approval::get_approved_column
368
+	 *
369 369
 	 * @param mixed $form GF Form or Form ID
370 370
 	 * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set.
371 371
 	 */
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 			'bulk_actions' => $this->get_bulk_actions( $form_id ),
488 488
 			'bulk_message' => $this->bulk_update_message,
489 489
 			'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'),
490
-            'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'),
490
+			'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'),
491 491
 			'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'),
492 492
 			'column_title' => __( 'Show entry in directory view?', 'gravityview'),
493 493
 			'column_link' => esc_url( $this->get_sort_link( $form_id ) ),
@@ -496,11 +496,11 @@  discard block
 block discarded – undo
496 496
 	}
497 497
 
498 498
 	/**
499
-     * Generate a link to sort by approval status (if there is an Approve/Disapprove field)
500
-     *
501
-     * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as
502
-     * numeric, but it does group the approved entries together.
503
-     *
499
+	 * Generate a link to sort by approval status (if there is an Approve/Disapprove field)
500
+	 *
501
+	 * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as
502
+	 * numeric, but it does group the approved entries together.
503
+	 *
504 504
 	 * @param int $form_id
505 505
 	 *
506 506
 	 * @return string Sorting link
@@ -510,20 +510,20 @@  discard block
 block discarded – undo
510 510
 		$approved_column_id = self::get_approved_column( $form_id );
511 511
 
512 512
 		if( ! $approved_column_id ) {
513
-		    return '';
514
-        }
513
+			return '';
514
+		}
515 515
 
516
-	    $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc';
516
+		$order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc';
517 517
 
518
-	    $args = array(
519
-		    'orderby' => $approved_column_id,
520
-            'order' => $order,
521
-        );
518
+		$args = array(
519
+			'orderby' => $approved_column_id,
520
+			'order' => $order,
521
+		);
522 522
 
523
-	    $link = add_query_arg( $args );
523
+		$link = add_query_arg( $args );
524 524
 
525 525
 		return $link;
526
-    }
526
+	}
527 527
 
528 528
 	/**
529 529
 	 * Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" option group
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		/** gf_entries page - entries table screen */
45 45
 
46 46
 		// capture bulk actions
47
-		add_action( 'gform_loaded', array( $this, 'process_bulk_action') );
47
+		add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) );
48 48
 
49 49
 		// add hidden field with approve status
50 50
 		add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
53 53
 
54 54
 		// adding styles and scripts
55
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
55
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
56 56
 		// bypass Gravity Forms no-conflict mode
57 57
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
58 58
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		 * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them.
82 82
 		 * @param array $form GF Form object of current form
83 83
 		 */
84
-		if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
84
+		if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
85 85
 			return $filter_links;
86 86
 		}
87 87
 
@@ -102,19 +102,19 @@  discard block
 block discarded – undo
102 102
 		$approved_count = $disapproved_count = 0;
103 103
 
104 104
 		// Only count if necessary
105
-		if( $include_counts ) {
106
-			$approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
107
-			$disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
105
+		if ( $include_counts ) {
106
+			$approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
107
+			$disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
108 108
 		}
109 109
 
110
-		$filter_links[] = array(
110
+		$filter_links[ ] = array(
111 111
 			'id'            => 'gv_approved',
112 112
 			'field_filters' => $field_filters_approved,
113 113
 			'count'         => $approved_count,
114 114
 			'label'         => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ),
115 115
 		);
116 116
 
117
-		$filter_links[] = array(
117
+		$filter_links[ ] = array(
118 118
 			'id'            => 'gv_disapproved',
119 119
 			'field_filters' => $field_filters_disapproved,
120 120
 			'count'         => $disapproved_count,
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	function tooltips( $tooltips ) {
135 135
 
136
-		$tooltips['form_gravityview_fields'] = array(
137
-			'title' => __('GravityView Fields', 'gravityview'),
138
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
136
+		$tooltips[ 'form_gravityview_fields' ] = array(
137
+			'title' => __( 'GravityView Fields', 'gravityview' ),
138
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
139 139
 		);
140 140
 
141 141
 		return $tooltips;
@@ -246,15 +246,15 @@  discard block
 block discarded – undo
246 246
 
247 247
 		$gv_bulk_action = false;
248 248
 
249
-		if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
250
-			$bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2');
249
+		if ( version_compare( GFForms::$version, '2.0', '>=' ) ) {
250
+			$bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' );
251 251
 		} else {
252 252
 			// GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
253
-			$bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2');
253
+			$bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' );
254 254
 		}
255 255
 
256 256
 		// Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
257
-		if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
257
+		if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) {
258 258
 			$gv_bulk_action = $bulk_action;
259 259
 		}
260 260
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		
280 280
 		// gforms_entry_list is the nonce that confirms we're on the right page
281 281
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
282
-		if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) {
282
+		if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
283 283
 
284 284
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
285 285
 
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
 			}
298 298
 
299 299
 			// All entries are set to be updated, not just the visible ones
300
-			if ( ! empty( $_POST['all_entries'] ) ) {
300
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
301 301
 
302 302
 				// Convert the current entry search into GF-formatted search criteria
303 303
 				$search = array(
304
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
305
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
306
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
304
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
305
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
306
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
307 307
 				);
308 308
 
309 309
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 			} else {
315 315
 
316 316
 				// Changed from 'lead' to 'entry' in 2.0
317
-				$entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
317
+				$entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ];
318 318
 
319 319
 			}
320 320
 
@@ -326,15 +326,15 @@  discard block
 block discarded – undo
326 326
 			$entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
327 327
 
328 328
 			switch ( $approved_status ) {
329
-				case $this->bulk_action_prefixes['approve']:
329
+				case $this->bulk_action_prefixes[ 'approve' ]:
330 330
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id );
331 331
 					$this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
332 332
 					break;
333
-				case $this->bulk_action_prefixes['unapprove']:
333
+				case $this->bulk_action_prefixes[ 'unapprove' ]:
334 334
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id );
335 335
 					$this->bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count );
336 336
 					break;
337
-				case $this->bulk_action_prefixes['disapprove']:
337
+				case $this->bulk_action_prefixes[ 'disapprove' ]:
338 338
 					GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id );
339 339
 					$this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
340 340
 					break;
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
      *
357 357
 	 * @return boolean True: It worked; False: it failed
358 358
 	 */
359
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
359
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
360 360
 		return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn );
361 361
 	}
362 362
 
@@ -386,20 +386,20 @@  discard block
 block discarded – undo
386 386
 	 *
387 387
 	 * @return void
388 388
 	 */
389
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
389
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
390 390
 
391
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
391
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
392 392
 			return;
393 393
 		}
394 394
 
395
-		if( empty( $entry['id'] ) ) {
395
+		if ( empty( $entry[ 'id' ] ) ) {
396 396
 			return;
397 397
 		}
398 398
 
399 399
 		$status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' );
400 400
 
401
-		if( $status_value ) {
402
-			echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />';
401
+		if ( $status_value ) {
402
+			echo '<input type="hidden" class="entry_approval" id="entry_approved_' . $entry[ 'id' ] . '" value="' . esc_attr( $status_value ) . '" />';
403 403
 		}
404 404
 	}
405 405
 
@@ -412,10 +412,10 @@  discard block
 block discarded – undo
412 412
 	 */
413 413
 	private function get_form_id() {
414 414
 
415
-		$form_id = GFForms::get('id');
415
+		$form_id = GFForms::get( 'id' );
416 416
 
417 417
 		// If there are no forms identified, use the first form. That's how GF does it.
418
-		if( empty( $form_id ) && class_exists('RGFormsModel') ) {
418
+		if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
419 419
 			$form_id = $this->get_first_form_id();
420 420
 		}
421 421
 
@@ -435,14 +435,14 @@  discard block
 block discarded – undo
435 435
 
436 436
 		$forms = RGFormsModel::get_forms( null, 'title' );
437 437
 
438
-		if( ! isset( $forms[0] ) ) {
438
+		if ( ! isset( $forms[ 0 ] ) ) {
439 439
 			do_action( 'gravityview_log_error', __METHOD__ . ': No forms were found' );
440 440
 			return 0;
441 441
 		}
442 442
 
443
-		$first_form = $forms[0];
443
+		$first_form = $forms[ 0 ];
444 444
 
445
-		$form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id'];
445
+		$form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ];
446 446
 
447 447
 		return intval( $form_id );
448 448
 	}
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 
451 451
 	function add_scripts_and_styles( $hook ) {
452 452
 
453
-		if( ! class_exists( 'RGForms' ) ) {
453
+		if ( ! class_exists( 'RGForms' ) ) {
454 454
 
455 455
 			do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' );
456 456
 
@@ -459,26 +459,26 @@  discard block
 block discarded – undo
459 459
 
460 460
 		// enqueue styles & scripts gf_entries
461 461
 		// But only if we're on the main Entries page, not on reports pages
462
-		if( GFForms::get_page() !== 'entry_list' ) {
462
+		if ( GFForms::get_page() !== 'entry_list' ) {
463 463
 			return;
464 464
 		}
465 465
 
466 466
 		$form_id = $this->get_form_id();
467 467
 
468 468
 		// Things are broken; no forms were found
469
-		if( empty( $form_id ) ) {
469
+		if ( empty( $form_id ) ) {
470 470
 			return;
471 471
 		}
472 472
 
473
-		wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
473
+		wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
474 474
 
475
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
475
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
476 476
 
477
-		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
477
+		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
478 478
 
479 479
 		wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
480
-			'nonce' => wp_create_nonce( 'gravityview_entry_approval'),
481
-			'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval'),
480
+			'nonce' => wp_create_nonce( 'gravityview_entry_approval' ),
481
+			'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval' ),
482 482
 			'form_id' => $form_id,
483 483
 			'show_column' => (int)$this->show_approve_entry_column( $form_id ),
484 484
 			'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
@@ -487,10 +487,10 @@  discard block
 block discarded – undo
487 487
 			'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED,
488 488
 			'bulk_actions' => $this->get_bulk_actions( $form_id ),
489 489
 			'bulk_message' => $this->bulk_update_message,
490
-			'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'),
491
-            'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'),
492
-			'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'),
493
-			'column_title' => __( 'Show entry in directory view?', 'gravityview'),
490
+			'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'unapproved' ),
491
+            'approve_title' => GravityView_Entry_Approval_Status::get_title_attr( 'disapproved' ),
492
+			'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'approved' ),
493
+			'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
494 494
 			'column_link' => esc_url( $this->get_sort_link( $form_id ) ),
495 495
 		) );
496 496
 
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
 
511 511
 		$approved_column_id = self::get_approved_column( $form_id );
512 512
 
513
-		if( ! $approved_column_id ) {
513
+		if ( ! $approved_column_id ) {
514 514
 		    return '';
515 515
         }
516 516
 
517
-	    $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc';
517
+	    $order = ( 'desc' === rgget( 'order' ) ) ? 'asc' : 'desc';
518 518
 
519 519
 	    $args = array(
520 520
 		    'orderby' => $approved_column_id,
@@ -540,16 +540,16 @@  discard block
 block discarded – undo
540 540
 		$bulk_actions = array(
541 541
 			'GravityView' => array(
542 542
 				array(
543
-					'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'),
544
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ),
543
+					'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ),
544
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ),
545 545
 				),
546 546
 				array(
547
-					'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'),
548
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['disapprove'], $form_id ),
547
+					'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ),
548
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'disapprove' ], $form_id ),
549 549
 				),
550 550
 				array(
551
-					'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'),
552
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ),
551
+					'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ),
552
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ),
553 553
 				),
554 554
 			),
555 555
 		);
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 		// Sanitize the values, just to be sure.
567 567
 		foreach ( $bulk_actions as $key => $group ) {
568 568
 			foreach ( $group as $i => $action ) {
569
-				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
570
-				$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
569
+				$bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] );
570
+				$bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] );
571 571
 			}
572 572
 		}
573 573
 
@@ -592,13 +592,13 @@  discard block
 block discarded – undo
592 592
 		 * @since 1.7.2
593 593
 		 * @param boolean $hide_if_no_connections
594 594
 		 */
595
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
595
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
596 596
 
597
-		if( $hide_if_no_connections ) {
597
+		if ( $hide_if_no_connections ) {
598 598
 
599 599
 			$connected_views = gravityview_get_connected_views( $form_id );
600 600
 
601
-			if( empty( $connected_views ) ) {
601
+			if ( empty( $connected_views ) ) {
602 602
 				$show_approve_column = false;
603 603
 			}
604 604
 		}
@@ -608,18 +608,18 @@  discard block
 block discarded – undo
608 608
 		 * @param boolean $show_approve_column Whether the column will be shown
609 609
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
610 610
 		 */
611
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
611
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
612 612
 
613 613
 		return $show_approve_column;
614 614
 	}
615 615
 
616 616
 	function register_gform_noconflict_script( $scripts ) {
617
-		$scripts[] = 'gravityview_gf_entries_scripts';
617
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
618 618
 		return $scripts;
619 619
 	}
620 620
 
621 621
 	function register_gform_noconflict_style( $styles ) {
622
-		$styles[] = 'gravityview_entries_list';
622
+		$styles[ ] = 'gravityview_entries_list';
623 623
 		return $styles;
624 624
 	}
625 625
 
Please login to merge, or discard this patch.
includes/class-admin-add-shortcode.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 
21 21
 	function __construct() {
22 22
 
23
-			add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30);
23
+			add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 );
24 24
 
25
-			add_action( 'admin_footer',	array( $this, 'add_shortcode_popup') );
25
+			add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) );
26 26
 
27 27
 			// adding styles and scripts
28
-			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
28
+			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
29 29
 
30 30
 			// ajax - populate sort fields based on the selected view
31 31
 			add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) );
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	function is_post_editor_screen() {
42 42
 		global $current_screen, $pagenow;
43
-		return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) );
43
+		return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) );
44 44
 	}
45 45
 
46 46
 
@@ -55,15 +55,15 @@  discard block
 block discarded – undo
55 55
 		/**
56 56
 		 * @since 1.15.3
57 57
 		 */
58
-		if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) {
58
+		if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) {
59 59
 			return;
60 60
 		}
61 61
 
62
-		if( !$this->is_post_editor_screen() ) {
62
+		if ( ! $this->is_post_editor_screen() ) {
63 63
 			return;
64 64
 		}
65 65
 		?>
66
-		<a href="#TB_inline?width=600&amp;height=800&amp;inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a>
66
+		<a href="#TB_inline?width=600&amp;height=800&amp;inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a>
67 67
 		<?php
68 68
 
69 69
 	}
@@ -79,16 +79,16 @@  discard block
 block discarded – undo
79 79
 	function add_shortcode_popup() {
80 80
 		global $post;
81 81
 
82
-		if( !$this->is_post_editor_screen() ) {
82
+		if ( ! $this->is_post_editor_screen() ) {
83 83
 			return;
84 84
 		}
85 85
 
86
-		$post_type = get_post_type_object($post->post_type);
86
+		$post_type = get_post_type_object( $post->post_type );
87 87
 
88
-		$views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) );
88
+		$views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) );
89 89
 
90 90
 		// If there are no views set up yet, we get outta here.
91
-		if( empty( $views ) ) {
91
+		if ( empty( $views ) ) {
92 92
 			echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>';
93 93
 			return;
94 94
 		}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				<div class="wrap">
100 100
 
101 101
 					<h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2>
102
-					<p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p>
102
+					<p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p>
103 103
 
104 104
 					<div>
105 105
 						<h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3>
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 						<select name="gravityview_id" id="gravityview_id">
108 108
 							<option value=""><?php esc_html_e( '&mdash; Select a View to Insert &mdash;', 'gravityview' ); ?></option>
109 109
 							<?php
110
-							foreach( $views as $view ) {
111
-								$title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title;
112
-								echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>';
110
+							foreach ( $views as $view ) {
111
+								$title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title;
112
+								echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>';
113 113
 							}
114 114
 							?>
115 115
 						</select>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 						foreach ( $settings as $key => $setting ) {
127 127
 
128
-							if( empty( $setting['show_in_shortcode'] ) ) { continue; }
128
+							if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; }
129 129
 
130 130
 							GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' );
131 131
 						}
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 					</table>
135 135
 
136 136
 					<div class="submit">
137
-						<input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" />
138
-						<input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" />
137
+						<input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" />
138
+						<input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" />
139 139
 					</div>
140 140
 
141 141
 				</div>
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	function add_scripts_and_styles() {
158 158
 
159
-		if( ! $this->is_post_editor_screen() ) {
159
+		if ( ! $this->is_post_editor_screen() ) {
160 160
 			return;
161 161
 		}
162 162
 
@@ -167,22 +167,22 @@  discard block
 block discarded – undo
167 167
 
168 168
 		$protocol = is_ssl() ? 'https://' : 'http://';
169 169
 
170
-		wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version );
170
+		wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version );
171 171
 
172 172
 		//enqueue styles
173
-		wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
173
+		wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
174 174
 		wp_enqueue_style( 'gravityview_postedit_styles' );
175 175
 
176
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
176
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
177 177
 
178 178
 		// custom js
179
-		wp_register_script( 'gravityview_postedit_scripts',  plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version );
179
+		wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version );
180 180
 		wp_enqueue_script( 'gravityview_postedit_scripts' );
181
-		wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array(
182
-			'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'),
181
+		wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array(
182
+			'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ),
183 183
 			'loading_text' => esc_html__( 'Loading&hellip;', 'gravityview' ),
184
-			'alert_1' => esc_html__( 'Please select a View', 'gravityview'),
185
-		));
184
+			'alert_1' => esc_html__( 'Please select a View', 'gravityview' ),
185
+		) );
186 186
 
187 187
 	}
188 188
 
@@ -198,16 +198,16 @@  discard block
 block discarded – undo
198 198
 	function get_sortable_fields() {
199 199
 
200 200
 		// Not properly formatted request
201
-		if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) {
201
+		if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) {
202 202
 			exit( false );
203 203
 		}
204 204
 
205 205
 		// Not valid request
206
-		if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) {
206
+		if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) {
207 207
 			exit( false );
208 208
 		}
209 209
 
210
-		$viewid = (int)$_POST['viewid'];
210
+		$viewid = (int)$_POST[ 'viewid' ];
211 211
 
212 212
 		// fetch form id assigned to the view
213 213
 		$formid = gravityview_get_form_id( $viewid );
Please login to merge, or discard this patch.
includes/class-gravityview-entry-approval-status.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -113,16 +113,16 @@  discard block
 block discarded – undo
113 113
 		$new_value = $old_value;
114 114
 
115 115
 		// Meta value does not exist yet
116
-		if( false === $old_value ) {
116
+		if ( false === $old_value ) {
117 117
 			return self::UNAPPROVED;
118 118
 		}
119 119
 
120 120
 		// Meta value does not exist yet
121
-		if( true === $old_value ) {
121
+		if ( true === $old_value ) {
122 122
 			return self::APPROVED;
123 123
 		}
124 124
 
125
-		switch ( (string) $old_value ) {
125
+		switch ( (string)$old_value ) {
126 126
 
127 127
 			// Approved values
128 128
 			case 'Approved':
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 		foreach ( $choices as $key => $choice ) {
248 248
 
249 249
 			// Is the passed status value the same as the choice value or key?
250
-			if ( $status === $choice['value'] || $status === $key ) {
250
+			if ( $status === $choice[ 'value' ] || $status === $key ) {
251 251
 
252
-				if( 'key' === $attr_key ) {
252
+				if ( 'key' === $attr_key ) {
253 253
 					return $key;
254 254
 				} else {
255 255
 					return rgar( $choice, $attr_key, false );
Please login to merge, or discard this patch.
includes/class-post-types.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 		// Load even when invalid to allow for export
20 20
 		add_action( 'init', array( 'GravityView_Post_Types', 'init_post_types' ) );
21 21
 
22
-		if( GravityView_Compatibility::is_valid() ) {
22
+		if ( GravityView_Compatibility::is_valid() ) {
23 23
 			add_action( 'init', array( 'GravityView_Post_Types', 'init_rewrite' ) );
24 24
 		}
25 25
 	}
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 
44 44
 		$supports = array( 'title', 'revisions' );
45 45
 
46
-		if( $is_hierarchical ) {
47
-			$supports[] = 'page-attributes';
46
+		if ( $is_hierarchical ) {
47
+			$supports[ ] = 'page-attributes';
48 48
 		}
49 49
 
50 50
 		/**
Please login to merge, or discard this patch.
includes/class-cache.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		/**
80 80
 		 * @see RGFormsModel::update_lead_property() Trigger when any entry property changes
81 81
 		 */
82
-		foreach( $this->lead_db_columns as $column ) {
82
+		foreach ( $this->lead_db_columns as $column ) {
83 83
 			add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 );
84 84
 		}
85 85
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 			return;
113 113
 		}
114 114
 
115
-		do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry['form_id'] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) );
115
+		do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry[ 'form_id' ] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) );
116 116
 		
117
-		$this->blacklist_add( $entry['form_id'] );
117
+		$this->blacklist_add( $entry[ 'form_id' ] );
118 118
 	}
119 119
 
120 120
 	/**
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function entry_updated( $form, $lead_id ) {
129 129
 
130
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form['id'] . ' to blacklist because entry #' . $lead_id . ' was updated' );
130
+		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $lead_id . ' was updated' );
131 131
 
132
-		$this->blacklist_add( $form['id'] );
132
+		$this->blacklist_add( $form[ 'id' ] );
133 133
 	}
134 134
 
135 135
 	/**
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function entry_created( $entry, $form ) {
146 146
 
147
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was created' );
147
+		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was created' );
148 148
 
149
-		$this->blacklist_add( $form['id'] );
149
+		$this->blacklist_add( $form[ 'id' ] );
150 150
 	}
151 151
 
152 152
 	/**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		// Normally just one form, but supports multiple forms
166 166
 		//
167 167
 		// Array of IDs 12, 5, 14 would result in `f-12f-5f-14`
168
-		$forms = 'f:' . implode( '&f:', (array) $form_ids );
168
+		$forms = 'f:' . implode( '&f:', (array)$form_ids );
169 169
 
170 170
 		// Prefix for transient keys
171 171
 		// Now the prefix would be: `gv-cache-f-12f-5f-14`
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		) );
223 223
 
224 224
 		// Add the passed form IDs
225
-		$blacklist = array_merge( (array) $blacklist, $form_ids );
225
+		$blacklist = array_merge( (array)$blacklist, $form_ids );
226 226
 
227 227
 		// Don't duplicate
228 228
 		$blacklist = array_unique( $blacklist );
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
 		$blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() );
244 244
 
245
-		$updated_list = array_diff( $blacklist, (array) $form_ids );
245
+		$updated_list = array_diff( $blacklist, (array)$form_ids );
246 246
 
247 247
 		do_action( 'gravityview_log_debug', 'GravityView_Cache[blacklist_remove] Removing form IDs from cache blacklist', array(
248 248
 			'$form_ids'     => $form_ids,
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 			return false;
276 276
 		}
277 277
 
278
-		foreach ( (array) $form_ids as $form_id ) {
278
+		foreach ( (array)$form_ids as $form_id ) {
279 279
 
280 280
 			if ( in_array( $form_id, $blacklist ) ) {
281 281
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 			 * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache
348 348
 			 * @param int $time_in_seconds Default: `DAY_IN_SECONDS`
349 349
 			 */
350
-			$cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
350
+			$cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
351 351
 
352 352
 			do_action( 'gravityview_log_debug', 'GravityView_Cache[set] Setting cache with transient key ' . $this->key . ' for ' . $cache_time . ' seconds' );
353 353
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			return;
384 384
 		}
385 385
 
386
-		foreach ( (array) $form_ids as $form_id ) {
386
+		foreach ( (array)$form_ids as $form_id ) {
387 387
 
388 388
 			$key = $this->get_cache_key_prefix( $form_id );
389 389
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 
498 498
 		if ( GVCommon::has_cap( 'edit_gravityviews' ) ) {
499 499
 
500
-			if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) {
500
+			if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) {
501 501
 
502 502
 				do_action( 'gravityview_log_debug', 'GravityView_Cache[use_cache] Not using cache: ?cache or ?nocache is in the URL' );
503 503
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 		 */
527 527
 		$use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this );
528 528
 
529
-		return (boolean) $use_cache;
529
+		return (boolean)$use_cache;
530 530
 	}
531 531
 
532 532
 }
Please login to merge, or discard this patch.
includes/class-gravityview-shortcode.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 		do_action( 'gravityview_log_debug', __FUNCTION__ . ' $passed_atts: ', $passed_atts );
50 50
 
51 51
 		// Get details about the current View
52
-		if( !empty( $passed_atts['detail'] ) ) {
53
-			return $this->get_view_detail( $passed_atts['detail'] );
52
+		if ( ! empty( $passed_atts[ 'detail' ] ) ) {
53
+			return $this->get_view_detail( $passed_atts[ 'detail' ] );
54 54
 		}
55 55
 
56 56
 		$atts = $this->parse_and_sanitize_atts( $passed_atts );
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
87 87
 
88 88
 		// Only keep the passed attributes after making sure that they're valid pairs
89
-		$filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array) $passed_atts, $filtered_atts ) : $filtered_atts;
89
+		$filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array)$passed_atts, $filtered_atts ) : $filtered_atts;
90 90
 
91 91
 		$atts = array();
92 92
 
93
-		foreach( $filtered_atts as $key => $passed_value ) {
93
+		foreach ( $filtered_atts as $key => $passed_value ) {
94 94
 
95 95
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
96 96
 			$passed_value = GravityView_Merge_Tags::replace_variables( $passed_value );
97 97
 
98
-			switch( $defaults[ $key ]['type'] ) {
98
+			switch ( $defaults[ $key ][ 'type' ] ) {
99 99
 
100 100
 				/**
101 101
 				 * Make sure number fields are numeric.
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
104 104
 				 */
105 105
 				case 'number':
106
-					if( is_numeric( $passed_value ) ) {
106
+					if ( is_numeric( $passed_value ) ) {
107 107
 						$atts[ $key ] = ( $passed_value + 0 );
108 108
 					}
109 109
 					break;
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 				 */
119 119
 				case 'select':
120 120
 				case 'radio':
121
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
122
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
121
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
122
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
123 123
 						$atts[ $key ] = $passed_value;
124 124
 					}
125 125
 					break;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$gravityview_view = GravityView_View::getInstance();
149 149
 		$return = '';
150 150
 
151
-		switch( $detail ) {
151
+		switch ( $detail ) {
152 152
 			case 'total_entries':
153 153
 				$return = number_format_i18n( $gravityview_view->getTotalEntries() );
154 154
 				break;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-is-approved.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,6 @@
 block discarded – undo
59 59
 	 *
60 60
 	 * @param string $output HTML value output
61 61
 	 * @param array  $entry The GF entry array
62
-	 * @param array  $field_settings Settings for the particular GV field
63 62
 	 * @param array  $field Field array, as fetched from GravityView_View::getCurrentField()
64 63
 	 *
65 64
 	 * @return string The field setting label for the current status. Uses defaults, if not configured.
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	function add_default_field( $entry_default_fields, $form, $zone ) {
94 94
 
95
-		if( 'edit' !== $zone ) {
95
+		if ( 'edit' !== $zone ) {
96 96
 			$entry_default_fields[ $this->name ] = array(
97 97
 				'label' => $this->label,
98 98
 				'desc'  => $this->description,
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 		$merge_tags = array(
119 119
 			array(
120
-				'label' => __('Approval Status', 'gravityview'),
120
+				'label' => __( 'Approval Status', 'gravityview' ),
121 121
 				'tag' => '{approval_status}'
122 122
 			),
123 123
 		);
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 				do_action( 'gravityview_log_error', __METHOD__ . ': No entry data available. Returning empty string.' );
158 158
 				$replacement = '';
159 159
 			} else {
160
-				$replacement = GravityView_Entry_Approval::get_entry_status( $entry, $match[1] );
160
+				$replacement = GravityView_Entry_Approval::get_entry_status( $entry, $match[ 1 ] );
161 161
 			}
162 162
 
163
-			$return = str_replace( $match[0], $replacement, $return );
163
+			$return = str_replace( $match[ 0 ], $replacement, $return );
164 164
 		}
165 165
 
166 166
 		return $return;
@@ -168,25 +168,25 @@  discard block
 block discarded – undo
168 168
 
169 169
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
170 170
 
171
-		$field_options['approved_label'] = array(
171
+		$field_options[ 'approved_label' ] = array(
172 172
 			'type' => 'text',
173 173
 			'label' => __( 'Approved Label', 'gravityview' ),
174 174
 			'desc' => __( 'If the entry is approved, display this value', 'gravityview' ),
175
-			'placeholder' => GravityView_Entry_Approval_Status::get_label('approved'),
175
+			'placeholder' => GravityView_Entry_Approval_Status::get_label( 'approved' ),
176 176
 		);
177 177
 
178
-		$field_options['disapproved_label'] = array(
178
+		$field_options[ 'disapproved_label' ] = array(
179 179
 			'type' => 'text',
180 180
 			'label' => __( 'Disapproved Label', 'gravityview' ),
181 181
 			'desc' => __( 'If the entry is not approved, display this value', 'gravityview' ),
182
-			'placeholder' => GravityView_Entry_Approval_Status::get_label('disapproved'),
182
+			'placeholder' => GravityView_Entry_Approval_Status::get_label( 'disapproved' ),
183 183
 		);
184 184
 
185
-		$field_options['unapproved_label'] = array(
185
+		$field_options[ 'unapproved_label' ] = array(
186 186
 			'type' => 'text',
187 187
 			'label' => __( 'Unapproved Label', 'gravityview' ),
188 188
 			'desc' => __( 'If the entry has not yet been approved or disapproved, display this value', 'gravityview' ),
189
-			'placeholder' => GravityView_Entry_Approval_Status::get_label('unapproved'),
189
+			'placeholder' => GravityView_Entry_Approval_Status::get_label( 'unapproved' ),
190 190
 		);
191 191
 
192 192
 		return $field_options;
Please login to merge, or discard this patch.
includes/admin/field-types/type_textarea.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@
 block discarded – undo
28 28
 
29 29
 		$show_mt = $this->show_merge_tags();
30 30
 
31
-        if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
32
-            $class .= ' merge-tag-support mt-position-right ';
31
+		if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
32
+			$class .= ' merge-tag-support mt-position-right ';
33 33
 
34
-            if( empty( $this->field['show_all_fields'] ) ) {
35
-            	$class .= ' mt-hide_all_fields ';
36
-            }
37
-        }
34
+			if( empty( $this->field['show_all_fields'] ) ) {
35
+				$class .= ' mt-hide_all_fields ';
36
+			}
37
+		}
38 38
 		$class .= rgar( $this->field, 'class' );
39 39
 		$placeholder = rgar( $this->field, 'placeholder' );
40 40
 		?>
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 		?>
10 10
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
11 11
 
12
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
12
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
13 13
 			echo $this->get_tooltip() . $this->get_field_desc();
14 14
 		?><div>
15 15
 				<?php $this->render_input(); ?>
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	}
20 20
 
21 21
 	function render_input( $override_input = null ) {
22
-		if( isset( $override_input ) ) {
22
+		if ( isset( $override_input ) ) {
23 23
 			echo $override_input;
24 24
 			return;
25 25
 		}
@@ -28,17 +28,17 @@  discard block
 block discarded – undo
28 28
 
29 29
 		$show_mt = $this->show_merge_tags();
30 30
 
31
-        if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
31
+        if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) {
32 32
             $class .= ' merge-tag-support mt-position-right ';
33 33
 
34
-            if( empty( $this->field['show_all_fields'] ) ) {
34
+            if ( empty( $this->field[ 'show_all_fields' ] ) ) {
35 35
             	$class .= ' mt-hide_all_fields ';
36 36
             }
37 37
         }
38 38
 		$class .= rgar( $this->field, 'class' );
39 39
 		$placeholder = rgar( $this->field, 'placeholder' );
40 40
 		?>
41
-		<textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="5"><?php echo esc_textarea(  $this->value ); ?></textarea>
41
+		<textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="5"><?php echo esc_textarea( $this->value ); ?></textarea>
42 42
        	<?php
43 43
 	}
44 44
 
Please login to merge, or discard this patch.
includes/admin/field-types/type_text.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
28 28
 
29 29
 		$show_mt = $this->show_merge_tags();
30 30
 
31
-        if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
32
-            $class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
33
-        }
34
-        $class .= rgar( $this->field, 'class', 'widefat' );
35
-        $placeholder = rgar( $this->field, 'placeholder' );
31
+		if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
32
+			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
33
+		}
34
+		$class .= rgar( $this->field, 'class', 'widefat' );
35
+		$placeholder = rgar( $this->field, 'placeholder' );
36 36
 		?>
37 37
 		<input name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>">
38 38
 		<?php
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 		?>
9 9
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
10 10
 
11
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
11
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
12 12
 			echo $this->get_tooltip() . $this->get_field_desc();
13 13
 		?><div>
14 14
 				<?php $this->render_input(); ?>
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 	function render_input( $override_input = null ) {
21 21
 
22
-		if( isset( $override_input ) ) {
22
+		if ( isset( $override_input ) ) {
23 23
 			echo $override_input;
24 24
 			return;
25 25
 		}
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 		$show_mt = $this->show_merge_tags();
30 30
 
31
-        if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
31
+        if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) {
32 32
             $class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
33 33
         }
34 34
         $class .= rgar( $this->field, 'class', 'widefat' );
Please login to merge, or discard this patch.