Code Duplication    Length = 7-7 lines in 2 locations

includes/admin/admin-pages.php 2 locations

@@ 442-448 (lines=7) @@
439
        }
440
    }
441
442
    if ( strlen( $page_content ) > 0 ) {
443
        // Search for an existing page with the specified page content (typically a shortcode)
444
        $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}%" ) );
445
    } else {
446
        // Search for an existing page with the specified page slug
447
        $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 ) );
448
    }
449
450
    $valid_page_found = apply_filters( 'wpinv_create_page_id', $valid_page_found, $slug, $page_content );
451
@@ 460-466 (lines=7) @@
457
    }
458
459
    // Search for a matching valid trashed page
460
    if ( strlen( $page_content ) > 0 ) {
461
        // Search for an existing page with the specified page content (typically a shortcode)
462
        $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}%" ) );
463
    } else {
464
        // Search for an existing page with the specified page slug
465
        $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 ) );
466
    }
467
468
    if ( $trashed_page_found ) {
469
        $page_id   = $trashed_page_found;