Code Duplication    Length = 15-17 lines in 3 locations

includes/install.php 3 locations

@@ 427-443 (lines=17) @@
424
	$options = array();
425
426
	// Checks if the Success Page option exists AND that the page exists.
427
	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
428
429
		// Donation Confirmation (Success) Page
430
		$success = wp_insert_post(
431
			array(
432
				'post_title'     => esc_html__( 'Donation Confirmation', 'give' ),
433
				'post_content'   => '[give_receipt]',
434
				'post_status'    => 'publish',
435
				'post_author'    => 1,
436
				'post_type'      => 'page',
437
				'comment_status' => 'closed'
438
			)
439
		);
440
441
		// Store our page IDs
442
		$options['success_page'] = $success;
443
	}
444
445
	// Checks if the Failure Page option exists AND that the page exists.
446
	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
@@ 446-461 (lines=16) @@
443
	}
444
445
	// Checks if the Failure Page option exists AND that the page exists.
446
	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
447
448
		// Failed Donation Page
449
		$failed = wp_insert_post(
450
			array(
451
				'post_title'     => esc_html__( 'Donation Failed', 'give' ),
452
				'post_content'   => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ),
453
				'post_status'    => 'publish',
454
				'post_author'    => 1,
455
				'post_type'      => 'page',
456
				'comment_status' => 'closed'
457
			)
458
		);
459
460
		$options['failure_page'] = $failed;
461
	}
462
463
	// Checks if the History Page option exists AND that the page exists.
464
	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
@@ 464-478 (lines=15) @@
461
	}
462
463
	// Checks if the History Page option exists AND that the page exists.
464
	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
465
		// Donation History Page
466
		$history = wp_insert_post(
467
			array(
468
				'post_title'     => esc_html__( 'Donation History', 'give' ),
469
				'post_content'   => '[donation_history]',
470
				'post_status'    => 'publish',
471
				'post_author'    => 1,
472
				'post_type'      => 'page',
473
				'comment_status' => 'closed'
474
			)
475
		);
476
477
		$options['history_page'] = $history;
478
	}
479
480
	if ( ! empty( $options ) ) {
481
		update_option( 'give_settings', array_merge( give_get_settings(), $options ), false );