Passed
Pull Request — master (#377)
by Brian
04:53
created

GetPaid_Meta_Box_Resend_Invoice   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 22
c 1
b 0
f 0
dl 0
loc 40
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A output() 0 33 1
1
<?php
2
/**
3
 * Invoice Resend
4
 *
5
 *
6
 */
7
8
if ( ! defined( 'ABSPATH' ) ) {
9
	exit; // Exit if accessed directly
10
}
11
12
/**
13
 * GetPaid_Meta_Box_Resend_Invoice Class.
14
 */
15
class GetPaid_Meta_Box_Resend_Invoice {
16
17
    /**
18
	 * Output the metabox.
19
	 *
20
	 * @param WP_Post $post
21
	 */
22
    public static function output( $post ) {
23
24
        // Fetch the invoice.
25
        $invoice = new WPInv_Invoice( $post );
26
27
        do_action( 'wpinv_metabox_resend_invoice_before', $invoice );
28
29
        $email_url = esc_url(
30
            add_query_arg(
31
                array(
32
                    'wpi_action'    => 'send_invoice',
33
                    'invoice_id'    => $invoice->get_id(),
34
                    'wpinv-message' => false,
35
                )
36
            )
37
        );
38
39
        $reminder_url = esc_url(
40
            add_query_arg(
41
                array(
42
                    'wpi_action'    => 'send_reminder',
43
                    'invoice_id'    => $invoice->get_id(),
44
                    'wpinv-message' => false,
45
                )
46
            )
47
        );
48
        ?>
49
            <p class="wpi-meta-row wpi-resend-info"><?php _e( "This will send a copy of the invoice to the customer's email address.", 'invoicing' ); ?></p>
50
            <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo $email_url; ?>" class="button button-secondary"><?php _e( 'Resend Invoice', 'invoicing' ); ?></a></p>
51
            <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e( 'Send overdue reminder notification to customer', 'invoicing' ); ?>" href="<?php echo $reminder_url; ?>" class="button button-secondary"><?php esc_attr_e( 'Send Reminder', 'invoicing' ); ?></a></p>
52
        <?php
53
54
        do_action( 'wpinv_metabox_resend_invoice_after', $invoice );
55
56
    }
57
58
}
59