Code Duplication    Length = 15-17 lines in 3 locations

includes/install.php 3 locations

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