Code Duplication    Length = 7-7 lines in 2 locations

includes/admin/wc-admin-functions.php 2 locations

@@ 74-80 (lines=7) @@
71
		}
72
	}
73
74
	if ( strlen( $page_content ) > 0 ) {
75
		// Search for an existing page with the specified page content (typically a shortcode)
76
		$valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) );
77
	} else {
78
		// Search for an existing page with the specified page slug
79
		$valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' )  AND post_name = %s LIMIT 1;", $slug ) );
80
	}
81
82
	$valid_page_found = apply_filters( 'woocommerce_create_page_id', $valid_page_found, $slug, $page_content );
83
@@ 92-98 (lines=7) @@
89
	}
90
91
	// Search for a matching valid trashed page
92
	if ( strlen( $page_content ) > 0 ) {
93
		// Search for an existing page with the specified page content (typically a shortcode)
94
		$trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) );
95
	} else {
96
		// Search for an existing page with the specified page slug
97
		$trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_name = %s LIMIT 1;", $slug ) );
98
	}
99
100
	if ( $trashed_page_found ) {
101
		$page_id   = $trashed_page_found;