@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
3 | - exit; |
|
3 | + exit; |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | if ( !( $user_id = get_current_user_id() ) ) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | <tbody> |
32 | 32 | <?php foreach ( $user_invoices->invoices as $invoice ) { |
33 | - ?> |
|
33 | + ?> |
|
34 | 34 | <tr class="wpinv-item wpinv-item-<?php echo $invoice_status = $invoice->get_status(); ?>"> |
35 | 35 | <?php foreach ( wpinv_get_user_invoices_columns() as $column_id => $column_name ) : ?> |
36 | 36 | <td class="<?php echo esc_attr( $column_id ); ?> <?php echo (!empty($column_name['class']) ? $column_name['class'] : '');?>" data-title="<?php echo esc_attr( $column_name['title'] ); ?>"> |
@@ -53,31 +53,31 @@ discard block |
||
53 | 53 | |
54 | 54 | <?php elseif ( 'invoice-actions' === $column_id ) : ?> |
55 | 55 | <?php |
56 | - $actions = array( |
|
57 | - 'pay' => array( |
|
58 | - 'url' => $invoice->get_checkout_payment_url(), |
|
59 | - 'name' => __( 'Pay Now', 'invoicing' ), |
|
56 | + $actions = array( |
|
57 | + 'pay' => array( |
|
58 | + 'url' => $invoice->get_checkout_payment_url(), |
|
59 | + 'name' => __( 'Pay Now', 'invoicing' ), |
|
60 | 60 | 'class' => 'btn-success' |
61 | - ), |
|
61 | + ), |
|
62 | 62 | 'print' => array( |
63 | - 'url' => $invoice->get_view_url(), |
|
64 | - 'name' => __( 'Print', 'invoicing' ), |
|
63 | + 'url' => $invoice->get_view_url(), |
|
64 | + 'name' => __( 'Print', 'invoicing' ), |
|
65 | 65 | 'class' => 'btn-primary', |
66 | 66 | 'attrs' => 'target="_blank"' |
67 | - ) |
|
68 | - ); |
|
67 | + ) |
|
68 | + ); |
|
69 | 69 | |
70 | - if ( ! $invoice->needs_payment() ) { |
|
71 | - unset( $actions['pay'] ); |
|
72 | - } |
|
70 | + if ( ! $invoice->needs_payment() ) { |
|
71 | + unset( $actions['pay'] ); |
|
72 | + } |
|
73 | 73 | |
74 | - if ( $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice ) ) { |
|
75 | - foreach ( $actions as $key => $action ) { |
|
76 | - $class = !empty($action['class']) ? sanitize_html_class($action['class']) : ''; |
|
74 | + if ( $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice ) ) { |
|
75 | + foreach ( $actions as $key => $action ) { |
|
76 | + $class = !empty($action['class']) ? sanitize_html_class($action['class']) : ''; |
|
77 | 77 | echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm ' . $class . ' ' . sanitize_html_class( $key ) . '" ' . ( !empty($action['attrs']) ? $action['attrs'] : '' ) . '>' . $action['name'] . '</a>'; |
78 | - } |
|
79 | - } |
|
80 | - ?> |
|
78 | + } |
|
79 | + } |
|
80 | + ?> |
|
81 | 81 | <?php endif; ?> |
82 | 82 | </td> |
83 | 83 | <?php endforeach; ?> |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | <?php if ( 1 < $user_invoices->max_num_pages ) : ?> |
92 | 92 | <div class="invoicing-Pagination"> |
93 | 93 | <?php |
94 | - $big = 999999; |
|
94 | + $big = 999999; |
|
95 | 95 | $wpinv_cpt = $_REQUEST['wpinv-cpt']; |
96 | 96 | |
97 | 97 | if (get_query_var('paged') && 'wpi_invoice' == $wpinv_cpt) |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | else |
102 | 102 | $current_page = 1; |
103 | 103 | |
104 | - echo paginate_links( array( |
|
105 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
106 | - 'format' => '?paged=%#%', |
|
107 | - 'current' => max( 1, $current_page ), |
|
108 | - 'total' => $user_invoices->max_num_pages, |
|
104 | + echo paginate_links( array( |
|
105 | + 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
106 | + 'format' => '?paged=%#%', |
|
107 | + 'current' => max( 1, $current_page ), |
|
108 | + 'total' => $user_invoices->max_num_pages, |
|
109 | 109 | 'add_args' => array( |
110 | 110 | 'wpinv-cpt' => 'wpi_invoice', |
111 | 111 | ) |
112 | - ) ); |
|
113 | - ?> |
|
112 | + ) ); |
|
113 | + ?> |
|
114 | 114 | </div> |
115 | 115 | <?php endif; ?> |
116 | 116 |
@@ -1,80 +1,80 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
6 | -if ( !( $user_id = get_current_user_id() ) ) { |
|
6 | +if (!($user_id = get_current_user_id())) { |
|
7 | 7 | ?> |
8 | - <div class="wpinv-empty alert alert-error"><?php _e( 'You are not allowed to access this section', 'invoicing' ) ;?></div> |
|
8 | + <div class="wpinv-empty alert alert-error"><?php _e('You are not allowed to access this section', 'invoicing'); ?></div> |
|
9 | 9 | <?php |
10 | 10 | return; |
11 | 11 | } |
12 | 12 | |
13 | 13 | global $current_page; |
14 | -$current_page = empty( $current_page ) ? 1 : absint( $current_page ); |
|
15 | -$query = apply_filters( 'wpinv_user_invoices_query', array( 'user' => $user_id, 'page' => $current_page, 'paginate' => true ) ); |
|
16 | -$user_invoices = wpinv_get_invoices( $query ); |
|
14 | +$current_page = empty($current_page) ? 1 : absint($current_page); |
|
15 | +$query = apply_filters('wpinv_user_invoices_query', array('user' => $user_id, 'page' => $current_page, 'paginate' => true)); |
|
16 | +$user_invoices = wpinv_get_invoices($query); |
|
17 | 17 | $has_invoices = 0 < $user_invoices->total; |
18 | 18 | |
19 | -do_action( 'wpinv_before_user_invoices', $has_invoices ); ?> |
|
19 | +do_action('wpinv_before_user_invoices', $has_invoices); ?> |
|
20 | 20 | |
21 | -<?php if ( $has_invoices ) { ?> |
|
21 | +<?php if ($has_invoices) { ?> |
|
22 | 22 | <table class="table table-bordered table-hover wpi-user-invoices"> |
23 | 23 | <thead> |
24 | 24 | <tr> |
25 | - <?php foreach ( wpinv_get_user_invoices_columns() as $column_id => $column_name ) : ?> |
|
26 | - <th class="<?php echo esc_attr( $column_id ); ?> <?php echo (!empty($column_name['class']) ? $column_name['class'] : '');?>"><span class="nobr"><?php echo esc_html( $column_name['title'] ); ?></span></th> |
|
25 | + <?php foreach (wpinv_get_user_invoices_columns() as $column_id => $column_name) : ?> |
|
26 | + <th class="<?php echo esc_attr($column_id); ?> <?php echo (!empty($column_name['class']) ? $column_name['class'] : ''); ?>"><span class="nobr"><?php echo esc_html($column_name['title']); ?></span></th> |
|
27 | 27 | <?php endforeach; ?> |
28 | 28 | </tr> |
29 | 29 | </thead> |
30 | 30 | |
31 | 31 | <tbody> |
32 | - <?php foreach ( $user_invoices->invoices as $invoice ) { |
|
32 | + <?php foreach ($user_invoices->invoices as $invoice) { |
|
33 | 33 | ?> |
34 | 34 | <tr class="wpinv-item wpinv-item-<?php echo $invoice_status = $invoice->get_status(); ?>"> |
35 | - <?php foreach ( wpinv_get_user_invoices_columns() as $column_id => $column_name ) : ?> |
|
36 | - <td class="<?php echo esc_attr( $column_id ); ?> <?php echo (!empty($column_name['class']) ? $column_name['class'] : '');?>" data-title="<?php echo esc_attr( $column_name['title'] ); ?>"> |
|
37 | - <?php if ( has_action( 'wpinv_user_invoices_column_' . $column_id ) ) : ?> |
|
38 | - <?php do_action( 'wpinv_user_invoices_column_' . $column_id, $invoice ); ?> |
|
39 | - |
|
40 | - <?php elseif ( 'invoice-number' === $column_id ) : ?> |
|
41 | - <a href="<?php echo esc_url( $invoice->get_view_url() ); ?>"> |
|
42 | - <?php echo _x( '#', 'hash before invoice number', 'invoicing' ) . $invoice->get_number(); ?> |
|
35 | + <?php foreach (wpinv_get_user_invoices_columns() as $column_id => $column_name) : ?> |
|
36 | + <td class="<?php echo esc_attr($column_id); ?> <?php echo (!empty($column_name['class']) ? $column_name['class'] : ''); ?>" data-title="<?php echo esc_attr($column_name['title']); ?>"> |
|
37 | + <?php if (has_action('wpinv_user_invoices_column_' . $column_id)) : ?> |
|
38 | + <?php do_action('wpinv_user_invoices_column_' . $column_id, $invoice); ?> |
|
39 | + |
|
40 | + <?php elseif ('invoice-number' === $column_id) : ?> |
|
41 | + <a href="<?php echo esc_url($invoice->get_view_url()); ?>"> |
|
42 | + <?php echo _x('#', 'hash before invoice number', 'invoicing') . $invoice->get_number(); ?> |
|
43 | 43 | </a> |
44 | 44 | |
45 | - <?php elseif ( 'invoice-date' === $column_id ) : $date = wpinv_get_invoice_date( $invoice->ID ); $dateYMD = wpinv_get_invoice_date( $invoice->ID, 'Y-m-d H:i:s' ); ?> |
|
46 | - <time datetime="<?php echo strtotime( $dateYMD ); ?>" title="<?php echo $dateYMD; ?>"><?php echo $date; ?></time> |
|
45 | + <?php elseif ('invoice-date' === $column_id) : $date = wpinv_get_invoice_date($invoice->ID); $dateYMD = wpinv_get_invoice_date($invoice->ID, 'Y-m-d H:i:s'); ?> |
|
46 | + <time datetime="<?php echo strtotime($dateYMD); ?>" title="<?php echo $dateYMD; ?>"><?php echo $date; ?></time> |
|
47 | 47 | |
48 | - <?php elseif ( 'invoice-status' === $column_id ) : ?> |
|
49 | - <?php echo wpinv_invoice_status_label( $invoice_status, $invoice->get_status( true ) ) ; ?> |
|
48 | + <?php elseif ('invoice-status' === $column_id) : ?> |
|
49 | + <?php echo wpinv_invoice_status_label($invoice_status, $invoice->get_status(true)); ?> |
|
50 | 50 | |
51 | - <?php elseif ( 'invoice-total' === $column_id ) : ?> |
|
52 | - <?php echo $invoice->get_total( true ); ?> |
|
51 | + <?php elseif ('invoice-total' === $column_id) : ?> |
|
52 | + <?php echo $invoice->get_total(true); ?> |
|
53 | 53 | |
54 | - <?php elseif ( 'invoice-actions' === $column_id ) : ?> |
|
54 | + <?php elseif ('invoice-actions' === $column_id) : ?> |
|
55 | 55 | <?php |
56 | 56 | $actions = array( |
57 | 57 | 'pay' => array( |
58 | 58 | 'url' => $invoice->get_checkout_payment_url(), |
59 | - 'name' => __( 'Pay Now', 'invoicing' ), |
|
59 | + 'name' => __('Pay Now', 'invoicing'), |
|
60 | 60 | 'class' => 'btn-success' |
61 | 61 | ), |
62 | 62 | 'print' => array( |
63 | 63 | 'url' => $invoice->get_view_url(), |
64 | - 'name' => __( 'Print', 'invoicing' ), |
|
64 | + 'name' => __('Print', 'invoicing'), |
|
65 | 65 | 'class' => 'btn-primary', |
66 | 66 | 'attrs' => 'target="_blank"' |
67 | 67 | ) |
68 | 68 | ); |
69 | 69 | |
70 | - if ( ! $invoice->needs_payment() ) { |
|
71 | - unset( $actions['pay'] ); |
|
70 | + if (!$invoice->needs_payment()) { |
|
71 | + unset($actions['pay']); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice ) ) { |
|
75 | - foreach ( $actions as $key => $action ) { |
|
74 | + if ($actions = apply_filters('wpinv_user_invoices_actions', $actions, $invoice)) { |
|
75 | + foreach ($actions as $key => $action) { |
|
76 | 76 | $class = !empty($action['class']) ? sanitize_html_class($action['class']) : ''; |
77 | - echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm ' . $class . ' ' . sanitize_html_class( $key ) . '" ' . ( !empty($action['attrs']) ? $action['attrs'] : '' ) . '>' . $action['name'] . '</a>'; |
|
77 | + echo '<a href="' . esc_url($action['url']) . '" class="btn btn-sm ' . $class . ' ' . sanitize_html_class($key) . '" ' . (!empty($action['attrs']) ? $action['attrs'] : '') . '>' . $action['name'] . '</a>'; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | ?> |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | </tbody> |
87 | 87 | </table> |
88 | 88 | |
89 | - <?php do_action( 'wpinv_before_user_invoices_pagination' ); ?> |
|
89 | + <?php do_action('wpinv_before_user_invoices_pagination'); ?> |
|
90 | 90 | |
91 | - <?php if ( 1 < $user_invoices->max_num_pages ) : ?> |
|
91 | + <?php if (1 < $user_invoices->max_num_pages) : ?> |
|
92 | 92 | <div class="invoicing-Pagination"> |
93 | 93 | <?php |
94 | 94 | $big = 999999; |
@@ -101,23 +101,23 @@ discard block |
||
101 | 101 | else |
102 | 102 | $current_page = 1; |
103 | 103 | |
104 | - echo paginate_links( array( |
|
105 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
104 | + echo paginate_links(array( |
|
105 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
106 | 106 | 'format' => '?paged=%#%', |
107 | - 'current' => max( 1, $current_page ), |
|
107 | + 'current' => max(1, $current_page), |
|
108 | 108 | 'total' => $user_invoices->max_num_pages, |
109 | 109 | 'add_args' => array( |
110 | 110 | 'wpinv-cpt' => 'wpi_invoice', |
111 | 111 | ) |
112 | - ) ); |
|
112 | + )); |
|
113 | 113 | ?> |
114 | 114 | </div> |
115 | 115 | <?php endif; ?> |
116 | 116 | |
117 | 117 | <?php } else { ?> |
118 | 118 | <div class="wpinv-empty alert-info"> |
119 | - <?php _e( 'No invoice has been made yet.', 'invoicing' ); ?> |
|
119 | + <?php _e('No invoice has been made yet.', 'invoicing'); ?> |
|
120 | 120 | </div> |
121 | 121 | <?php } ?> |
122 | 122 | |
123 | -<?php do_action( 'wpinv_after_user_invoices', $has_invoices ); ?> |
|
123 | +<?php do_action('wpinv_after_user_invoices', $has_invoices); ?> |
@@ -94,12 +94,13 @@ |
||
94 | 94 | $big = 999999; |
95 | 95 | $wpinv_cpt = $_REQUEST['wpinv-cpt']; |
96 | 96 | |
97 | - if (get_query_var('paged') && 'wpi_invoice' == $wpinv_cpt) |
|
98 | - $current_page = get_query_var('paged'); |
|
99 | - elseif (get_query_var('page') && 'wpi_invoice' == $wpinv_cpt) |
|
100 | - $current_page = get_query_var('page'); |
|
101 | - else |
|
102 | - $current_page = 1; |
|
97 | + if (get_query_var('paged') && 'wpi_invoice' == $wpinv_cpt) { |
|
98 | + $current_page = get_query_var('paged'); |
|
99 | + } elseif (get_query_var('page') && 'wpi_invoice' == $wpinv_cpt) { |
|
100 | + $current_page = get_query_var('page'); |
|
101 | + } else { |
|
102 | + $current_page = 1; |
|
103 | + } |
|
103 | 104 | |
104 | 105 | echo paginate_links( array( |
105 | 106 | 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // MUST have WordPress. |
10 | -if ( !defined( 'WPINC' ) ) { |
|
11 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
10 | +if (!defined('WPINC')) { |
|
11 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | function wpinv_init_transactional_emails() { |
15 | - $email_actions = apply_filters( 'wpinv_email_actions', array( |
|
15 | + $email_actions = apply_filters('wpinv_email_actions', array( |
|
16 | 16 | 'wpinv_status_pending_to_processing', |
17 | 17 | 'wpinv_status_pending_to_publish', |
18 | 18 | 'wpinv_status_pending_to_cancelled', |
@@ -28,79 +28,79 @@ discard block |
||
28 | 28 | 'wpinv_fully_refunded', |
29 | 29 | 'wpinv_partially_refunded', |
30 | 30 | 'wpinv_new_invoice_note' |
31 | - ) ); |
|
31 | + )); |
|
32 | 32 | |
33 | - foreach ( $email_actions as $action ) { |
|
34 | - add_action( $action, 'wpinv_send_transactional_email', 10, 10 ); |
|
33 | + foreach ($email_actions as $action) { |
|
34 | + add_action($action, 'wpinv_send_transactional_email', 10, 10); |
|
35 | 35 | } |
36 | 36 | } |
37 | -add_action( 'init', 'wpinv_init_transactional_emails' ); |
|
37 | +add_action('init', 'wpinv_init_transactional_emails'); |
|
38 | 38 | |
39 | 39 | // New invoice email |
40 | -add_action( 'wpinv_status_pending_to_processing_notification', 'wpinv_new_invoice_notification' ); |
|
41 | -add_action( 'wpinv_status_pending_to_publish_notification', 'wpinv_new_invoice_notification' ); |
|
42 | -add_action( 'wpinv_status_pending_to_onhold_notification', 'wpinv_new_invoice_notification' ); |
|
43 | -add_action( 'wpinv_status_failed_to_processing_notification', 'wpinv_new_invoice_notification' ); |
|
44 | -add_action( 'wpinv_status_failed_to_publish_notification', 'wpinv_new_invoice_notification' ); |
|
45 | -add_action( 'wpinv_status_failed_to_onhold_notification', 'wpinv_new_invoice_notification' ); |
|
40 | +add_action('wpinv_status_pending_to_processing_notification', 'wpinv_new_invoice_notification'); |
|
41 | +add_action('wpinv_status_pending_to_publish_notification', 'wpinv_new_invoice_notification'); |
|
42 | +add_action('wpinv_status_pending_to_onhold_notification', 'wpinv_new_invoice_notification'); |
|
43 | +add_action('wpinv_status_failed_to_processing_notification', 'wpinv_new_invoice_notification'); |
|
44 | +add_action('wpinv_status_failed_to_publish_notification', 'wpinv_new_invoice_notification'); |
|
45 | +add_action('wpinv_status_failed_to_onhold_notification', 'wpinv_new_invoice_notification'); |
|
46 | 46 | |
47 | 47 | // Cancelled invoice email |
48 | -add_action( 'wpinv_status_pending_to_cancelled_notification', 'wpinv_cancelled_invoice_notification' ); |
|
49 | -add_action( 'wpinv_status_onhold_to_cancelled_notification', 'wpinv_cancelled_invoice_notification' ); |
|
48 | +add_action('wpinv_status_pending_to_cancelled_notification', 'wpinv_cancelled_invoice_notification'); |
|
49 | +add_action('wpinv_status_onhold_to_cancelled_notification', 'wpinv_cancelled_invoice_notification'); |
|
50 | 50 | |
51 | 51 | // Failed invoice email |
52 | -add_action( 'wpinv_status_pending_to_failed_notification', 'wpinv_failed_invoice_notification' ); |
|
53 | -add_action( 'wpinv_status_onhold_to_failed_notification', 'wpinv_failed_invoice_notification' ); |
|
52 | +add_action('wpinv_status_pending_to_failed_notification', 'wpinv_failed_invoice_notification'); |
|
53 | +add_action('wpinv_status_onhold_to_failed_notification', 'wpinv_failed_invoice_notification'); |
|
54 | 54 | |
55 | 55 | // On hold invoice email |
56 | -add_action( 'wpinv_status_pending_to_onhold_notification', 'wpinv_onhold_invoice_notification' ); |
|
57 | -add_action( 'wpinv_status_failed_to_onhold_notification', 'wpinv_onhold_invoice_notification' ); |
|
56 | +add_action('wpinv_status_pending_to_onhold_notification', 'wpinv_onhold_invoice_notification'); |
|
57 | +add_action('wpinv_status_failed_to_onhold_notification', 'wpinv_onhold_invoice_notification'); |
|
58 | 58 | |
59 | 59 | // Processing invoice email |
60 | -add_action( 'wpinv_status_pending_to_processing_notification', 'wpinv_processing_invoice_notification' ); |
|
60 | +add_action('wpinv_status_pending_to_processing_notification', 'wpinv_processing_invoice_notification'); |
|
61 | 61 | |
62 | 62 | // Paid invoice email |
63 | -add_action( 'wpinv_status_publish_notification', 'wpinv_completed_invoice_notification' ); |
|
63 | +add_action('wpinv_status_publish_notification', 'wpinv_completed_invoice_notification'); |
|
64 | 64 | |
65 | 65 | // Refunded invoice email |
66 | -add_action( 'wpinv_fully_refunded_notification', 'wpinv_fully_refunded_notification' ); |
|
67 | -add_action( 'wpinv_partially_refunded_notification', 'wpinv_partially_refunded_notification' ); |
|
66 | +add_action('wpinv_fully_refunded_notification', 'wpinv_fully_refunded_notification'); |
|
67 | +add_action('wpinv_partially_refunded_notification', 'wpinv_partially_refunded_notification'); |
|
68 | 68 | |
69 | 69 | // Invoice note |
70 | -add_action( 'wpinv_new_invoice_note_notification', 'wpinv_new_invoice_note_notification' ); |
|
70 | +add_action('wpinv_new_invoice_note_notification', 'wpinv_new_invoice_note_notification'); |
|
71 | 71 | |
72 | -add_action( 'wpinv_email_header', 'wpinv_email_header' ); |
|
73 | -add_action( 'wpinv_email_footer', 'wpinv_email_footer' ); |
|
74 | -add_action( 'wpinv_email_invoice_details', 'wpinv_email_invoice_details', 10, 3 ); |
|
75 | -add_action( 'wpinv_email_invoice_items', 'wpinv_email_invoice_items', 10, 3 ); |
|
76 | -add_action( 'wpinv_email_billing_details', 'wpinv_email_billing_details', 10, 3 ); |
|
77 | -add_action( 'wpinv_email_before_note_details', 'wpinv_email_before_note_details', 10, 4 ); |
|
72 | +add_action('wpinv_email_header', 'wpinv_email_header'); |
|
73 | +add_action('wpinv_email_footer', 'wpinv_email_footer'); |
|
74 | +add_action('wpinv_email_invoice_details', 'wpinv_email_invoice_details', 10, 3); |
|
75 | +add_action('wpinv_email_invoice_items', 'wpinv_email_invoice_items', 10, 3); |
|
76 | +add_action('wpinv_email_billing_details', 'wpinv_email_billing_details', 10, 3); |
|
77 | +add_action('wpinv_email_before_note_details', 'wpinv_email_before_note_details', 10, 4); |
|
78 | 78 | |
79 | 79 | function wpinv_send_transactional_email() { |
80 | 80 | $args = func_get_args(); |
81 | 81 | $function = current_filter() . '_notification'; |
82 | - do_action_ref_array( $function, $args ); |
|
82 | + do_action_ref_array($function, $args); |
|
83 | 83 | } |
84 | 84 | |
85 | -function wpinv_new_invoice_notification( $invoice_id, $new_status = '' ) { |
|
85 | +function wpinv_new_invoice_notification($invoice_id, $new_status = '') { |
|
86 | 86 | global $wpinv_email_search, $wpinv_email_replace; |
87 | 87 | |
88 | 88 | $email_type = 'new_invoice'; |
89 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
89 | + if (!wpinv_email_is_enabled($email_type)) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
93 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
94 | - if ( empty( $invoice ) ) { |
|
93 | + $invoice = wpinv_get_invoice($invoice_id); |
|
94 | + if (empty($invoice)) { |
|
95 | 95 | return false; |
96 | 96 | } |
97 | 97 | |
98 | - if ( !("wpi_invoice" === $invoice->post_type) ) { |
|
98 | + if (!("wpi_invoice" === $invoice->post_type)) { |
|
99 | 99 | return false; |
100 | 100 | } |
101 | 101 | |
102 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
103 | - if ( !is_email( $recipient ) ) { |
|
102 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
103 | + if (!is_email($recipient)) { |
|
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | |
@@ -117,41 +117,41 @@ discard block |
||
117 | 117 | $wpinv_email_search = $search; |
118 | 118 | $wpinv_email_replace = $replace; |
119 | 119 | |
120 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
121 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
122 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
123 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
120 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
121 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
122 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
123 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
124 | 124 | |
125 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
125 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
126 | 126 | 'invoice' => $invoice, |
127 | 127 | 'email_type' => $email_type, |
128 | 128 | 'email_heading' => $email_heading, |
129 | 129 | 'sent_to_admin' => true, |
130 | 130 | 'plain_text' => false, |
131 | - ) ); |
|
131 | + )); |
|
132 | 132 | |
133 | - return wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
133 | + return wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
134 | 134 | } |
135 | 135 | |
136 | -function wpinv_cancelled_invoice_notification( $invoice_id, $new_status = '' ) { |
|
136 | +function wpinv_cancelled_invoice_notification($invoice_id, $new_status = '') { |
|
137 | 137 | global $wpinv_email_search, $wpinv_email_replace; |
138 | 138 | |
139 | 139 | $email_type = 'cancelled_invoice'; |
140 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
140 | + if (!wpinv_email_is_enabled($email_type)) { |
|
141 | 141 | return false; |
142 | 142 | } |
143 | 143 | |
144 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
145 | - if ( empty( $invoice ) ) { |
|
144 | + $invoice = wpinv_get_invoice($invoice_id); |
|
145 | + if (empty($invoice)) { |
|
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | |
149 | - if ( !("wpi_invoice" === $invoice->post_type) ) { |
|
149 | + if (!("wpi_invoice" === $invoice->post_type)) { |
|
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
153 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
154 | - if ( !is_email( $recipient ) ) { |
|
153 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
154 | + if (!is_email($recipient)) { |
|
155 | 155 | return false; |
156 | 156 | } |
157 | 157 | |
@@ -168,41 +168,41 @@ discard block |
||
168 | 168 | $wpinv_email_search = $search; |
169 | 169 | $wpinv_email_replace = $replace; |
170 | 170 | |
171 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
172 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
173 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
174 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
171 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
172 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
173 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
174 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
175 | 175 | |
176 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
176 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
177 | 177 | 'invoice' => $invoice, |
178 | 178 | 'email_type' => $email_type, |
179 | 179 | 'email_heading' => $email_heading, |
180 | 180 | 'sent_to_admin' => true, |
181 | 181 | 'plain_text' => false, |
182 | - ) ); |
|
182 | + )); |
|
183 | 183 | |
184 | - return wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
184 | + return wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
185 | 185 | } |
186 | 186 | |
187 | -function wpinv_failed_invoice_notification( $invoice_id, $new_status = '' ) { |
|
187 | +function wpinv_failed_invoice_notification($invoice_id, $new_status = '') { |
|
188 | 188 | global $wpinv_email_search, $wpinv_email_replace; |
189 | 189 | |
190 | 190 | $email_type = 'failed_invoice'; |
191 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
191 | + if (!wpinv_email_is_enabled($email_type)) { |
|
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | |
195 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
196 | - if ( empty( $invoice ) ) { |
|
195 | + $invoice = wpinv_get_invoice($invoice_id); |
|
196 | + if (empty($invoice)) { |
|
197 | 197 | return false; |
198 | 198 | } |
199 | 199 | |
200 | - if ( !("wpi_invoice" === $invoice->post_type) ) { |
|
200 | + if (!("wpi_invoice" === $invoice->post_type)) { |
|
201 | 201 | return false; |
202 | 202 | } |
203 | 203 | |
204 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
205 | - if ( !is_email( $recipient ) ) { |
|
204 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
205 | + if (!is_email($recipient)) { |
|
206 | 206 | return false; |
207 | 207 | } |
208 | 208 | |
@@ -219,41 +219,41 @@ discard block |
||
219 | 219 | $wpinv_email_search = $search; |
220 | 220 | $wpinv_email_replace = $replace; |
221 | 221 | |
222 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
223 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
224 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
225 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
222 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
223 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
224 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
225 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
226 | 226 | |
227 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
227 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
228 | 228 | 'invoice' => $invoice, |
229 | 229 | 'email_type' => $email_type, |
230 | 230 | 'email_heading' => $email_heading, |
231 | 231 | 'sent_to_admin' => true, |
232 | 232 | 'plain_text' => false, |
233 | - ) ); |
|
233 | + )); |
|
234 | 234 | |
235 | - return wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
235 | + return wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
236 | 236 | } |
237 | 237 | |
238 | -function wpinv_onhold_invoice_notification( $invoice_id, $new_status = '' ) { |
|
238 | +function wpinv_onhold_invoice_notification($invoice_id, $new_status = '') { |
|
239 | 239 | global $wpinv_email_search, $wpinv_email_replace; |
240 | 240 | |
241 | 241 | $email_type = 'onhold_invoice'; |
242 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
242 | + if (!wpinv_email_is_enabled($email_type)) { |
|
243 | 243 | return false; |
244 | 244 | } |
245 | 245 | |
246 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
247 | - if ( empty( $invoice ) ) { |
|
246 | + $invoice = wpinv_get_invoice($invoice_id); |
|
247 | + if (empty($invoice)) { |
|
248 | 248 | return false; |
249 | 249 | } |
250 | 250 | |
251 | - if ( !("wpi_invoice" === $invoice->post_type) ) { |
|
251 | + if (!("wpi_invoice" === $invoice->post_type)) { |
|
252 | 252 | return false; |
253 | 253 | } |
254 | 254 | |
255 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
256 | - if ( !is_email( $recipient ) ) { |
|
255 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
256 | + if (!is_email($recipient)) { |
|
257 | 257 | return false; |
258 | 258 | } |
259 | 259 | |
@@ -270,49 +270,49 @@ discard block |
||
270 | 270 | $wpinv_email_search = $search; |
271 | 271 | $wpinv_email_replace = $replace; |
272 | 272 | |
273 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
274 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
275 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
276 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
273 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
274 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
275 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
276 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
277 | 277 | |
278 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
278 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
279 | 279 | 'invoice' => $invoice, |
280 | 280 | 'email_type' => $email_type, |
281 | 281 | 'email_heading' => $email_heading, |
282 | 282 | 'sent_to_admin' => false, |
283 | 283 | 'plain_text' => false, |
284 | - ) ); |
|
284 | + )); |
|
285 | 285 | |
286 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
286 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
287 | 287 | |
288 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
289 | - $recipient = wpinv_get_admin_email(); |
|
290 | - $subject .= ' - ADMIN BCC COPY'; |
|
291 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
288 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
289 | + $recipient = wpinv_get_admin_email(); |
|
290 | + $subject .= ' - ADMIN BCC COPY'; |
|
291 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | return $sent; |
295 | 295 | } |
296 | 296 | |
297 | -function wpinv_processing_invoice_notification( $invoice_id, $new_status = '' ) { |
|
297 | +function wpinv_processing_invoice_notification($invoice_id, $new_status = '') { |
|
298 | 298 | global $wpinv_email_search, $wpinv_email_replace; |
299 | 299 | |
300 | 300 | $email_type = 'processing_invoice'; |
301 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
301 | + if (!wpinv_email_is_enabled($email_type)) { |
|
302 | 302 | return false; |
303 | 303 | } |
304 | 304 | |
305 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
306 | - if ( empty( $invoice ) ) { |
|
305 | + $invoice = wpinv_get_invoice($invoice_id); |
|
306 | + if (empty($invoice)) { |
|
307 | 307 | return false; |
308 | 308 | } |
309 | 309 | |
310 | - if ( !("wpi_invoice" === $invoice->post_type) ) { |
|
310 | + if (!("wpi_invoice" === $invoice->post_type)) { |
|
311 | 311 | return false; |
312 | 312 | } |
313 | 313 | |
314 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
315 | - if ( !is_email( $recipient ) ) { |
|
314 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
315 | + if (!is_email($recipient)) { |
|
316 | 316 | return false; |
317 | 317 | } |
318 | 318 | |
@@ -329,49 +329,49 @@ discard block |
||
329 | 329 | $wpinv_email_search = $search; |
330 | 330 | $wpinv_email_replace = $replace; |
331 | 331 | |
332 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
333 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
334 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
335 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
332 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
333 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
334 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
335 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
336 | 336 | |
337 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
337 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
338 | 338 | 'invoice' => $invoice, |
339 | 339 | 'email_type' => $email_type, |
340 | 340 | 'email_heading' => $email_heading, |
341 | 341 | 'sent_to_admin' => false, |
342 | 342 | 'plain_text' => false, |
343 | - ) ); |
|
343 | + )); |
|
344 | 344 | |
345 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
345 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
346 | 346 | |
347 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
348 | - $recipient = wpinv_get_admin_email(); |
|
349 | - $subject .= ' - ADMIN BCC COPY'; |
|
350 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
347 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
348 | + $recipient = wpinv_get_admin_email(); |
|
349 | + $subject .= ' - ADMIN BCC COPY'; |
|
350 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | return $sent; |
354 | 354 | } |
355 | 355 | |
356 | -function wpinv_completed_invoice_notification( $invoice_id, $new_status = '' ) { |
|
356 | +function wpinv_completed_invoice_notification($invoice_id, $new_status = '') { |
|
357 | 357 | global $wpinv_email_search, $wpinv_email_replace; |
358 | 358 | |
359 | 359 | $email_type = 'completed_invoice'; |
360 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
360 | + if (!wpinv_email_is_enabled($email_type)) { |
|
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | |
364 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
365 | - if ( empty( $invoice ) ) { |
|
364 | + $invoice = wpinv_get_invoice($invoice_id); |
|
365 | + if (empty($invoice)) { |
|
366 | 366 | return false; |
367 | 367 | } |
368 | 368 | |
369 | - if ( !("wpi_invoice" === $invoice->post_type) ) { |
|
369 | + if (!("wpi_invoice" === $invoice->post_type)) { |
|
370 | 370 | return false; |
371 | 371 | } |
372 | 372 | |
373 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
374 | - if ( !is_email( $recipient ) ) { |
|
373 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
374 | + if (!is_email($recipient)) { |
|
375 | 375 | return false; |
376 | 376 | } |
377 | 377 | |
@@ -388,49 +388,49 @@ discard block |
||
388 | 388 | $wpinv_email_search = $search; |
389 | 389 | $wpinv_email_replace = $replace; |
390 | 390 | |
391 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
392 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
393 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
394 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
391 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
392 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
393 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
394 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
395 | 395 | |
396 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
396 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
397 | 397 | 'invoice' => $invoice, |
398 | 398 | 'email_type' => $email_type, |
399 | 399 | 'email_heading' => $email_heading, |
400 | 400 | 'sent_to_admin' => false, |
401 | 401 | 'plain_text' => false, |
402 | - ) ); |
|
402 | + )); |
|
403 | 403 | |
404 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
404 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
405 | 405 | |
406 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
407 | - $recipient = wpinv_get_admin_email(); |
|
408 | - $subject .= ' - ADMIN BCC COPY'; |
|
409 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
406 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
407 | + $recipient = wpinv_get_admin_email(); |
|
408 | + $subject .= ' - ADMIN BCC COPY'; |
|
409 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | return $sent; |
413 | 413 | } |
414 | 414 | |
415 | -function wpinv_fully_refunded_notification( $invoice_id, $new_status = '' ) { |
|
415 | +function wpinv_fully_refunded_notification($invoice_id, $new_status = '') { |
|
416 | 416 | global $wpinv_email_search, $wpinv_email_replace; |
417 | 417 | |
418 | 418 | $email_type = 'refunded_invoice'; |
419 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
419 | + if (!wpinv_email_is_enabled($email_type)) { |
|
420 | 420 | return false; |
421 | 421 | } |
422 | 422 | |
423 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
424 | - if ( empty( $invoice ) ) { |
|
423 | + $invoice = wpinv_get_invoice($invoice_id); |
|
424 | + if (empty($invoice)) { |
|
425 | 425 | return false; |
426 | 426 | } |
427 | 427 | |
428 | - if ( !("wpi_invoice" === $invoice->post_type) ) { |
|
428 | + if (!("wpi_invoice" === $invoice->post_type)) { |
|
429 | 429 | return false; |
430 | 430 | } |
431 | 431 | |
432 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
433 | - if ( !is_email( $recipient ) ) { |
|
432 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
433 | + if (!is_email($recipient)) { |
|
434 | 434 | return false; |
435 | 435 | } |
436 | 436 | |
@@ -447,50 +447,50 @@ discard block |
||
447 | 447 | $wpinv_email_search = $search; |
448 | 448 | $wpinv_email_replace = $replace; |
449 | 449 | |
450 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
451 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
452 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
453 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
450 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
451 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
452 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
453 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
454 | 454 | |
455 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
455 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
456 | 456 | 'invoice' => $invoice, |
457 | 457 | 'email_type' => $email_type, |
458 | 458 | 'email_heading' => $email_heading, |
459 | 459 | 'sent_to_admin' => false, |
460 | 460 | 'plain_text' => false, |
461 | 461 | 'partial_refund' => false |
462 | - ) ); |
|
462 | + )); |
|
463 | 463 | |
464 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
464 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
465 | 465 | |
466 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
467 | - $recipient = wpinv_get_admin_email(); |
|
468 | - $subject .= ' - ADMIN BCC COPY'; |
|
469 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
466 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
467 | + $recipient = wpinv_get_admin_email(); |
|
468 | + $subject .= ' - ADMIN BCC COPY'; |
|
469 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | return $sent; |
473 | 473 | } |
474 | 474 | |
475 | -function wpinv_partially_refunded_notification( $invoice_id, $new_status = '' ) { |
|
475 | +function wpinv_partially_refunded_notification($invoice_id, $new_status = '') { |
|
476 | 476 | global $wpinv_email_search, $wpinv_email_replace; |
477 | 477 | |
478 | 478 | $email_type = 'refunded_invoice'; |
479 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
479 | + if (!wpinv_email_is_enabled($email_type)) { |
|
480 | 480 | return false; |
481 | 481 | } |
482 | 482 | |
483 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
484 | - if ( empty( $invoice ) ) { |
|
483 | + $invoice = wpinv_get_invoice($invoice_id); |
|
484 | + if (empty($invoice)) { |
|
485 | 485 | return false; |
486 | 486 | } |
487 | 487 | |
488 | - if ( !("wpi_invoice" === $invoice->post_type) ) { |
|
488 | + if (!("wpi_invoice" === $invoice->post_type)) { |
|
489 | 489 | return false; |
490 | 490 | } |
491 | 491 | |
492 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
493 | - if ( !is_email( $recipient ) ) { |
|
492 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
493 | + if (!is_email($recipient)) { |
|
494 | 494 | return false; |
495 | 495 | } |
496 | 496 | |
@@ -507,53 +507,53 @@ discard block |
||
507 | 507 | $wpinv_email_search = $search; |
508 | 508 | $wpinv_email_replace = $replace; |
509 | 509 | |
510 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
511 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
512 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
513 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
510 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
511 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
512 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
513 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
514 | 514 | |
515 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
515 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
516 | 516 | 'invoice' => $invoice, |
517 | 517 | 'email_type' => $email_type, |
518 | 518 | 'email_heading' => $email_heading, |
519 | 519 | 'sent_to_admin' => false, |
520 | 520 | 'plain_text' => false, |
521 | 521 | 'partial_refund' => true |
522 | - ) ); |
|
522 | + )); |
|
523 | 523 | |
524 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
524 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
525 | 525 | |
526 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
527 | - $recipient = wpinv_get_admin_email(); |
|
528 | - $subject .= ' - ADMIN BCC COPY'; |
|
529 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
526 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
527 | + $recipient = wpinv_get_admin_email(); |
|
528 | + $subject .= ' - ADMIN BCC COPY'; |
|
529 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | return $sent; |
533 | 533 | } |
534 | 534 | |
535 | -function wpinv_new_invoice_note_notification( $invoice_id, $new_status = '' ) { |
|
535 | +function wpinv_new_invoice_note_notification($invoice_id, $new_status = '') { |
|
536 | 536 | } |
537 | 537 | |
538 | -function wpinv_user_invoice_notification( $invoice_id ) { |
|
538 | +function wpinv_user_invoice_notification($invoice_id) { |
|
539 | 539 | global $wpinv_email_search, $wpinv_email_replace; |
540 | 540 | |
541 | 541 | $email_type = 'user_invoice'; |
542 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
542 | + if (!wpinv_email_is_enabled($email_type)) { |
|
543 | 543 | return false; |
544 | 544 | } |
545 | 545 | |
546 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
547 | - if ( empty( $invoice ) ) { |
|
546 | + $invoice = wpinv_get_invoice($invoice_id); |
|
547 | + if (empty($invoice)) { |
|
548 | 548 | return false; |
549 | 549 | } |
550 | 550 | |
551 | - if ( !("wpi_invoice" === $invoice->post_type) ) { |
|
551 | + if (!("wpi_invoice" === $invoice->post_type)) { |
|
552 | 552 | return false; |
553 | 553 | } |
554 | 554 | |
555 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
556 | - if ( !is_email( $recipient ) ) { |
|
555 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
556 | + if (!is_email($recipient)) { |
|
557 | 557 | return false; |
558 | 558 | } |
559 | 559 | |
@@ -570,52 +570,52 @@ discard block |
||
570 | 570 | $wpinv_email_search = $search; |
571 | 571 | $wpinv_email_replace = $replace; |
572 | 572 | |
573 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
574 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
575 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
576 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
573 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
574 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
575 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
576 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
577 | 577 | |
578 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
578 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
579 | 579 | 'invoice' => $invoice, |
580 | 580 | 'email_type' => $email_type, |
581 | 581 | 'email_heading' => $email_heading, |
582 | 582 | 'sent_to_admin' => false, |
583 | 583 | 'plain_text' => false, |
584 | - ) ); |
|
584 | + )); |
|
585 | 585 | |
586 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
586 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
587 | 587 | |
588 | - if ( $sent ) { |
|
589 | - $note = __( 'Invoice has been emailed to the user.', 'invoicing' ); |
|
588 | + if ($sent) { |
|
589 | + $note = __('Invoice has been emailed to the user.', 'invoicing'); |
|
590 | 590 | } else { |
591 | - $note = __( 'Fail to send invoice to the user!', 'invoicing' ); |
|
591 | + $note = __('Fail to send invoice to the user!', 'invoicing'); |
|
592 | 592 | } |
593 | - $invoice->add_note( $note, '', '', true ); // Add private note. |
|
593 | + $invoice->add_note($note, '', '', true); // Add private note. |
|
594 | 594 | |
595 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
596 | - $recipient = wpinv_get_admin_email(); |
|
597 | - $subject .= ' - ADMIN BCC COPY'; |
|
598 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
595 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
596 | + $recipient = wpinv_get_admin_email(); |
|
597 | + $subject .= ' - ADMIN BCC COPY'; |
|
598 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | return $sent; |
602 | 602 | } |
603 | 603 | |
604 | -function wpinv_user_note_notification( $invoice_id, $args = array() ) { |
|
604 | +function wpinv_user_note_notification($invoice_id, $args = array()) { |
|
605 | 605 | global $wpinv_email_search, $wpinv_email_replace; |
606 | 606 | |
607 | 607 | $email_type = 'user_note'; |
608 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
608 | + if (!wpinv_email_is_enabled($email_type)) { |
|
609 | 609 | return false; |
610 | 610 | } |
611 | 611 | |
612 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
613 | - if ( empty( $invoice ) ) { |
|
612 | + $invoice = wpinv_get_invoice($invoice_id); |
|
613 | + if (empty($invoice)) { |
|
614 | 614 | return false; |
615 | 615 | } |
616 | 616 | |
617 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
618 | - if ( !is_email( $recipient ) ) { |
|
617 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
618 | + if (!is_email($recipient)) { |
|
619 | 619 | return false; |
620 | 620 | } |
621 | 621 | |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | 'user_note' => '' |
624 | 624 | ); |
625 | 625 | |
626 | - $args = wp_parse_args( $args, $defaults ); |
|
626 | + $args = wp_parse_args($args, $defaults); |
|
627 | 627 | |
628 | 628 | $search = array(); |
629 | 629 | $search['invoice_number'] = '{invoice_number}'; |
@@ -642,46 +642,46 @@ discard block |
||
642 | 642 | $wpinv_email_search = $search; |
643 | 643 | $wpinv_email_replace = $replace; |
644 | 644 | |
645 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
646 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
647 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
648 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
645 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
646 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
647 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
648 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
649 | 649 | |
650 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
650 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
651 | 651 | 'invoice' => $invoice, |
652 | 652 | 'email_type' => $email_type, |
653 | 653 | 'email_heading' => $email_heading, |
654 | 654 | 'sent_to_admin' => false, |
655 | 655 | 'plain_text' => false, |
656 | 656 | 'customer_note' => $args['user_note'] |
657 | - ) ); |
|
657 | + )); |
|
658 | 658 | |
659 | - $content = wpinv_email_format_text( $content ); |
|
659 | + $content = wpinv_email_format_text($content); |
|
660 | 660 | |
661 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
661 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
662 | 662 | |
663 | 663 | return $sent; |
664 | 664 | } |
665 | 665 | |
666 | 666 | function wpinv_mail_get_from_address() { |
667 | - $from_address = apply_filters( 'wpinv_mail_from_address', wpinv_get_option( 'email_from' ) ); |
|
668 | - return sanitize_email( $from_address ); |
|
667 | + $from_address = apply_filters('wpinv_mail_from_address', wpinv_get_option('email_from')); |
|
668 | + return sanitize_email($from_address); |
|
669 | 669 | } |
670 | 670 | |
671 | 671 | function wpinv_mail_get_from_name() { |
672 | - $from_name = apply_filters( 'wpinv_mail_from_name', wpinv_get_option( 'email_from_name' ) ); |
|
673 | - return wp_specialchars_decode( esc_html( $from_name ), ENT_QUOTES ); |
|
672 | + $from_name = apply_filters('wpinv_mail_from_name', wpinv_get_option('email_from_name')); |
|
673 | + return wp_specialchars_decode(esc_html($from_name), ENT_QUOTES); |
|
674 | 674 | } |
675 | 675 | |
676 | -function wpinv_mail_admin_bcc_active( $mail_type = '' ) { |
|
677 | - $active = apply_filters( 'wpinv_mail_admin_bcc_active', wpinv_get_option( 'email_' . $mail_type . '_admin_bcc' ) ); |
|
678 | - return ( $active ? true : false ); |
|
676 | +function wpinv_mail_admin_bcc_active($mail_type = '') { |
|
677 | + $active = apply_filters('wpinv_mail_admin_bcc_active', wpinv_get_option('email_' . $mail_type . '_admin_bcc')); |
|
678 | + return ($active ? true : false); |
|
679 | 679 | } |
680 | 680 | |
681 | -function wpinv_mail_get_content_type( $content_type = 'text/html', $email_type = 'html' ) { |
|
682 | - $email_type = apply_filters( 'wpinv_mail_content_type', $email_type ); |
|
681 | +function wpinv_mail_get_content_type($content_type = 'text/html', $email_type = 'html') { |
|
682 | + $email_type = apply_filters('wpinv_mail_content_type', $email_type); |
|
683 | 683 | |
684 | - switch ( $email_type ) { |
|
684 | + switch ($email_type) { |
|
685 | 685 | case 'html' : |
686 | 686 | $content_type = 'text/html'; |
687 | 687 | break; |
@@ -696,35 +696,35 @@ discard block |
||
696 | 696 | return $content_type; |
697 | 697 | } |
698 | 698 | |
699 | -function wpinv_mail_send( $to, $subject, $message, $headers, $attachments ) { |
|
700 | - add_filter( 'wp_mail_from', 'wpinv_mail_get_from_address' ); |
|
701 | - add_filter( 'wp_mail_from_name', 'wpinv_mail_get_from_name' ); |
|
702 | - add_filter( 'wp_mail_content_type', 'wpinv_mail_get_content_type' ); |
|
699 | +function wpinv_mail_send($to, $subject, $message, $headers, $attachments) { |
|
700 | + add_filter('wp_mail_from', 'wpinv_mail_get_from_address'); |
|
701 | + add_filter('wp_mail_from_name', 'wpinv_mail_get_from_name'); |
|
702 | + add_filter('wp_mail_content_type', 'wpinv_mail_get_content_type'); |
|
703 | 703 | |
704 | - $message = wpinv_email_style_body( $message ); |
|
705 | - $message = apply_filters( 'wpinv_mail_content', $message ); |
|
704 | + $message = wpinv_email_style_body($message); |
|
705 | + $message = apply_filters('wpinv_mail_content', $message); |
|
706 | 706 | |
707 | - $sent = wp_mail( $to, $subject, $message, $headers, $attachments ); |
|
707 | + $sent = wp_mail($to, $subject, $message, $headers, $attachments); |
|
708 | 708 | |
709 | - if ( !$sent ) { |
|
710 | - $log_message = wp_sprintf( __( "\nTime: %s\nTo: %s\nSubject: %s\n", 'invoicing' ), date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), ( is_array( $to ) ? implode( ', ', $to ) : $to ), $subject ); |
|
711 | - wpinv_error_log( $log_message, __( "Email from Invoicing plugin failed to send", 'invoicing' ), __FILE__, __LINE__ ); |
|
709 | + if (!$sent) { |
|
710 | + $log_message = wp_sprintf(__("\nTime: %s\nTo: %s\nSubject: %s\n", 'invoicing'), date_i18n('F j Y H:i:s', current_time('timestamp')), (is_array($to) ? implode(', ', $to) : $to), $subject); |
|
711 | + wpinv_error_log($log_message, __("Email from Invoicing plugin failed to send", 'invoicing'), __FILE__, __LINE__); |
|
712 | 712 | } |
713 | 713 | |
714 | - remove_filter( 'wp_mail_from', 'wpinv_mail_get_from_address' ); |
|
715 | - remove_filter( 'wp_mail_from_name', 'wpinv_mail_get_from_name' ); |
|
716 | - remove_filter( 'wp_mail_content_type', 'wpinv_mail_get_content_type' ); |
|
714 | + remove_filter('wp_mail_from', 'wpinv_mail_get_from_address'); |
|
715 | + remove_filter('wp_mail_from_name', 'wpinv_mail_get_from_name'); |
|
716 | + remove_filter('wp_mail_content_type', 'wpinv_mail_get_content_type'); |
|
717 | 717 | |
718 | 718 | return $sent; |
719 | 719 | } |
720 | 720 | |
721 | 721 | function wpinv_get_emails() { |
722 | 722 | $overdue_days_options = array(); |
723 | - $overdue_days_options[0] = __( 'On the Due Date', 'invoicing' ); |
|
724 | - $overdue_days_options[1] = __( '1 day after Due Date', 'invoicing' ); |
|
723 | + $overdue_days_options[0] = __('On the Due Date', 'invoicing'); |
|
724 | + $overdue_days_options[1] = __('1 day after Due Date', 'invoicing'); |
|
725 | 725 | |
726 | - for ( $i = 2; $i <= 10; $i++ ) { |
|
727 | - $overdue_days_options[$i] = wp_sprintf( __( '%d days after Due Date', 'invoicing' ), $i ); |
|
726 | + for ($i = 2; $i <= 10; $i++) { |
|
727 | + $overdue_days_options[$i] = wp_sprintf(__('%d days after Due Date', 'invoicing'), $i); |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | // Default, built-in gateways |
@@ -732,130 +732,130 @@ discard block |
||
732 | 732 | 'new_invoice' => array( |
733 | 733 | 'email_new_invoice_header' => array( |
734 | 734 | 'id' => 'email_new_invoice_header', |
735 | - 'name' => '<h3>' . __( 'New Invoice', 'invoicing' ) . '</h3>', |
|
736 | - 'desc' => __( 'New invoice emails are sent to admin when a new invoice is received.', 'invoicing' ), |
|
735 | + 'name' => '<h3>' . __('New Invoice', 'invoicing') . '</h3>', |
|
736 | + 'desc' => __('New invoice emails are sent to admin when a new invoice is received.', 'invoicing'), |
|
737 | 737 | 'type' => 'header', |
738 | 738 | ), |
739 | 739 | 'email_new_invoice_active' => array( |
740 | 740 | 'id' => 'email_new_invoice_active', |
741 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
742 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
741 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
742 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
743 | 743 | 'type' => 'checkbox', |
744 | 744 | 'std' => 1 |
745 | 745 | ), |
746 | 746 | 'email_new_invoice_subject' => array( |
747 | 747 | 'id' => 'email_new_invoice_subject', |
748 | - 'name' => __( 'Subject', 'invoicing' ), |
|
749 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
748 | + 'name' => __('Subject', 'invoicing'), |
|
749 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
750 | 750 | 'type' => 'text', |
751 | - 'std' => __( '[{site_title}] New payment invoice ({invoice_number}) - {invoice_date}', 'invoicing' ), |
|
751 | + 'std' => __('[{site_title}] New payment invoice ({invoice_number}) - {invoice_date}', 'invoicing'), |
|
752 | 752 | 'size' => 'large' |
753 | 753 | ), |
754 | 754 | 'email_new_invoice_heading' => array( |
755 | 755 | 'id' => 'email_new_invoice_heading', |
756 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
757 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
756 | + 'name' => __('Email Heading', 'invoicing'), |
|
757 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
758 | 758 | 'type' => 'text', |
759 | - 'std' => __( 'New payment invoice', 'invoicing' ), |
|
759 | + 'std' => __('New payment invoice', 'invoicing'), |
|
760 | 760 | 'size' => 'large' |
761 | 761 | ), |
762 | 762 | ), |
763 | 763 | 'cancelled_invoice' => array( |
764 | 764 | 'email_cancelled_invoice_header' => array( |
765 | 765 | 'id' => 'email_cancelled_invoice_header', |
766 | - 'name' => '<h3>' . __( 'Cancelled Invoice', 'invoicing' ) . '</h3>', |
|
767 | - 'desc' => __( 'Cancelled invoice emails are sent to admin when invoices have been marked cancelled.', 'invoicing' ), |
|
766 | + 'name' => '<h3>' . __('Cancelled Invoice', 'invoicing') . '</h3>', |
|
767 | + 'desc' => __('Cancelled invoice emails are sent to admin when invoices have been marked cancelled.', 'invoicing'), |
|
768 | 768 | 'type' => 'header', |
769 | 769 | ), |
770 | 770 | 'email_cancelled_invoice_active' => array( |
771 | 771 | 'id' => 'email_cancelled_invoice_active', |
772 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
773 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
772 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
773 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
774 | 774 | 'type' => 'checkbox', |
775 | 775 | 'std' => 1 |
776 | 776 | ), |
777 | 777 | 'email_cancelled_invoice_subject' => array( |
778 | 778 | 'id' => 'email_cancelled_invoice_subject', |
779 | - 'name' => __( 'Subject', 'invoicing' ), |
|
780 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
779 | + 'name' => __('Subject', 'invoicing'), |
|
780 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
781 | 781 | 'type' => 'text', |
782 | - 'std' => __( '[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing' ), |
|
782 | + 'std' => __('[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing'), |
|
783 | 783 | 'size' => 'large' |
784 | 784 | ), |
785 | 785 | 'email_cancelled_invoice_heading' => array( |
786 | 786 | 'id' => 'email_cancelled_invoice_heading', |
787 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
788 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
787 | + 'name' => __('Email Heading', 'invoicing'), |
|
788 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
789 | 789 | 'type' => 'text', |
790 | - 'std' => __( 'Cancelled invoice', 'invoicing' ), |
|
790 | + 'std' => __('Cancelled invoice', 'invoicing'), |
|
791 | 791 | 'size' => 'large' |
792 | 792 | ), |
793 | 793 | ), |
794 | 794 | 'failed_invoice' => array( |
795 | 795 | 'email_failed_invoice_header' => array( |
796 | 796 | 'id' => 'email_failed_invoice_header', |
797 | - 'name' => '<h3>' . __( 'Failed Invoice', 'invoicing' ) . '</h3>', |
|
798 | - 'desc' => __( 'Failed invoice emails are sent to admin when invoices have been marked failed (if they were previously processing or on-hold).', 'invoicing' ), |
|
797 | + 'name' => '<h3>' . __('Failed Invoice', 'invoicing') . '</h3>', |
|
798 | + 'desc' => __('Failed invoice emails are sent to admin when invoices have been marked failed (if they were previously processing or on-hold).', 'invoicing'), |
|
799 | 799 | 'type' => 'header', |
800 | 800 | ), |
801 | 801 | 'email_failed_invoice_active' => array( |
802 | 802 | 'id' => 'email_failed_invoice_active', |
803 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
804 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
803 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
804 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
805 | 805 | 'type' => 'checkbox', |
806 | 806 | 'std' => 1 |
807 | 807 | ), |
808 | 808 | 'email_failed_invoice_subject' => array( |
809 | 809 | 'id' => 'email_failed_invoice_subject', |
810 | - 'name' => __( 'Subject', 'invoicing' ), |
|
811 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
810 | + 'name' => __('Subject', 'invoicing'), |
|
811 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
812 | 812 | 'type' => 'text', |
813 | - 'std' => __( '[{site_title}] Failed invoice ({invoice_number})', 'invoicing' ), |
|
813 | + 'std' => __('[{site_title}] Failed invoice ({invoice_number})', 'invoicing'), |
|
814 | 814 | 'size' => 'large' |
815 | 815 | ), |
816 | 816 | 'email_failed_invoice_heading' => array( |
817 | 817 | 'id' => 'email_failed_invoice_heading', |
818 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
819 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
818 | + 'name' => __('Email Heading', 'invoicing'), |
|
819 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
820 | 820 | 'type' => 'text', |
821 | - 'std' => __( 'Failed invoice', 'invoicing' ), |
|
821 | + 'std' => __('Failed invoice', 'invoicing'), |
|
822 | 822 | 'size' => 'large' |
823 | 823 | ) |
824 | 824 | ), |
825 | 825 | 'onhold_invoice' => array( |
826 | 826 | 'email_onhold_invoice_header' => array( |
827 | 827 | 'id' => 'email_onhold_invoice_header', |
828 | - 'name' => '<h3>' . __( 'On Hold Invoice', 'invoicing' ) . '</h3>', |
|
829 | - 'desc' => __( 'This is an invoice notification sent to users containing invoice details after an invoice is placed on-hold.', 'invoicing' ), |
|
828 | + 'name' => '<h3>' . __('On Hold Invoice', 'invoicing') . '</h3>', |
|
829 | + 'desc' => __('This is an invoice notification sent to users containing invoice details after an invoice is placed on-hold.', 'invoicing'), |
|
830 | 830 | 'type' => 'header', |
831 | 831 | ), |
832 | 832 | 'email_onhold_invoice_active' => array( |
833 | 833 | 'id' => 'email_onhold_invoice_active', |
834 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
835 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
834 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
835 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
836 | 836 | 'type' => 'checkbox', |
837 | 837 | 'std' => 1 |
838 | 838 | ), |
839 | 839 | 'email_onhold_invoice_subject' => array( |
840 | 840 | 'id' => 'email_onhold_invoice_subject', |
841 | - 'name' => __( 'Subject', 'invoicing' ), |
|
842 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
841 | + 'name' => __('Subject', 'invoicing'), |
|
842 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
843 | 843 | 'type' => 'text', |
844 | - 'std' => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ), |
|
844 | + 'std' => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'), |
|
845 | 845 | 'size' => 'large' |
846 | 846 | ), |
847 | 847 | 'email_onhold_invoice_heading' => array( |
848 | 848 | 'id' => 'email_onhold_invoice_heading', |
849 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
850 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
849 | + 'name' => __('Email Heading', 'invoicing'), |
|
850 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
851 | 851 | 'type' => 'text', |
852 | - 'std' => __( 'Thank you for your invoice', 'invoicing' ), |
|
852 | + 'std' => __('Thank you for your invoice', 'invoicing'), |
|
853 | 853 | 'size' => 'large' |
854 | 854 | ), |
855 | 855 | 'email_onhold_invoice_admin_bcc' => array( |
856 | 856 | 'id' => 'email_onhold_invoice_admin_bcc', |
857 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
858 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
857 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
858 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
859 | 859 | 'type' => 'checkbox', |
860 | 860 | 'std' => 1 |
861 | 861 | ), |
@@ -863,37 +863,37 @@ discard block |
||
863 | 863 | 'processing_invoice' => array( |
864 | 864 | 'email_processing_invoice_header' => array( |
865 | 865 | 'id' => 'email_processing_invoice_header', |
866 | - 'name' => '<h3>' . __( 'Processing Invoice', 'invoicing' ) . '</h3>', |
|
867 | - 'desc' => __( 'This is an invoice notification sent to users containing invoice details after payment.', 'invoicing' ), |
|
866 | + 'name' => '<h3>' . __('Processing Invoice', 'invoicing') . '</h3>', |
|
867 | + 'desc' => __('This is an invoice notification sent to users containing invoice details after payment.', 'invoicing'), |
|
868 | 868 | 'type' => 'header', |
869 | 869 | ), |
870 | 870 | 'email_processing_invoice_active' => array( |
871 | 871 | 'id' => 'email_processing_invoice_active', |
872 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
873 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
872 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
873 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
874 | 874 | 'type' => 'checkbox', |
875 | 875 | 'std' => 1 |
876 | 876 | ), |
877 | 877 | 'email_processing_invoice_subject' => array( |
878 | 878 | 'id' => 'email_processing_invoice_subject', |
879 | - 'name' => __( 'Subject', 'invoicing' ), |
|
880 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
879 | + 'name' => __('Subject', 'invoicing'), |
|
880 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
881 | 881 | 'type' => 'text', |
882 | - 'std' => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ), |
|
882 | + 'std' => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'), |
|
883 | 883 | 'size' => 'large' |
884 | 884 | ), |
885 | 885 | 'email_processing_invoice_heading' => array( |
886 | 886 | 'id' => 'email_processing_invoice_heading', |
887 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
888 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
887 | + 'name' => __('Email Heading', 'invoicing'), |
|
888 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
889 | 889 | 'type' => 'text', |
890 | - 'std' => __( 'Thank you for your invoice', 'invoicing' ), |
|
890 | + 'std' => __('Thank you for your invoice', 'invoicing'), |
|
891 | 891 | 'size' => 'large' |
892 | 892 | ), |
893 | 893 | 'email_processing_invoice_admin_bcc' => array( |
894 | 894 | 'id' => 'email_processing_invoice_admin_bcc', |
895 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
896 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
895 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
896 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
897 | 897 | 'type' => 'checkbox', |
898 | 898 | 'std' => 1 |
899 | 899 | ), |
@@ -901,37 +901,37 @@ discard block |
||
901 | 901 | 'completed_invoice' => array( |
902 | 902 | 'email_completed_invoice_header' => array( |
903 | 903 | 'id' => 'email_completed_invoice_header', |
904 | - 'name' => '<h3>' . __( 'Paid Invoice', 'invoicing' ) . '</h3>', |
|
905 | - 'desc' => __( 'Invoice paid emails are sent to users when their invoices are marked paid and usually indicate that their payment has been done.', 'invoicing' ), |
|
904 | + 'name' => '<h3>' . __('Paid Invoice', 'invoicing') . '</h3>', |
|
905 | + 'desc' => __('Invoice paid emails are sent to users when their invoices are marked paid and usually indicate that their payment has been done.', 'invoicing'), |
|
906 | 906 | 'type' => 'header', |
907 | 907 | ), |
908 | 908 | 'email_completed_invoice_active' => array( |
909 | 909 | 'id' => 'email_completed_invoice_active', |
910 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
911 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
910 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
911 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
912 | 912 | 'type' => 'checkbox', |
913 | 913 | 'std' => 1 |
914 | 914 | ), |
915 | 915 | 'email_completed_invoice_subject' => array( |
916 | 916 | 'id' => 'email_completed_invoice_subject', |
917 | - 'name' => __( 'Subject', 'invoicing' ), |
|
918 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
917 | + 'name' => __('Subject', 'invoicing'), |
|
918 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
919 | 919 | 'type' => 'text', |
920 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing' ), |
|
920 | + 'std' => __('[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing'), |
|
921 | 921 | 'size' => 'large' |
922 | 922 | ), |
923 | 923 | 'email_completed_invoice_heading' => array( |
924 | 924 | 'id' => 'email_completed_invoice_heading', |
925 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
926 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
925 | + 'name' => __('Email Heading', 'invoicing'), |
|
926 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
927 | 927 | 'type' => 'text', |
928 | - 'std' => __( 'Your invoice has been paid', 'invoicing' ), |
|
928 | + 'std' => __('Your invoice has been paid', 'invoicing'), |
|
929 | 929 | 'size' => 'large' |
930 | 930 | ), |
931 | 931 | 'email_completed_invoice_admin_bcc' => array( |
932 | 932 | 'id' => 'email_completed_invoice_admin_bcc', |
933 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
934 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
933 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
934 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
935 | 935 | 'type' => 'checkbox', |
936 | 936 | ), |
937 | 937 | 'std' => 1 |
@@ -939,37 +939,37 @@ discard block |
||
939 | 939 | 'refunded_invoice' => array( |
940 | 940 | 'email_refunded_invoice_header' => array( |
941 | 941 | 'id' => 'email_refunded_invoice_header', |
942 | - 'name' => '<h3>' . __( 'Refunded Invoice', 'invoicing' ) . '</h3>', |
|
943 | - 'desc' => __( 'Invoice refunded emails are sent to users when their invoices are marked refunded.', 'invoicing' ), |
|
942 | + 'name' => '<h3>' . __('Refunded Invoice', 'invoicing') . '</h3>', |
|
943 | + 'desc' => __('Invoice refunded emails are sent to users when their invoices are marked refunded.', 'invoicing'), |
|
944 | 944 | 'type' => 'header', |
945 | 945 | ), |
946 | 946 | 'email_refunded_invoice_active' => array( |
947 | 947 | 'id' => 'email_refunded_invoice_active', |
948 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
949 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
948 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
949 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
950 | 950 | 'type' => 'checkbox', |
951 | 951 | 'std' => 1 |
952 | 952 | ), |
953 | 953 | 'email_refunded_invoice_subject' => array( |
954 | 954 | 'id' => 'email_refunded_invoice_subject', |
955 | - 'name' => __( 'Subject', 'invoicing' ), |
|
956 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
955 | + 'name' => __('Subject', 'invoicing'), |
|
956 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
957 | 957 | 'type' => 'text', |
958 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing' ), |
|
958 | + 'std' => __('[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing'), |
|
959 | 959 | 'size' => 'large' |
960 | 960 | ), |
961 | 961 | 'email_refunded_invoice_heading' => array( |
962 | 962 | 'id' => 'email_refunded_invoice_heading', |
963 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
964 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
963 | + 'name' => __('Email Heading', 'invoicing'), |
|
964 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
965 | 965 | 'type' => 'text', |
966 | - 'std' => __( 'Your invoice has been refunded', 'invoicing' ), |
|
966 | + 'std' => __('Your invoice has been refunded', 'invoicing'), |
|
967 | 967 | 'size' => 'large' |
968 | 968 | ), |
969 | 969 | 'email_refunded_invoice_admin_bcc' => array( |
970 | 970 | 'id' => 'email_refunded_invoice_admin_bcc', |
971 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
972 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
971 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
972 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
973 | 973 | 'type' => 'checkbox', |
974 | 974 | 'std' => 1 |
975 | 975 | ), |
@@ -977,37 +977,37 @@ discard block |
||
977 | 977 | 'user_invoice' => array( |
978 | 978 | 'email_user_invoice_header' => array( |
979 | 979 | 'id' => 'email_user_invoice_header', |
980 | - 'name' => '<h3>' . __( 'Customer Invoice', 'invoicing' ) . '</h3>', |
|
981 | - 'desc' => __( 'Customer invoice emails can be sent to customers containing their invoice information and payment links.', 'invoicing' ), |
|
980 | + 'name' => '<h3>' . __('Customer Invoice', 'invoicing') . '</h3>', |
|
981 | + 'desc' => __('Customer invoice emails can be sent to customers containing their invoice information and payment links.', 'invoicing'), |
|
982 | 982 | 'type' => 'header', |
983 | 983 | ), |
984 | 984 | 'email_user_invoice_active' => array( |
985 | 985 | 'id' => 'email_user_invoice_active', |
986 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
987 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
986 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
987 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
988 | 988 | 'type' => 'checkbox', |
989 | 989 | 'std' => 1 |
990 | 990 | ), |
991 | 991 | 'email_user_invoice_subject' => array( |
992 | 992 | 'id' => 'email_user_invoice_subject', |
993 | - 'name' => __( 'Subject', 'invoicing' ), |
|
994 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
993 | + 'name' => __('Subject', 'invoicing'), |
|
994 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
995 | 995 | 'type' => 'text', |
996 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date}', 'invoicing' ), |
|
996 | + 'std' => __('[{site_title}] Your invoice from {invoice_date}', 'invoicing'), |
|
997 | 997 | 'size' => 'large' |
998 | 998 | ), |
999 | 999 | 'email_user_invoice_heading' => array( |
1000 | 1000 | 'id' => 'email_user_invoice_heading', |
1001 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
1002 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
1001 | + 'name' => __('Email Heading', 'invoicing'), |
|
1002 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
1003 | 1003 | 'type' => 'text', |
1004 | - 'std' => __( 'Your invoice {invoice_number} details', 'invoicing' ), |
|
1004 | + 'std' => __('Your invoice {invoice_number} details', 'invoicing'), |
|
1005 | 1005 | 'size' => 'large' |
1006 | 1006 | ), |
1007 | 1007 | 'email_user_invoice_admin_bcc' => array( |
1008 | 1008 | 'id' => 'email_user_invoice_admin_bcc', |
1009 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
1010 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
1009 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
1010 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
1011 | 1011 | 'type' => 'checkbox', |
1012 | 1012 | 'std' => 1 |
1013 | 1013 | ), |
@@ -1015,177 +1015,177 @@ discard block |
||
1015 | 1015 | 'user_note' => array( |
1016 | 1016 | 'email_user_note_header' => array( |
1017 | 1017 | 'id' => 'email_user_note_header', |
1018 | - 'name' => '<h3>' . __( 'Customer Note', 'invoicing' ) . '</h3>', |
|
1019 | - 'desc' => __( 'Customer note emails are sent when you add a note to an invoice.', 'invoicing' ), |
|
1018 | + 'name' => '<h3>' . __('Customer Note', 'invoicing') . '</h3>', |
|
1019 | + 'desc' => __('Customer note emails are sent when you add a note to an invoice.', 'invoicing'), |
|
1020 | 1020 | 'type' => 'header', |
1021 | 1021 | ), |
1022 | 1022 | 'email_user_note_active' => array( |
1023 | 1023 | 'id' => 'email_user_note_active', |
1024 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
1025 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
1024 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
1025 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
1026 | 1026 | 'type' => 'checkbox', |
1027 | 1027 | 'std' => 1 |
1028 | 1028 | ), |
1029 | 1029 | 'email_user_note_subject' => array( |
1030 | 1030 | 'id' => 'email_user_note_subject', |
1031 | - 'name' => __( 'Subject', 'invoicing' ), |
|
1032 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
1031 | + 'name' => __('Subject', 'invoicing'), |
|
1032 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
1033 | 1033 | 'type' => 'text', |
1034 | - 'std' => __( '[{site_title}] Note added to your invoice #{invoice_number} from {invoice_date}', 'invoicing' ), |
|
1034 | + 'std' => __('[{site_title}] Note added to your invoice #{invoice_number} from {invoice_date}', 'invoicing'), |
|
1035 | 1035 | 'size' => 'large' |
1036 | 1036 | ), |
1037 | 1037 | 'email_user_note_heading' => array( |
1038 | 1038 | 'id' => 'email_user_note_heading', |
1039 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
1040 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
1039 | + 'name' => __('Email Heading', 'invoicing'), |
|
1040 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
1041 | 1041 | 'type' => 'text', |
1042 | - 'std' => __( 'A note has been added to your invoice', 'invoicing' ), |
|
1042 | + 'std' => __('A note has been added to your invoice', 'invoicing'), |
|
1043 | 1043 | 'size' => 'large' |
1044 | 1044 | ), |
1045 | 1045 | ), |
1046 | 1046 | 'overdue' => array( |
1047 | 1047 | 'email_overdue_header' => array( |
1048 | 1048 | 'id' => 'email_overdue_header', |
1049 | - 'name' => '<h3>' . __( 'Payment Reminder', 'invoicing' ) . '</h3>', |
|
1050 | - 'desc' => __( 'Payment reminder emails are sent to user automatically.', 'invoicing' ), |
|
1049 | + 'name' => '<h3>' . __('Payment Reminder', 'invoicing') . '</h3>', |
|
1050 | + 'desc' => __('Payment reminder emails are sent to user automatically.', 'invoicing'), |
|
1051 | 1051 | 'type' => 'header', |
1052 | 1052 | ), |
1053 | 1053 | 'email_overdue_active' => array( |
1054 | 1054 | 'id' => 'email_overdue_active', |
1055 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
1056 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
1055 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
1056 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
1057 | 1057 | 'type' => 'checkbox', |
1058 | 1058 | 'std' => 1 |
1059 | 1059 | ), |
1060 | 1060 | 'email_due_reminder_days' => array( |
1061 | 1061 | 'id' => 'email_due_reminder_days', |
1062 | - 'name' => __( 'When to Send', 'sliced-invoices' ), |
|
1063 | - 'desc' => __( 'Check when you would like payment reminders sent out.', 'invoicing' ), |
|
1062 | + 'name' => __('When to Send', 'sliced-invoices'), |
|
1063 | + 'desc' => __('Check when you would like payment reminders sent out.', 'invoicing'), |
|
1064 | 1064 | 'default' => '', |
1065 | 1065 | 'type' => 'multicheck', |
1066 | 1066 | 'options' => $overdue_days_options, |
1067 | 1067 | ), |
1068 | 1068 | 'email_overdue_subject' => array( |
1069 | 1069 | 'id' => 'email_overdue_subject', |
1070 | - 'name' => __( 'Subject', 'invoicing' ), |
|
1071 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
1070 | + 'name' => __('Subject', 'invoicing'), |
|
1071 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
1072 | 1072 | 'type' => 'text', |
1073 | - 'std' => __( '[{site_title}] Payment Reminder', 'invoicing' ), |
|
1073 | + 'std' => __('[{site_title}] Payment Reminder', 'invoicing'), |
|
1074 | 1074 | 'size' => 'large' |
1075 | 1075 | ), |
1076 | 1076 | 'email_overdue_heading' => array( |
1077 | 1077 | 'id' => 'email_overdue_heading', |
1078 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
1079 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
1078 | + 'name' => __('Email Heading', 'invoicing'), |
|
1079 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
1080 | 1080 | 'type' => 'text', |
1081 | - 'std' => __( 'Payment reminder for your invoice', 'invoicing' ), |
|
1081 | + 'std' => __('Payment reminder for your invoice', 'invoicing'), |
|
1082 | 1082 | 'size' => 'large' |
1083 | 1083 | ), |
1084 | 1084 | 'email_overdue_body' => array( |
1085 | 1085 | 'id' => 'email_overdue_body', |
1086 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
1087 | - 'desc' => __( 'The content of the email.', 'invoicing' ), |
|
1086 | + 'name' => __('Email Content', 'invoicing'), |
|
1087 | + 'desc' => __('The content of the email.', 'invoicing'), |
|
1088 | 1088 | 'type' => 'rich_editor', |
1089 | - 'std' => __( '<p>Hi {full_name},</p><p>This is just a friendly reminder your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To pay now for this invoice please use the following link: <a href="{invoice_pay_link}">Pay Now</a></p>', 'invoicing' ), |
|
1089 | + 'std' => __('<p>Hi {full_name},</p><p>This is just a friendly reminder your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To pay now for this invoice please use the following link: <a href="{invoice_pay_link}">Pay Now</a></p>', 'invoicing'), |
|
1090 | 1090 | 'class' => 'large', |
1091 | 1091 | 'size' => 10, |
1092 | 1092 | ), |
1093 | 1093 | ), |
1094 | 1094 | ); |
1095 | 1095 | |
1096 | - return apply_filters( 'wpinv_get_emails', $emails ); |
|
1096 | + return apply_filters('wpinv_get_emails', $emails); |
|
1097 | 1097 | } |
1098 | 1098 | |
1099 | -function wpinv_settings_emails( $settings = array() ) { |
|
1099 | +function wpinv_settings_emails($settings = array()) { |
|
1100 | 1100 | $emails = wpinv_get_emails(); |
1101 | 1101 | |
1102 | - if ( !empty( $emails ) ) { |
|
1103 | - foreach ( $emails as $key => $email ) { |
|
1102 | + if (!empty($emails)) { |
|
1103 | + foreach ($emails as $key => $email) { |
|
1104 | 1104 | $settings[$key] = $email; |
1105 | 1105 | } |
1106 | 1106 | } |
1107 | 1107 | |
1108 | - return apply_filters( 'wpinv_settings_get_emails', $settings ); |
|
1108 | + return apply_filters('wpinv_settings_get_emails', $settings); |
|
1109 | 1109 | } |
1110 | -add_filter( 'wpinv_settings_emails', 'wpinv_settings_emails', 10, 1 ); |
|
1110 | +add_filter('wpinv_settings_emails', 'wpinv_settings_emails', 10, 1); |
|
1111 | 1111 | |
1112 | -function wpinv_settings_sections_emails( $settings ) { |
|
1112 | +function wpinv_settings_sections_emails($settings) { |
|
1113 | 1113 | $emails = wpinv_get_emails(); |
1114 | 1114 | |
1115 | 1115 | if (!empty($emails)) { |
1116 | - foreach ($emails as $key => $email) { |
|
1117 | - $settings[$key] = !empty( $email['email_' . $key . '_header']['name'] ) ? strip_tags( $email['email_' . $key . '_header']['name'] ) : $key; |
|
1116 | + foreach ($emails as $key => $email) { |
|
1117 | + $settings[$key] = !empty($email['email_' . $key . '_header']['name']) ? strip_tags($email['email_' . $key . '_header']['name']) : $key; |
|
1118 | 1118 | } |
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | return $settings; |
1122 | 1122 | } |
1123 | -add_filter( 'wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1 ); |
|
1123 | +add_filter('wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1); |
|
1124 | 1124 | |
1125 | -function wpinv_email_is_enabled( $email_type ) { |
|
1125 | +function wpinv_email_is_enabled($email_type) { |
|
1126 | 1126 | $emails = wpinv_get_emails(); |
1127 | - $enabled = isset( $emails[$email_type] ) && wpinv_get_option( $email_type . '_active', 1 ) ? true : false; |
|
1127 | + $enabled = isset($emails[$email_type]) && wpinv_get_option($email_type . '_active', 1) ? true : false; |
|
1128 | 1128 | |
1129 | - return apply_filters( 'wpinv_email_is_enabled', $enabled, $email_type ); |
|
1129 | + return apply_filters('wpinv_email_is_enabled', $enabled, $email_type); |
|
1130 | 1130 | } |
1131 | 1131 | |
1132 | -function wpinv_email_get_recipient( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1133 | - switch ( $email_type ) { |
|
1132 | +function wpinv_email_get_recipient($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1133 | + switch ($email_type) { |
|
1134 | 1134 | case 'new_invoice': |
1135 | 1135 | case 'cancelled_invoice': |
1136 | 1136 | case 'failed_invoice': |
1137 | 1137 | $recipient = wpinv_get_admin_email(); |
1138 | 1138 | break; |
1139 | 1139 | default: |
1140 | - $invoice = !empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : NULL ); |
|
1141 | - $recipient = !empty( $invoice ) ? $invoice->get_email() : ''; |
|
1140 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : NULL); |
|
1141 | + $recipient = !empty($invoice) ? $invoice->get_email() : ''; |
|
1142 | 1142 | break; |
1143 | 1143 | } |
1144 | 1144 | |
1145 | - return apply_filters( 'wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice ); |
|
1145 | + return apply_filters('wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice); |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | -function wpinv_email_get_subject( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1149 | - $subject = wpinv_get_option( 'email_' . $email_type . '_subject' ); |
|
1148 | +function wpinv_email_get_subject($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1149 | + $subject = wpinv_get_option('email_' . $email_type . '_subject'); |
|
1150 | 1150 | |
1151 | - $subject = wpinv_email_format_text( $subject ); |
|
1151 | + $subject = wpinv_email_format_text($subject); |
|
1152 | 1152 | |
1153 | - return apply_filters( 'wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice ); |
|
1153 | + return apply_filters('wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice); |
|
1154 | 1154 | } |
1155 | 1155 | |
1156 | -function wpinv_email_get_heading( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1157 | - $email_heading = wpinv_get_option( 'email_' . $email_type . '_heading' ); |
|
1156 | +function wpinv_email_get_heading($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1157 | + $email_heading = wpinv_get_option('email_' . $email_type . '_heading'); |
|
1158 | 1158 | |
1159 | - $email_heading = wpinv_email_format_text( $email_heading ); |
|
1159 | + $email_heading = wpinv_email_format_text($email_heading); |
|
1160 | 1160 | |
1161 | - return apply_filters( 'wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice ); |
|
1161 | + return apply_filters('wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice); |
|
1162 | 1162 | } |
1163 | 1163 | |
1164 | -function wpinv_email_get_content( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1165 | - $content = wpinv_get_option( 'email_' . $email_type . '_body' ); |
|
1164 | +function wpinv_email_get_content($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1165 | + $content = wpinv_get_option('email_' . $email_type . '_body'); |
|
1166 | 1166 | |
1167 | - $content = wpinv_email_format_text( $content ); |
|
1167 | + $content = wpinv_email_format_text($content); |
|
1168 | 1168 | |
1169 | - return apply_filters( 'wpinv_email_content', $content, $email_type, $invoice_id, $invoice ); |
|
1169 | + return apply_filters('wpinv_email_content', $content, $email_type, $invoice_id, $invoice); |
|
1170 | 1170 | } |
1171 | 1171 | |
1172 | -function wpinv_email_get_headers( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1172 | +function wpinv_email_get_headers($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1173 | 1173 | $from_name = wpinv_mail_get_from_address(); |
1174 | 1174 | $from_email = wpinv_mail_get_from_address(); |
1175 | 1175 | |
1176 | - $invoice = !empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : NULL ); |
|
1176 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : NULL); |
|
1177 | 1177 | |
1178 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
1179 | - $headers .= "Reply-To: ". $from_email . "\r\n"; |
|
1178 | + $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <$from_email>\r\n"; |
|
1179 | + $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
1180 | 1180 | $headers .= "Content-Type: " . wpinv_mail_get_content_type() . "\r\n"; |
1181 | 1181 | |
1182 | - return apply_filters( 'wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice ); |
|
1182 | + return apply_filters('wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice); |
|
1183 | 1183 | } |
1184 | 1184 | |
1185 | -function wpinv_email_get_attachments( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1185 | +function wpinv_email_get_attachments($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1186 | 1186 | $attachments = array(); |
1187 | 1187 | |
1188 | - return apply_filters( 'wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice ); |
|
1188 | + return apply_filters('wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice); |
|
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | function wpinv_email_global_vars() { |
@@ -1202,73 +1202,73 @@ discard block |
||
1202 | 1202 | $replace['sitename'] = $blogname; |
1203 | 1203 | $replace['site-title'] = $blogname; |
1204 | 1204 | |
1205 | - return apply_filters( 'wpinv_email_global_vars', array( $search, $replace ) ); |
|
1205 | + return apply_filters('wpinv_email_global_vars', array($search, $replace)); |
|
1206 | 1206 | } |
1207 | 1207 | |
1208 | -function wpinv_email_format_text( $content ) { |
|
1208 | +function wpinv_email_format_text($content) { |
|
1209 | 1209 | global $wpinv_email_search, $wpinv_email_replace; |
1210 | 1210 | |
1211 | - if ( empty( $wpinv_email_search ) ) { |
|
1211 | + if (empty($wpinv_email_search)) { |
|
1212 | 1212 | $wpinv_email_search = array(); |
1213 | 1213 | } |
1214 | 1214 | |
1215 | - if ( empty( $wpinv_email_replace ) ) { |
|
1215 | + if (empty($wpinv_email_replace)) { |
|
1216 | 1216 | $wpinv_email_replace = array(); |
1217 | 1217 | } |
1218 | 1218 | |
1219 | - $wpinv_email_search = (array)apply_filters( 'wpinv_email_format_text_search', $wpinv_email_search ); |
|
1220 | - $wpinv_email_replace = (array)apply_filters( 'wpinv_email_format_text_replace', $wpinv_email_replace ); |
|
1219 | + $wpinv_email_search = (array)apply_filters('wpinv_email_format_text_search', $wpinv_email_search); |
|
1220 | + $wpinv_email_replace = (array)apply_filters('wpinv_email_format_text_replace', $wpinv_email_replace); |
|
1221 | 1221 | |
1222 | 1222 | $global_vars = wpinv_email_global_vars(); |
1223 | 1223 | |
1224 | - $search = array_merge( $global_vars[0], $wpinv_email_search ); |
|
1225 | - $replace = array_merge( $global_vars[1], $wpinv_email_replace ); |
|
1224 | + $search = array_merge($global_vars[0], $wpinv_email_search); |
|
1225 | + $replace = array_merge($global_vars[1], $wpinv_email_replace); |
|
1226 | 1226 | |
1227 | - if ( empty( $search ) || empty( $replace ) || !is_array( $search ) || !is_array( $replace ) ) { |
|
1227 | + if (empty($search) || empty($replace) || !is_array($search) || !is_array($replace)) { |
|
1228 | 1228 | return $content; |
1229 | 1229 | } |
1230 | 1230 | |
1231 | - return str_replace( $search, $replace, $content ); |
|
1231 | + return str_replace($search, $replace, $content); |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | -function wpinv_email_style_body( $content ) { |
|
1234 | +function wpinv_email_style_body($content) { |
|
1235 | 1235 | // make sure we only inline CSS for html emails |
1236 | - if ( in_array( wpinv_mail_get_content_type(), array( 'text/html', 'multipart/alternative' ) ) && class_exists( 'DOMDocument' ) ) { |
|
1236 | + if (in_array(wpinv_mail_get_content_type(), array('text/html', 'multipart/alternative')) && class_exists('DOMDocument')) { |
|
1237 | 1237 | ob_start(); |
1238 | - wpinv_get_template( 'emails/wpinv-email-styles.php' ); |
|
1239 | - $css = apply_filters( 'wpinv_email_styles', ob_get_clean() ); |
|
1238 | + wpinv_get_template('emails/wpinv-email-styles.php'); |
|
1239 | + $css = apply_filters('wpinv_email_styles', ob_get_clean()); |
|
1240 | 1240 | |
1241 | 1241 | // apply CSS styles inline for picky email clients |
1242 | 1242 | try { |
1243 | - $emogrifier = new Emogrifier( $content, $css ); |
|
1243 | + $emogrifier = new Emogrifier($content, $css); |
|
1244 | 1244 | $content = $emogrifier->emogrify(); |
1245 | - } catch ( Exception $e ) { |
|
1246 | - wpinv_error_log( $e->getMessage(), 'emogrifier' ); |
|
1245 | + } catch (Exception $e) { |
|
1246 | + wpinv_error_log($e->getMessage(), 'emogrifier'); |
|
1247 | 1247 | } |
1248 | 1248 | } |
1249 | 1249 | return $content; |
1250 | 1250 | } |
1251 | 1251 | |
1252 | -function wpinv_email_header( $email_heading = '', $invoice = array(), $email_type = '', $sent_to_admin = false ) { |
|
1253 | - wpinv_get_template( 'emails/wpinv-email-header.php', array( 'email_heading' => $email_heading, 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
1252 | +function wpinv_email_header($email_heading = '', $invoice = array(), $email_type = '', $sent_to_admin = false) { |
|
1253 | + wpinv_get_template('emails/wpinv-email-header.php', array('email_heading' => $email_heading, 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | /** |
1257 | 1257 | * Get the email footer. |
1258 | 1258 | */ |
1259 | -function wpinv_email_footer( $invoice = array(), $email_type = '', $sent_to_admin = false ) { |
|
1260 | - wpinv_get_template( 'emails/wpinv-email-footer.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
1259 | +function wpinv_email_footer($invoice = array(), $email_type = '', $sent_to_admin = false) { |
|
1260 | + wpinv_get_template('emails/wpinv-email-footer.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
1261 | 1261 | } |
1262 | 1262 | |
1263 | -function wpinv_email_wrap_message( $message ) { |
|
1263 | +function wpinv_email_wrap_message($message) { |
|
1264 | 1264 | // Buffer |
1265 | 1265 | ob_start(); |
1266 | 1266 | |
1267 | - do_action( 'wpinv_email_header' ); |
|
1267 | + do_action('wpinv_email_header'); |
|
1268 | 1268 | |
1269 | - echo wpautop( wptexturize( $message ) ); |
|
1269 | + echo wpautop(wptexturize($message)); |
|
1270 | 1270 | |
1271 | - do_action( 'wpinv_email_footer' ); |
|
1271 | + do_action('wpinv_email_footer'); |
|
1272 | 1272 | |
1273 | 1273 | // Get contents |
1274 | 1274 | $message = ob_get_clean(); |
@@ -1276,86 +1276,86 @@ discard block |
||
1276 | 1276 | return $message; |
1277 | 1277 | } |
1278 | 1278 | |
1279 | -function wpinv_email_invoice_details( $invoice, $email_type = '', $sent_to_admin = false ) { |
|
1280 | - wpinv_get_template( 'emails/wpinv-email-invoice-details.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
1279 | +function wpinv_email_invoice_details($invoice, $email_type = '', $sent_to_admin = false) { |
|
1280 | + wpinv_get_template('emails/wpinv-email-invoice-details.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
1281 | 1281 | } |
1282 | 1282 | |
1283 | -function wpinv_email_invoice_items( $invoice, $email_type = '', $sent_to_admin = false ) { |
|
1284 | - wpinv_get_template( 'emails/wpinv-email-invoice-items.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
1283 | +function wpinv_email_invoice_items($invoice, $email_type = '', $sent_to_admin = false) { |
|
1284 | + wpinv_get_template('emails/wpinv-email-invoice-items.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
1285 | 1285 | } |
1286 | 1286 | |
1287 | -function wpinv_email_billing_details( $invoice, $email_type = '', $sent_to_admin = false ) { |
|
1288 | - wpinv_get_template( 'emails/wpinv-email-billing-details.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
1287 | +function wpinv_email_billing_details($invoice, $email_type = '', $sent_to_admin = false) { |
|
1288 | + wpinv_get_template('emails/wpinv-email-billing-details.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
1289 | 1289 | } |
1290 | 1290 | |
1291 | -function wpinv_send_customer_invoice( $data = array() ) { |
|
1292 | - $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
|
1291 | +function wpinv_send_customer_invoice($data = array()) { |
|
1292 | + $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL; |
|
1293 | 1293 | |
1294 | - if ( empty( $invoice_id ) ) { |
|
1294 | + if (empty($invoice_id)) { |
|
1295 | 1295 | return; |
1296 | 1296 | } |
1297 | 1297 | |
1298 | - if ( !current_user_can( 'manage_options' ) ) { |
|
1299 | - wp_die( __( 'You do not have permission to send invoice notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
1298 | + if (!current_user_can('manage_options')) { |
|
1299 | + wp_die(__('You do not have permission to send invoice notification', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
1300 | 1300 | } |
1301 | 1301 | |
1302 | - $sent = wpinv_user_invoice_notification( $invoice_id ); |
|
1302 | + $sent = wpinv_user_invoice_notification($invoice_id); |
|
1303 | 1303 | |
1304 | 1304 | $status = $sent ? 'email_sent' : 'email_fail'; |
1305 | 1305 | |
1306 | - $redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) ); |
|
1307 | - wp_redirect( $redirect ); |
|
1306 | + $redirect = add_query_arg(array('wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false)); |
|
1307 | + wp_redirect($redirect); |
|
1308 | 1308 | exit; |
1309 | 1309 | } |
1310 | -add_action( 'wpinv_send_invoice', 'wpinv_send_customer_invoice' ); |
|
1310 | +add_action('wpinv_send_invoice', 'wpinv_send_customer_invoice'); |
|
1311 | 1311 | |
1312 | -function wpinv_send_overdue_reminder( $data = array() ) { |
|
1313 | - $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
|
1312 | +function wpinv_send_overdue_reminder($data = array()) { |
|
1313 | + $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL; |
|
1314 | 1314 | |
1315 | - if ( empty( $invoice_id ) ) { |
|
1315 | + if (empty($invoice_id)) { |
|
1316 | 1316 | return; |
1317 | 1317 | } |
1318 | 1318 | |
1319 | - if ( !current_user_can( 'manage_options' ) ) { |
|
1320 | - wp_die( __( 'You do not have permission to send reminder notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
1319 | + if (!current_user_can('manage_options')) { |
|
1320 | + wp_die(__('You do not have permission to send reminder notification', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
1321 | 1321 | } |
1322 | 1322 | |
1323 | - $sent = wpinv_send_payment_reminder_notification( $invoice_id ); |
|
1323 | + $sent = wpinv_send_payment_reminder_notification($invoice_id); |
|
1324 | 1324 | |
1325 | 1325 | $status = $sent ? 'email_sent' : 'email_fail'; |
1326 | 1326 | |
1327 | - $redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) ); |
|
1328 | - wp_redirect( $redirect ); |
|
1327 | + $redirect = add_query_arg(array('wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false)); |
|
1328 | + wp_redirect($redirect); |
|
1329 | 1329 | exit; |
1330 | 1330 | } |
1331 | -add_action( 'wpinv_send_reminder', 'wpinv_send_overdue_reminder' ); |
|
1331 | +add_action('wpinv_send_reminder', 'wpinv_send_overdue_reminder'); |
|
1332 | 1332 | |
1333 | -function wpinv_send_customer_note_email( $data ) { |
|
1334 | - $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
|
1333 | +function wpinv_send_customer_note_email($data) { |
|
1334 | + $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL; |
|
1335 | 1335 | |
1336 | - if ( empty( $invoice_id ) ) { |
|
1336 | + if (empty($invoice_id)) { |
|
1337 | 1337 | return; |
1338 | 1338 | } |
1339 | 1339 | |
1340 | - $sent = wpinv_user_note_notification( $invoice_id, $data ); |
|
1340 | + $sent = wpinv_user_note_notification($invoice_id, $data); |
|
1341 | 1341 | } |
1342 | -add_action( 'wpinv_new_customer_note', 'wpinv_send_customer_note_email', 10, 1 ); |
|
1342 | +add_action('wpinv_new_customer_note', 'wpinv_send_customer_note_email', 10, 1); |
|
1343 | 1343 | |
1344 | -function wpinv_add_notes_to_invoice_email( $invoice, $email_type, $sent_to_admin ) { |
|
1345 | - if ( !empty( $invoice ) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes( $invoice->ID, true ) ) { |
|
1346 | - $date_format = get_option( 'date_format' ); |
|
1347 | - $time_format = get_option( 'time_format' ); |
|
1344 | +function wpinv_add_notes_to_invoice_email($invoice, $email_type, $sent_to_admin) { |
|
1345 | + if (!empty($invoice) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes($invoice->ID, true)) { |
|
1346 | + $date_format = get_option('date_format'); |
|
1347 | + $time_format = get_option('time_format'); |
|
1348 | 1348 | ?> |
1349 | 1349 | <div id="wpinv-email-notes"> |
1350 | - <h3 class="wpinv-notes-t"><?php echo apply_filters( 'wpinv_email_invoice_notes_title', __( 'Invoice Notes', 'invoicing' ) ); ?></h3> |
|
1350 | + <h3 class="wpinv-notes-t"><?php echo apply_filters('wpinv_email_invoice_notes_title', __('Invoice Notes', 'invoicing')); ?></h3> |
|
1351 | 1351 | <ol class="wpinv-notes-lists"> |
1352 | 1352 | <?php |
1353 | - foreach ( $invoice_notes as $note ) { |
|
1354 | - $note_time = strtotime( $note->comment_date ); |
|
1353 | + foreach ($invoice_notes as $note) { |
|
1354 | + $note_time = strtotime($note->comment_date); |
|
1355 | 1355 | ?> |
1356 | 1356 | <li class="comment wpinv-note"> |
1357 | - <p class="wpinv-note-date meta"><?php printf( __( '%2$s at %3$s', 'invoicing' ), $note->comment_author, date_i18n( $date_format, $note_time ), date_i18n( $time_format, $note_time ), $note_time ); ?></p> |
|
1358 | - <div class="wpinv-note-desc description"><?php echo wpautop( wptexturize( $note->comment_content ) ); ?></div> |
|
1357 | + <p class="wpinv-note-date meta"><?php printf(__('%2$s at %3$s', 'invoicing'), $note->comment_author, date_i18n($date_format, $note_time), date_i18n($time_format, $note_time), $note_time); ?></p> |
|
1358 | + <div class="wpinv-note-desc description"><?php echo wpautop(wptexturize($note->comment_content)); ?></div> |
|
1359 | 1359 | </li> |
1360 | 1360 | <?php |
1361 | 1361 | } |
@@ -1364,21 +1364,21 @@ discard block |
||
1364 | 1364 | <?php |
1365 | 1365 | } |
1366 | 1366 | } |
1367 | -add_action( 'wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3 ); |
|
1367 | +add_action('wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3); |
|
1368 | 1368 | |
1369 | 1369 | function wpinv_email_payment_reminders() { |
1370 | 1370 | global $wpi_auto_reminder; |
1371 | - if ( !wpinv_get_option( 'email_overdue_active' ) ) { |
|
1371 | + if (!wpinv_get_option('email_overdue_active')) { |
|
1372 | 1372 | return; |
1373 | 1373 | } |
1374 | 1374 | |
1375 | - if ( $reminder_days = wpinv_get_option( 'email_due_reminder_days' ) ) { |
|
1376 | - $reminder_days = is_array( $reminder_days ) ? array_values( $reminder_days ) : ''; |
|
1375 | + if ($reminder_days = wpinv_get_option('email_due_reminder_days')) { |
|
1376 | + $reminder_days = is_array($reminder_days) ? array_values($reminder_days) : ''; |
|
1377 | 1377 | |
1378 | - if ( empty( $reminder_days ) ) { |
|
1378 | + if (empty($reminder_days)) { |
|
1379 | 1379 | return; |
1380 | 1380 | } |
1381 | - $reminder_days = array_unique( array_map( 'absint', $reminder_days ) ); |
|
1381 | + $reminder_days = array_unique(array_map('absint', $reminder_days)); |
|
1382 | 1382 | |
1383 | 1383 | $args = array( |
1384 | 1384 | 'post_type' => 'wpi_invoice', |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | 'meta_query' => array( |
1389 | 1389 | array( |
1390 | 1390 | 'key' => '_wpinv_due_date', |
1391 | - 'value' => array( '', 'none' ), |
|
1391 | + 'value' => array('', 'none'), |
|
1392 | 1392 | 'compare' => 'NOT IN', |
1393 | 1393 | ) |
1394 | 1394 | ), |
@@ -1397,64 +1397,64 @@ discard block |
||
1397 | 1397 | 'order' => 'ASC', |
1398 | 1398 | ); |
1399 | 1399 | |
1400 | - $invoices = get_posts( $args ); |
|
1400 | + $invoices = get_posts($args); |
|
1401 | 1401 | |
1402 | - if ( empty( $invoices ) ) { |
|
1402 | + if (empty($invoices)) { |
|
1403 | 1403 | return; |
1404 | 1404 | } |
1405 | 1405 | |
1406 | - $date_to_send = array(); |
|
1406 | + $date_to_send = array(); |
|
1407 | 1407 | |
1408 | - foreach ( $invoices as $id ) { |
|
1409 | - $due_date = get_post_meta( $id, '_wpinv_due_date', true ); |
|
1408 | + foreach ($invoices as $id) { |
|
1409 | + $due_date = get_post_meta($id, '_wpinv_due_date', true); |
|
1410 | 1410 | |
1411 | - foreach ( $reminder_days as $key => $days ) { |
|
1412 | - if ( $days !== '' ) { |
|
1413 | - $date_to_send[$id][] = date_i18n( 'Y-m-d', strtotime( $due_date ) + ( $days * DAY_IN_SECONDS ) ); |
|
1411 | + foreach ($reminder_days as $key => $days) { |
|
1412 | + if ($days !== '') { |
|
1413 | + $date_to_send[$id][] = date_i18n('Y-m-d', strtotime($due_date) + ($days * DAY_IN_SECONDS)); |
|
1414 | 1414 | } |
1415 | 1415 | } |
1416 | 1416 | } |
1417 | 1417 | |
1418 | - $today = date_i18n( 'Y-m-d' ); |
|
1418 | + $today = date_i18n('Y-m-d'); |
|
1419 | 1419 | $wpi_auto_reminder = true; |
1420 | 1420 | |
1421 | - foreach ( $date_to_send as $id => $values ) { |
|
1422 | - if ( in_array( $today, $values ) ) { |
|
1423 | - $sent = get_post_meta( $id, '_wpinv_reminder_sent', true ); |
|
1421 | + foreach ($date_to_send as $id => $values) { |
|
1422 | + if (in_array($today, $values)) { |
|
1423 | + $sent = get_post_meta($id, '_wpinv_reminder_sent', true); |
|
1424 | 1424 | |
1425 | - if ( isset( $sent ) && !empty( $sent ) ) { |
|
1426 | - if ( !in_array( $today, $sent ) ) { |
|
1427 | - do_action( 'wpinv_send_payment_reminder_notification', $id ); |
|
1425 | + if (isset($sent) && !empty($sent)) { |
|
1426 | + if (!in_array($today, $sent)) { |
|
1427 | + do_action('wpinv_send_payment_reminder_notification', $id); |
|
1428 | 1428 | } |
1429 | 1429 | } else { |
1430 | - do_action( 'wpinv_send_payment_reminder_notification', $id ); |
|
1430 | + do_action('wpinv_send_payment_reminder_notification', $id); |
|
1431 | 1431 | } |
1432 | 1432 | } |
1433 | 1433 | } |
1434 | 1434 | |
1435 | - $wpi_auto_reminder = false; |
|
1435 | + $wpi_auto_reminder = false; |
|
1436 | 1436 | } |
1437 | 1437 | } |
1438 | 1438 | |
1439 | -function wpinv_send_payment_reminder_notification( $invoice_id ) { |
|
1439 | +function wpinv_send_payment_reminder_notification($invoice_id) { |
|
1440 | 1440 | global $wpinv_email_search, $wpinv_email_replace; |
1441 | 1441 | |
1442 | 1442 | $email_type = 'overdue'; |
1443 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
1443 | + if (!wpinv_email_is_enabled($email_type)) { |
|
1444 | 1444 | return false; |
1445 | 1445 | } |
1446 | 1446 | |
1447 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
1448 | - if ( empty( $invoice ) ) { |
|
1447 | + $invoice = wpinv_get_invoice($invoice_id); |
|
1448 | + if (empty($invoice)) { |
|
1449 | 1449 | return false; |
1450 | 1450 | } |
1451 | 1451 | |
1452 | - if ( !$invoice->needs_payment() ) { |
|
1452 | + if (!$invoice->needs_payment()) { |
|
1453 | 1453 | return false; |
1454 | 1454 | } |
1455 | 1455 | |
1456 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
1457 | - if ( !is_email( $recipient ) ) { |
|
1456 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
1457 | + if (!is_email($recipient)) { |
|
1458 | 1458 | return false; |
1459 | 1459 | } |
1460 | 1460 | |
@@ -1470,70 +1470,70 @@ discard block |
||
1470 | 1470 | $replace = array(); |
1471 | 1471 | $replace['full_name'] = $invoice->get_user_full_name(); |
1472 | 1472 | $replace['invoice_number'] = $invoice->get_number(); |
1473 | - $replace['invoice_due_date']= $invoice->get_due_date( true ); |
|
1474 | - $replace['invoice_total'] = $invoice->get_total( true ); |
|
1475 | - $replace['invoice_link'] = $invoice->get_view_url( true ); |
|
1476 | - $replace['invoice_pay_link']= $invoice->get_checkout_payment_url( false, true ); |
|
1477 | - $replace['is_was'] = strtotime( $invoice->get_due_date() ) < strtotime( date_i18n( 'Y-m-d' ) ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ); |
|
1473 | + $replace['invoice_due_date'] = $invoice->get_due_date(true); |
|
1474 | + $replace['invoice_total'] = $invoice->get_total(true); |
|
1475 | + $replace['invoice_link'] = $invoice->get_view_url(true); |
|
1476 | + $replace['invoice_pay_link'] = $invoice->get_checkout_payment_url(false, true); |
|
1477 | + $replace['is_was'] = strtotime($invoice->get_due_date()) < strtotime(date_i18n('Y-m-d')) ? __('was', 'invoicing') : __('is', 'invoicing'); |
|
1478 | 1478 | |
1479 | 1479 | $wpinv_email_search = $search; |
1480 | 1480 | $wpinv_email_replace = $replace; |
1481 | 1481 | |
1482 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
1483 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
1484 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
1485 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
1482 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
1483 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
1484 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
1485 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
1486 | 1486 | |
1487 | - $message_body = wpinv_email_get_content( $email_type, $invoice_id, $invoice ); |
|
1487 | + $message_body = wpinv_email_get_content($email_type, $invoice_id, $invoice); |
|
1488 | 1488 | |
1489 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
1489 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
1490 | 1490 | 'invoice' => $invoice, |
1491 | 1491 | 'email_type' => $email_type, |
1492 | 1492 | 'email_heading' => $email_heading, |
1493 | 1493 | 'sent_to_admin' => false, |
1494 | 1494 | 'plain_text' => false, |
1495 | 1495 | 'message_body' => $message_body |
1496 | - ) ); |
|
1496 | + )); |
|
1497 | 1497 | |
1498 | - $content = wpinv_email_format_text( $content ); |
|
1498 | + $content = wpinv_email_format_text($content); |
|
1499 | 1499 | |
1500 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
1501 | - if ( $sent ) { |
|
1502 | - do_action( 'wpinv_payment_reminder_sent', $invoice_id, $invoice ); |
|
1500 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
1501 | + if ($sent) { |
|
1502 | + do_action('wpinv_payment_reminder_sent', $invoice_id, $invoice); |
|
1503 | 1503 | } |
1504 | 1504 | |
1505 | 1505 | return $sent; |
1506 | 1506 | } |
1507 | -add_action( 'wpinv_send_payment_reminder_notification', 'wpinv_send_payment_reminder_notification', 10, 1 ); |
|
1507 | +add_action('wpinv_send_payment_reminder_notification', 'wpinv_send_payment_reminder_notification', 10, 1); |
|
1508 | 1508 | |
1509 | -function wpinv_payment_reminder_sent( $invoice_id, $invoice ) { |
|
1509 | +function wpinv_payment_reminder_sent($invoice_id, $invoice) { |
|
1510 | 1510 | global $wpi_auto_reminder; |
1511 | 1511 | |
1512 | - $sent = get_post_meta( $invoice_id, '_wpinv_reminder_sent', true ); |
|
1512 | + $sent = get_post_meta($invoice_id, '_wpinv_reminder_sent', true); |
|
1513 | 1513 | |
1514 | - if ( empty( $sent ) ) { |
|
1514 | + if (empty($sent)) { |
|
1515 | 1515 | $sent = array(); |
1516 | 1516 | } |
1517 | - $sent[] = date_i18n( 'Y-m-d' ); |
|
1517 | + $sent[] = date_i18n('Y-m-d'); |
|
1518 | 1518 | |
1519 | - update_post_meta( $invoice_id, '_wpinv_reminder_sent', $sent ); |
|
1519 | + update_post_meta($invoice_id, '_wpinv_reminder_sent', $sent); |
|
1520 | 1520 | |
1521 | - if ( $wpi_auto_reminder ) { // Auto reminder note. |
|
1522 | - $note = __( 'Manual reminder sent to the user.', 'invoicing' ); |
|
1523 | - $invoice->add_note( $note, false, false, true ); |
|
1521 | + if ($wpi_auto_reminder) { // Auto reminder note. |
|
1522 | + $note = __('Manual reminder sent to the user.', 'invoicing'); |
|
1523 | + $invoice->add_note($note, false, false, true); |
|
1524 | 1524 | } else { // Menual reminder note. |
1525 | - $note = __( 'Manual reminder sent to the user.', 'invoicing' ); |
|
1526 | - $invoice->add_note( $note ); |
|
1525 | + $note = __('Manual reminder sent to the user.', 'invoicing'); |
|
1526 | + $invoice->add_note($note); |
|
1527 | 1527 | } |
1528 | 1528 | } |
1529 | -add_action( 'wpinv_payment_reminder_sent', 'wpinv_payment_reminder_sent', 10, 2 ); |
|
1529 | +add_action('wpinv_payment_reminder_sent', 'wpinv_payment_reminder_sent', 10, 2); |
|
1530 | 1530 | |
1531 | -function wpinv_email_before_note_details( $invoice, $email_type, $sent_to_admin, $customer_note ) { |
|
1532 | - if("wpi_invoice" === $invoice->post_type && !empty($customer_note)){ |
|
1531 | +function wpinv_email_before_note_details($invoice, $email_type, $sent_to_admin, $customer_note) { |
|
1532 | + if ("wpi_invoice" === $invoice->post_type && !empty($customer_note)) { |
|
1533 | 1533 | $before_note = ''; |
1534 | - $before_note .= __( 'Hello, a note has just been added to your invoice:', 'invoicing' ); |
|
1535 | - $before_note .= '<blockquote class="wpinv-note">'.wpautop( wptexturize( $customer_note ) ).'</blockquote>'; |
|
1536 | - $before_note .= __( 'For your reference, your invoice details are shown below.', 'invoicing' ); |
|
1534 | + $before_note .= __('Hello, a note has just been added to your invoice:', 'invoicing'); |
|
1535 | + $before_note .= '<blockquote class="wpinv-note">' . wpautop(wptexturize($customer_note)) . '</blockquote>'; |
|
1536 | + $before_note .= __('For your reference, your invoice details are shown below.', 'invoicing'); |
|
1537 | 1537 | echo $before_note; |
1538 | 1538 | } |
1539 | 1539 | } |
1540 | 1540 | \ No newline at end of file |