Code Duplication    Length = 7-7 lines in 2 locations

includes/admin/admin-pages.php 2 locations

@@ 548-554 (lines=7) @@
545
        }
546
    }
547
548
    if ( strlen( $page_content ) > 0 ) {
549
        // Search for an existing page with the specified page content (typically a shortcode)
550
        $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}%" ) );
551
    } else {
552
        // Search for an existing page with the specified page slug
553
        $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 ) );
554
    }
555
556
    $valid_page_found = apply_filters( 'wpinv_create_page_id', $valid_page_found, $slug, $page_content );
557
@@ 566-572 (lines=7) @@
563
    }
564
565
    // Search for a matching valid trashed page
566
    if ( strlen( $page_content ) > 0 ) {
567
        // Search for an existing page with the specified page content (typically a shortcode)
568
        $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}%" ) );
569
    } else {
570
        // Search for an existing page with the specified page slug
571
        $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 ) );
572
    }
573
574
    if ( $trashed_page_found ) {
575
        $page_id   = $trashed_page_found;