Code Duplication    Length = 6-6 lines in 2 locations

includes/wpinv-template-functions.php 1 location

@@ 802-807 (lines=6) @@
799
                $user_id = $invoice->get_user_id();
800
                $secret = sanitize_text_field( $_GET['_wpipay'] );
801
802
                if ( $secret === md5( $user_id . '::' . $invoice->get_email() . '::' . $invoice->get_key() ) ) { // valid invoice link
803
                    $redirect_to = remove_query_arg( '_wpipay', get_permalink() );
804
805
                    wpinv_guest_redirect( $redirect_to, $user_id );
806
                    wpinv_die();
807
                }
808
            }
809
            $redirect_to = is_user_logged_in() ? wpinv_get_history_page_uri() : wp_login_url( get_permalink() );
810

includes/wpinv-invoice-functions.php 1 location

@@ 1491-1496 (lines=6) @@
1488
            $user_id = $invoice->get_user_id();
1489
            $secret = sanitize_text_field( $_GET['_wpipay'] );
1490
            
1491
            if ( $secret === md5( $user_id . '::' . $invoice->get_email() . '::' . $invoice_key ) ) { // valid invoice link
1492
                $redirect_to = remove_query_arg( '_wpipay', get_permalink() );
1493
                
1494
                wpinv_guest_redirect( $redirect_to, $user_id );
1495
                wpinv_die();
1496
            }
1497
        }
1498
    }
1499
}