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

GetPaid_Meta_Box_Resend_Invoice::output()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 33
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 21
c 1
b 0
f 0
dl 0
loc 33
rs 9.584
cc 1
nc 1
nop 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