@@ -1,34 +1,34 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Billing_Details { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $user_ID; |
10 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
11 | - $invoice = new WPInv_Invoice( $post_id ); |
|
10 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
11 | + $invoice = new WPInv_Invoice($post_id); |
|
12 | 12 | ?> |
13 | 13 | <div class="gdmbx2-wrap form-table"> |
14 | 14 | <div id="gdmbx2-metabox-wpinv_address" class="gdmbx2-metabox gdmbx-field-list wpinv-address gdmbx-row"> |
15 | 15 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-user-id table-layout"> |
16 | 16 | <div class="gdmbx-th"> |
17 | - <label for="post_author_override"><?php _e( 'Customer', 'invoicing' );?></label> |
|
17 | + <label for="post_author_override"><?php _e('Customer', 'invoicing'); ?></label> |
|
18 | 18 | </div> |
19 | 19 | <div class="gdmbx-td gdmbx-customer-div"> |
20 | - <?php wpinv_dropdown_users( array( |
|
20 | + <?php wpinv_dropdown_users(array( |
|
21 | 21 | 'name' => 'post_author_override', |
22 | 22 | 'selected' => empty($post->ID) ? $user_ID : $post->post_author, |
23 | 23 | 'include_selected' => true, |
24 | 24 | 'show' => 'user_email', |
25 | 25 | 'orderby' => 'user_email', |
26 | 26 | 'class' => 'gdmbx2-text-large' |
27 | - ) ); ?> |
|
27 | + )); ?> |
|
28 | 28 | </div> |
29 | 29 | </div> |
30 | 30 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-email table-layout" style="display:none"> |
31 | - <div class="gdmbx-th"><label for="wpinv_email"><?php _e( 'Email', 'invoicing' );?> <span class="required">*</span></label> |
|
31 | + <div class="gdmbx-th"><label for="wpinv_email"><?php _e('Email', 'invoicing'); ?> <span class="required">*</span></label> |
|
32 | 32 | </div> |
33 | 33 | <div class="gdmbx-td"> |
34 | 34 | <input type="hidden" id="wpinv_new_user" name="wpinv_new_user" value="" /> |
@@ -36,56 +36,56 @@ discard block |
||
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-btns table-layout"> |
39 | - <div class="gdmbx-th"><label><?php _e( 'Actions', 'invoicing' );?></label> |
|
39 | + <div class="gdmbx-th"><label><?php _e('Actions', 'invoicing'); ?></label> |
|
40 | 40 | </div> |
41 | 41 | <div class="gdmbx-td"> |
42 | - <a id="wpinv-fill-user-details" class="button button-small button-secondary" title="<?php esc_attr_e( 'Fill User Details', 'invoicing' );?>" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-refresh"></i><?php _e( 'Fill User Details', 'invoicing' );?></a> |
|
43 | - <a class="wpinv-new-user button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-plus"></i><?php _e( 'Add New User', 'invoicing' );?></a> |
|
44 | - <a style="display:none" class="wpinv-new-cancel button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-close"></i><?php _e( 'Cancel', 'invoicing' );?> </a> |
|
42 | + <a id="wpinv-fill-user-details" class="button button-small button-secondary" title="<?php esc_attr_e('Fill User Details', 'invoicing'); ?>" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-refresh"></i><?php _e('Fill User Details', 'invoicing'); ?></a> |
|
43 | + <a class="wpinv-new-user button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-plus"></i><?php _e('Add New User', 'invoicing'); ?></a> |
|
44 | + <a style="display:none" class="wpinv-new-cancel button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-close"></i><?php _e('Cancel', 'invoicing'); ?> </a> |
|
45 | 45 | </div> |
46 | 46 | </div> |
47 | 47 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-first-name table-layout"> |
48 | - <div class="gdmbx-th"><label for="wpinv_first_name"><?php _e( 'First Name', 'invoicing' );?></label></div> |
|
48 | + <div class="gdmbx-th"><label for="wpinv_first_name"><?php _e('First Name', 'invoicing'); ?></label></div> |
|
49 | 49 | <div class="gdmbx-td"> |
50 | - <input type="text" class="gdmbx2-text-large" name="wpinv_first_name" id="wpinv_first_name" value="<?php echo esc_attr( $invoice->first_name );?>" /> |
|
50 | + <input type="text" class="gdmbx2-text-large" name="wpinv_first_name" id="wpinv_first_name" value="<?php echo esc_attr($invoice->first_name); ?>" /> |
|
51 | 51 | </div> |
52 | 52 | </div> |
53 | 53 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-last-name table-layout"> |
54 | - <div class="gdmbx-th"><label for="wpinv_last_name"><?php _e( 'Last Name', 'invoicing' );?></label></div> |
|
54 | + <div class="gdmbx-th"><label for="wpinv_last_name"><?php _e('Last Name', 'invoicing'); ?></label></div> |
|
55 | 55 | <div class="gdmbx-td"> |
56 | - <input type="text" class="gdmbx2-text-large" name="wpinv_last_name" id="wpinv_last_name" value="<?php echo esc_attr( $invoice->last_name );?>" /> |
|
56 | + <input type="text" class="gdmbx2-text-large" name="wpinv_last_name" id="wpinv_last_name" value="<?php echo esc_attr($invoice->last_name); ?>" /> |
|
57 | 57 | </div> |
58 | 58 | </div> |
59 | 59 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-company table-layout"> |
60 | - <div class="gdmbx-th"><label for="wpinv_company"><?php _e( 'Company', 'invoicing' );?></label></div> |
|
60 | + <div class="gdmbx-th"><label for="wpinv_company"><?php _e('Company', 'invoicing'); ?></label></div> |
|
61 | 61 | <div class="gdmbx-td"> |
62 | - <input type="text" class="gdmbx2-text-large" name="wpinv_company" id="wpinv_company" value="<?php echo esc_attr( $invoice->company );?>" /> |
|
62 | + <input type="text" class="gdmbx2-text-large" name="wpinv_company" id="wpinv_company" value="<?php echo esc_attr($invoice->company); ?>" /> |
|
63 | 63 | </div> |
64 | 64 | </div> |
65 | 65 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-vat-number table-layout"> |
66 | - <div class="gdmbx-th"><label for="wpinv_vat_number"><?php _e( 'Vat Number', 'invoicing' );?></label></div> |
|
66 | + <div class="gdmbx-th"><label for="wpinv_vat_number"><?php _e('Vat Number', 'invoicing'); ?></label></div> |
|
67 | 67 | <div class="gdmbx-td"> |
68 | - <input type="text" class="gdmbx2-text-large" name="wpinv_vat_number" id="wpinv_vat_number" value="<?php echo esc_attr( $invoice->vat_number );?>" /> |
|
68 | + <input type="text" class="gdmbx2-text-large" name="wpinv_vat_number" id="wpinv_vat_number" value="<?php echo esc_attr($invoice->vat_number); ?>" /> |
|
69 | 69 | </div> |
70 | 70 | </div> |
71 | 71 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-address table-layout"> |
72 | - <div class="gdmbx-th"><label for="wpinv_address"><?php _e( 'Address', 'invoicing' );?></label></div> |
|
72 | + <div class="gdmbx-th"><label for="wpinv_address"><?php _e('Address', 'invoicing'); ?></label></div> |
|
73 | 73 | <div class="gdmbx-td"> |
74 | - <input type="text" class="gdmbx2-text-large" name="wpinv_address" id="wpinv_address" value="<?php echo esc_attr( $invoice->address );?>" /> |
|
74 | + <input type="text" class="gdmbx2-text-large" name="wpinv_address" id="wpinv_address" value="<?php echo esc_attr($invoice->address); ?>" /> |
|
75 | 75 | </div> |
76 | 76 | </div> |
77 | 77 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-city table-layout"> |
78 | - <div class="gdmbx-th"><label for="wpinv_city"><?php _e( 'City', 'invoicing' );?></label></div> |
|
78 | + <div class="gdmbx-th"><label for="wpinv_city"><?php _e('City', 'invoicing'); ?></label></div> |
|
79 | 79 | <div class="gdmbx-td"> |
80 | - <input type="text" class="gdmbx2-text-large" name="wpinv_city" id="wpinv_city" value="<?php echo esc_attr( $invoice->city );?>" /> |
|
80 | + <input type="text" class="gdmbx2-text-large" name="wpinv_city" id="wpinv_city" value="<?php echo esc_attr($invoice->city); ?>" /> |
|
81 | 81 | </div> |
82 | 82 | </div> |
83 | 83 | <div class="gdmbx-row gdmbx-type-select gdmbx-wpinv-country table-layout"> |
84 | - <div class="gdmbx-th"><label for="wpinv_country"><?php _e( 'Country', 'invoicing' );?> <span class="wpi-loader"><i class="fa fa-refresh fa-spin"></i></span></label></div> |
|
84 | + <div class="gdmbx-th"><label for="wpinv_country"><?php _e('Country', 'invoicing'); ?> <span class="wpi-loader"><i class="fa fa-refresh fa-spin"></i></span></label></div> |
|
85 | 85 | <div class="gdmbx-td"> |
86 | 86 | <?php |
87 | - echo wpinv_html_select( array( |
|
88 | - 'options' => array_merge( array( '' => __( 'Choose a country', 'invoicing' ) ), wpinv_get_country_list() ), |
|
87 | + echo wpinv_html_select(array( |
|
88 | + 'options' => array_merge(array('' => __('Choose a country', 'invoicing')), wpinv_get_country_list()), |
|
89 | 89 | 'name' => 'wpinv_country', |
90 | 90 | 'id' => 'wpinv_country', |
91 | 91 | 'selected' => $invoice->country, |
@@ -93,20 +93,20 @@ discard block |
||
93 | 93 | 'show_option_none' => false, |
94 | 94 | 'class' => 'gdmbx2-text-large', |
95 | 95 | 'chosen' => false, |
96 | - 'placeholder' => __( 'Choose a country', 'invoicing' ), |
|
96 | + 'placeholder' => __('Choose a country', 'invoicing'), |
|
97 | 97 | 'required' => false, |
98 | - ) ); |
|
98 | + )); |
|
99 | 99 | ?> |
100 | 100 | </div> |
101 | 101 | </div> |
102 | 102 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-state table-layout"> |
103 | - <div class="gdmbx-th"><label for="wpinv_state"><?php _e( 'State', 'invoicing' );?></label></div> |
|
103 | + <div class="gdmbx-th"><label for="wpinv_state"><?php _e('State', 'invoicing'); ?></label></div> |
|
104 | 104 | <div class="gdmbx-td"> |
105 | 105 | <?php |
106 | - $states = wpinv_get_country_states( $invoice->country ); |
|
107 | - if( !empty( $states ) ) { |
|
108 | - echo wpinv_html_select( array( |
|
109 | - 'options' => array_merge( array( '' => __( 'Choose a state', 'invoicing' ) ), $states ), |
|
106 | + $states = wpinv_get_country_states($invoice->country); |
|
107 | + if (!empty($states)) { |
|
108 | + echo wpinv_html_select(array( |
|
109 | + 'options' => array_merge(array('' => __('Choose a state', 'invoicing')), $states), |
|
110 | 110 | 'name' => 'wpinv_state', |
111 | 111 | 'id' => 'wpinv_state', |
112 | 112 | 'selected' => $invoice->state, |
@@ -114,44 +114,44 @@ discard block |
||
114 | 114 | 'show_option_none' => false, |
115 | 115 | 'class' => 'gdmbx2-text-large', |
116 | 116 | 'chosen' => false, |
117 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
117 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
118 | 118 | 'required' => false, |
119 | - ) ); |
|
119 | + )); |
|
120 | 120 | } else { |
121 | - echo wpinv_html_text( array( |
|
121 | + echo wpinv_html_text(array( |
|
122 | 122 | 'name' => 'wpinv_state', |
123 | - 'value' => ! empty( $invoice->state ) ? $invoice->state : '', |
|
123 | + 'value' => !empty($invoice->state) ? $invoice->state : '', |
|
124 | 124 | 'id' => 'wpinv_state', |
125 | 125 | 'class' => 'gdmbx2-text-large', |
126 | 126 | 'required' => false, |
127 | - ) ); |
|
127 | + )); |
|
128 | 128 | } |
129 | 129 | ?> |
130 | 130 | </div> |
131 | 131 | </div> |
132 | 132 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-zip table-layout"> |
133 | - <div class="gdmbx-th"><label for="wpinv_zip"><?php _e( 'Zipcode', 'invoicing' );?></label></div> |
|
133 | + <div class="gdmbx-th"><label for="wpinv_zip"><?php _e('Zipcode', 'invoicing'); ?></label></div> |
|
134 | 134 | <div class="gdmbx-td"> |
135 | - <input type="text" class="gdmbx2-text-large" name="wpinv_zip" id="wpinv_zip" value="<?php echo esc_attr( $invoice->zip );?>" /> |
|
135 | + <input type="text" class="gdmbx2-text-large" name="wpinv_zip" id="wpinv_zip" value="<?php echo esc_attr($invoice->zip); ?>" /> |
|
136 | 136 | </div> |
137 | 137 | </div> |
138 | 138 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-phone table-layout"> |
139 | - <div class="gdmbx-th"><label for="wpinv_phone"><?php _e( 'Phone', 'invoicing' );?></label></div> |
|
139 | + <div class="gdmbx-th"><label for="wpinv_phone"><?php _e('Phone', 'invoicing'); ?></label></div> |
|
140 | 140 | <div class="gdmbx-td"> |
141 | - <input type="text" class="gdmbx2-text-large" name="wpinv_phone" id="wpinv_phone" value="<?php echo esc_attr( $invoice->phone );?>" /> |
|
141 | + <input type="text" class="gdmbx2-text-large" name="wpinv_phone" id="wpinv_phone" value="<?php echo esc_attr($invoice->phone); ?>" /> |
|
142 | 142 | </div> |
143 | 143 | </div> |
144 | 144 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-ip table-layout"> |
145 | - <div class="gdmbx-th"><label for="wpinv_ip"><?php _e( 'IP Address', 'invoicing' );?><?php if ($invoice->ip) { ?> |
|
146 | - <a href="<?php echo admin_url( 'admin-ajax.php?action=wpinv_ip_geolocation&ip=' . $invoice->ip ); ?>" title="<?php esc_attr_e( 'View IP information', 'invoicing' );?>" target="_blank"><i class="fa fa-external-link" aria-hidden="true"></i></a> |
|
145 | + <div class="gdmbx-th"><label for="wpinv_ip"><?php _e('IP Address', 'invoicing'); ?><?php if ($invoice->ip) { ?> |
|
146 | + <a href="<?php echo admin_url('admin-ajax.php?action=wpinv_ip_geolocation&ip=' . $invoice->ip); ?>" title="<?php esc_attr_e('View IP information', 'invoicing'); ?>" target="_blank"><i class="fa fa-external-link" aria-hidden="true"></i></a> |
|
147 | 147 | <?php } ?></label></div> |
148 | 148 | <div class="gdmbx-td"> |
149 | - <input type="text" class="gdmbx2-text-large" value="<?php echo esc_attr( $invoice->ip );?>" readonly /> |
|
149 | + <input type="text" class="gdmbx2-text-large" value="<?php echo esc_attr($invoice->ip); ?>" readonly /> |
|
150 | 150 | </div> |
151 | 151 | </div> |
152 | 152 | </div> |
153 | 153 | </div> |
154 | -<?php wp_nonce_field( 'wpinv_save_invoice', 'wpinv_save_invoice' ) ;?> |
|
154 | +<?php wp_nonce_field('wpinv_save_invoice', 'wpinv_save_invoice'); ?> |
|
155 | 155 | <?php |
156 | 156 | } |
157 | 157 | } |
@@ -7,15 +7,15 @@ 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 | class WPInv_Plugin { |
15 | 15 | private static $instance; |
16 | 16 | |
17 | 17 | public static function run() { |
18 | - if ( !isset( self::$instance ) && !( self::$instance instanceof WPInv_Plugin ) ) { |
|
18 | + if (!isset(self::$instance) && !(self::$instance instanceof WPInv_Plugin)) { |
|
19 | 19 | self::$instance = new WPInv_Plugin; |
20 | 20 | self::$instance->includes(); |
21 | 21 | self::$instance->actions(); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | self::$instance->reports = new WPInv_Reports(); |
24 | 24 | } |
25 | 25 | |
26 | - do_action( 'wpinv_loaded' ); |
|
26 | + do_action('wpinv_loaded'); |
|
27 | 27 | |
28 | 28 | return self::$instance; |
29 | 29 | } |
@@ -33,31 +33,31 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | public function define_constants() { |
36 | - define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) ); |
|
37 | - define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) ); |
|
36 | + define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE)); |
|
37 | + define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE)); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | private function actions() { |
41 | 41 | /* Internationalize the text strings used. */ |
42 | - add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) ); |
|
42 | + add_action('plugins_loaded', array(&$this, 'plugins_loaded')); |
|
43 | 43 | |
44 | 44 | /* Perform actions on admin initialization. */ |
45 | - add_action( 'admin_init', array( &$this, 'admin_init') ); |
|
46 | - add_action( 'init', array( &$this, 'init' ), 3 ); |
|
47 | - add_action( 'init', array( 'WPInv_Shortcodes', 'init' ) ); |
|
48 | - add_action( 'init', array( &$this, 'wpinv_actions' ) ); |
|
45 | + add_action('admin_init', array(&$this, 'admin_init')); |
|
46 | + add_action('init', array(&$this, 'init'), 3); |
|
47 | + add_action('init', array('WPInv_Shortcodes', 'init')); |
|
48 | + add_action('init', array(&$this, 'wpinv_actions')); |
|
49 | 49 | |
50 | - if ( class_exists( 'BuddyPress' ) ) { |
|
51 | - add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) ); |
|
50 | + if (class_exists('BuddyPress')) { |
|
51 | + add_action('bp_include', array(&$this, 'bp_invoicing_init')); |
|
52 | 52 | } |
53 | 53 | |
54 | - add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) ); |
|
54 | + add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts')); |
|
55 | 55 | |
56 | - if ( is_admin() ) { |
|
57 | - add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) ); |
|
58 | - add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) ); |
|
56 | + if (is_admin()) { |
|
57 | + add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts')); |
|
58 | + add_action('admin_body_class', array(&$this, 'admin_body_class')); |
|
59 | 59 | } else { |
60 | - add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) ); |
|
60 | + add_filter('pre_get_posts', array(&$this, 'pre_get_posts')); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference. |
69 | 69 | */ |
70 | - do_action_ref_array( 'wpinv_actions', array( &$this ) ); |
|
70 | + do_action_ref_array('wpinv_actions', array(&$this)); |
|
71 | 71 | |
72 | - add_action( 'admin_init', array( &$this, 'activation_redirect') ); |
|
72 | + add_action('admin_init', array(&$this, 'activation_redirect')); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public function plugins_loaded() { |
@@ -83,193 +83,193 @@ discard block |
||
83 | 83 | * @since 1.0 |
84 | 84 | */ |
85 | 85 | public function load_textdomain() { |
86 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'invoicing' ); |
|
86 | + $locale = apply_filters('plugin_locale', get_locale(), 'invoicing'); |
|
87 | 87 | |
88 | - load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' ); |
|
89 | - load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' ); |
|
88 | + load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo'); |
|
89 | + load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages'); |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Define language constants. |
93 | 93 | */ |
94 | - require_once( WPINV_PLUGIN_DIR . 'language.php' ); |
|
94 | + require_once(WPINV_PLUGIN_DIR . 'language.php'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | public function includes() { |
98 | 98 | global $wpinv_options; |
99 | 99 | |
100 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' ); |
|
100 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php'); |
|
101 | 101 | $wpinv_options = wpinv_get_settings(); |
102 | 102 | |
103 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' ); |
|
104 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' ); |
|
105 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' ); |
|
106 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' ); |
|
107 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' ); |
|
108 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' ); |
|
109 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' ); |
|
110 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' ); |
|
111 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' ); |
|
112 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' ); |
|
113 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' ); |
|
114 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' ); |
|
115 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' ); |
|
116 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gd-functions.php' ); |
|
117 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' ); |
|
103 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php'); |
|
104 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php'); |
|
105 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php'); |
|
106 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php'); |
|
107 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php'); |
|
108 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php'); |
|
109 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php'); |
|
110 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php'); |
|
111 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php'); |
|
112 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php'); |
|
113 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php'); |
|
114 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php'); |
|
115 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php'); |
|
116 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gd-functions.php'); |
|
117 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php'); |
|
118 | 118 | //require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' ); |
119 | 119 | //require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' ); |
120 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' ); |
|
120 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php'); |
|
121 | 121 | //require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscription.php' ); |
122 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' ); |
|
123 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' ); |
|
124 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session.php' ); |
|
125 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' ); |
|
126 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' ); |
|
127 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' ); |
|
128 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-shortcodes.php' ); |
|
129 | - if ( !class_exists( 'Geodir_EUVat' ) ) { |
|
130 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' ); |
|
122 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php'); |
|
123 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php'); |
|
124 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session.php'); |
|
125 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php'); |
|
126 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php'); |
|
127 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php'); |
|
128 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-shortcodes.php'); |
|
129 | + if (!class_exists('Geodir_EUVat')) { |
|
130 | + require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php'); |
|
131 | 131 | } |
132 | 132 | |
133 | - $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
134 | - if ( !empty( $gateways ) ) { |
|
135 | - foreach ( $gateways as $gateway ) { |
|
136 | - if ( $gateway == 'manual' ) { |
|
133 | + $gateways = array_keys(wpinv_get_enabled_payment_gateways()); |
|
134 | + if (!empty($gateways)) { |
|
135 | + foreach ($gateways as $gateway) { |
|
136 | + if ($gateway == 'manual') { |
|
137 | 137 | continue; |
138 | 138 | } |
139 | 139 | |
140 | 140 | $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php'; |
141 | 141 | |
142 | - if ( file_exists( $gateway_file ) ) { |
|
143 | - require_once( $gateway_file ); |
|
142 | + if (file_exists($gateway_file)) { |
|
143 | + require_once($gateway_file); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
147 | - require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' ); |
|
147 | + require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php'); |
|
148 | 148 | |
149 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
150 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' ); |
|
151 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' ); |
|
152 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' ); |
|
149 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
150 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php'); |
|
151 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php'); |
|
152 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php'); |
|
153 | 153 | //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' ); |
154 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' ); |
|
155 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' ); |
|
156 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' ); |
|
157 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' ); |
|
158 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' ); |
|
154 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php'); |
|
155 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php'); |
|
156 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php'); |
|
157 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php'); |
|
158 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php'); |
|
159 | 159 | //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
160 | 160 | } |
161 | 161 | |
162 | 162 | // include css inliner |
163 | - if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) { |
|
164 | - include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' ); |
|
163 | + if (!class_exists('Emogrifier') && class_exists('DOMDocument')) { |
|
164 | + include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php'); |
|
165 | 165 | } |
166 | 166 | |
167 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' ); |
|
167 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php'); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | public function init() { |
171 | 171 | } |
172 | 172 | |
173 | 173 | public function admin_init() { |
174 | - if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) { |
|
174 | + if (!(defined('DOING_AJAX') && DOING_AJAX)) { |
|
175 | 175 | } |
176 | 176 | |
177 | - add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) ); |
|
177 | + add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php')); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | public function activation_redirect() { |
181 | 181 | // Bail if no activation redirect |
182 | - if ( !get_transient( '_wpinv_activation_redirect' ) ) { |
|
182 | + if (!get_transient('_wpinv_activation_redirect')) { |
|
183 | 183 | return; |
184 | 184 | } |
185 | 185 | |
186 | 186 | // Delete the redirect transient |
187 | - delete_transient( '_wpinv_activation_redirect' ); |
|
187 | + delete_transient('_wpinv_activation_redirect'); |
|
188 | 188 | |
189 | 189 | // Bail if activating from network, or bulk |
190 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
190 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
191 | 191 | return; |
192 | 192 | } |
193 | 193 | |
194 | - wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) ); |
|
194 | + wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general')); |
|
195 | 195 | exit; |
196 | 196 | } |
197 | 197 | |
198 | 198 | public function enqueue_scripts() { |
199 | - $suffix = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
199 | + $suffix = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
200 | 200 | |
201 | - wp_deregister_style( 'font-awesome' ); |
|
202 | - wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0' ); |
|
203 | - wp_enqueue_style( 'font-awesome' ); |
|
201 | + wp_deregister_style('font-awesome'); |
|
202 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0'); |
|
203 | + wp_enqueue_style('font-awesome'); |
|
204 | 204 | |
205 | - wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION ); |
|
206 | - wp_enqueue_style( 'wpinv_front_style' ); |
|
205 | + wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION); |
|
206 | + wp_enqueue_style('wpinv_front_style'); |
|
207 | 207 | |
208 | 208 | // Register scripts |
209 | - wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
210 | - wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front' . $suffix . '.js', array( 'jquery', 'wpinv-vat-script' ), WPINV_VERSION ); |
|
209 | + wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true); |
|
210 | + wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front' . $suffix . '.js', array('jquery', 'wpinv-vat-script'), WPINV_VERSION); |
|
211 | 211 | |
212 | 212 | $localize = array(); |
213 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
214 | - $localize['nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
213 | + $localize['ajax_url'] = admin_url('admin-ajax.php'); |
|
214 | + $localize['nonce'] = wp_create_nonce('wpinv-nonce'); |
|
215 | 215 | $localize['currency_symbol'] = wpinv_currency_symbol(); |
216 | 216 | $localize['currency_pos'] = wpinv_currency_position(); |
217 | 217 | $localize['thousand_sep'] = wpinv_thousands_separator(); |
218 | 218 | $localize['decimal_sep'] = wpinv_decimal_separator(); |
219 | 219 | $localize['decimals'] = wpinv_decimals(); |
220 | 220 | |
221 | - $localize = apply_filters( 'wpinv_front_js_localize', $localize ); |
|
221 | + $localize = apply_filters('wpinv_front_js_localize', $localize); |
|
222 | 222 | |
223 | - wp_enqueue_script( 'jquery-blockui' ); |
|
224 | - wp_enqueue_script( 'wpinv-front-script' ); |
|
225 | - wp_localize_script( 'wpinv-front-script', 'WPInv', $localize ); |
|
223 | + wp_enqueue_script('jquery-blockui'); |
|
224 | + wp_enqueue_script('wpinv-front-script'); |
|
225 | + wp_localize_script('wpinv-front-script', 'WPInv', $localize); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | public function admin_enqueue_scripts() { |
229 | 229 | global $post, $pagenow; |
230 | 230 | |
231 | 231 | $post_type = wpinv_admin_post_type(); |
232 | - $suffix = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
232 | + $suffix = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
233 | 233 | |
234 | - wp_deregister_style( 'font-awesome' ); |
|
235 | - wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0' ); |
|
236 | - wp_enqueue_style( 'font-awesome' ); |
|
234 | + wp_deregister_style('font-awesome'); |
|
235 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0'); |
|
236 | + wp_enqueue_style('font-awesome'); |
|
237 | 237 | |
238 | - wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' ); |
|
239 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
238 | + wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16'); |
|
239 | + wp_enqueue_style('jquery-ui-css'); |
|
240 | 240 | |
241 | - wp_register_style( 'jquery-chosen', WPINV_PLUGIN_URL . 'assets/css/chosen' . $suffix . '.css', array(), '1.6.2' ); |
|
242 | - wp_enqueue_style( 'jquery-chosen' ); |
|
241 | + wp_register_style('jquery-chosen', WPINV_PLUGIN_URL . 'assets/css/chosen' . $suffix . '.css', array(), '1.6.2'); |
|
242 | + wp_enqueue_style('jquery-chosen'); |
|
243 | 243 | |
244 | - wp_register_script( 'jquery-chosen', WPINV_PLUGIN_URL . 'assets/js/chosen.jquery' . $suffix . '.js', array( 'jquery' ), '1.6.2' ); |
|
245 | - wp_enqueue_script( 'jquery-chosen' ); |
|
244 | + wp_register_script('jquery-chosen', WPINV_PLUGIN_URL . 'assets/js/chosen.jquery' . $suffix . '.js', array('jquery'), '1.6.2'); |
|
245 | + wp_enqueue_script('jquery-chosen'); |
|
246 | 246 | |
247 | - wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION ); |
|
248 | - wp_enqueue_style( 'wpinv_meta_box_style' ); |
|
247 | + wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION); |
|
248 | + wp_enqueue_style('wpinv_meta_box_style'); |
|
249 | 249 | |
250 | - wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION ); |
|
251 | - wp_enqueue_style( 'wpinv_admin_style' ); |
|
250 | + wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION); |
|
251 | + wp_enqueue_style('wpinv_admin_style'); |
|
252 | 252 | |
253 | - if ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) { |
|
254 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
253 | + if ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) { |
|
254 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
255 | 255 | } |
256 | 256 | |
257 | - wp_enqueue_style( 'wp-color-picker' ); |
|
258 | - wp_enqueue_script( 'wp-color-picker' ); |
|
257 | + wp_enqueue_style('wp-color-picker'); |
|
258 | + wp_enqueue_script('wp-color-picker'); |
|
259 | 259 | |
260 | - wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
260 | + wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true); |
|
261 | 261 | |
262 | - wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array( 'jquery', 'jquery-blockui' ), WPINV_VERSION ); |
|
263 | - wp_enqueue_script( 'wpinv-admin-script' ); |
|
262 | + wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array('jquery', 'jquery-blockui'), WPINV_VERSION); |
|
263 | + wp_enqueue_script('wpinv-admin-script'); |
|
264 | 264 | |
265 | 265 | $localize = array(); |
266 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
267 | - $localize['post_ID'] = isset( $post->ID ) ? $post->ID : ''; |
|
268 | - $localize['wpinv_nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
269 | - $localize['add_invoice_note_nonce'] = wp_create_nonce( 'add-invoice-note' ); |
|
270 | - $localize['delete_invoice_note_nonce'] = wp_create_nonce( 'delete-invoice-note' ); |
|
271 | - $localize['invoice_item_nonce'] = wp_create_nonce( 'invoice-item' ); |
|
272 | - $localize['billing_details_nonce'] = wp_create_nonce( 'get-billing-details' ); |
|
266 | + $localize['ajax_url'] = admin_url('admin-ajax.php'); |
|
267 | + $localize['post_ID'] = isset($post->ID) ? $post->ID : ''; |
|
268 | + $localize['wpinv_nonce'] = wp_create_nonce('wpinv-nonce'); |
|
269 | + $localize['add_invoice_note_nonce'] = wp_create_nonce('add-invoice-note'); |
|
270 | + $localize['delete_invoice_note_nonce'] = wp_create_nonce('delete-invoice-note'); |
|
271 | + $localize['invoice_item_nonce'] = wp_create_nonce('invoice-item'); |
|
272 | + $localize['billing_details_nonce'] = wp_create_nonce('get-billing-details'); |
|
273 | 273 | $localize['tax'] = wpinv_tax_amount(); |
274 | 274 | $localize['discount'] = wpinv_discount_amount(); |
275 | 275 | $localize['currency_symbol'] = wpinv_currency_symbol(); |
@@ -277,55 +277,55 @@ discard block |
||
277 | 277 | $localize['thousand_sep'] = wpinv_thousands_separator(); |
278 | 278 | $localize['decimal_sep'] = wpinv_decimal_separator(); |
279 | 279 | $localize['decimals'] = wpinv_decimals(); |
280 | - $localize['save_invoice'] = __( 'Save Invoice', 'invoicing' ); |
|
281 | - $localize['status_publish'] = wpinv_status_nicename( 'publish' ); |
|
282 | - $localize['status_pending'] = wpinv_status_nicename( 'pending' ); |
|
283 | - $localize['delete_tax_rate'] = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ); |
|
284 | - $localize['OneItemMin'] = __( 'Invoice must contain at least one item', 'invoicing' ); |
|
285 | - $localize['DeleteInvoiceItem'] = __( 'Are you sure you wish to delete this item?', 'invoicing' ); |
|
286 | - $localize['FillBillingDetails'] = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ); |
|
287 | - $localize['confirmCalcTotals'] = __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' ); |
|
288 | - $localize['AreYouSure'] = __( 'Are you sure?', 'invoicing' ); |
|
289 | - $localize['hasGD'] = wpinv_gd_active();; |
|
280 | + $localize['save_invoice'] = __('Save Invoice', 'invoicing'); |
|
281 | + $localize['status_publish'] = wpinv_status_nicename('publish'); |
|
282 | + $localize['status_pending'] = wpinv_status_nicename('pending'); |
|
283 | + $localize['delete_tax_rate'] = __('Are you sure you wish to delete this tax rate?', 'invoicing'); |
|
284 | + $localize['OneItemMin'] = __('Invoice must contain at least one item', 'invoicing'); |
|
285 | + $localize['DeleteInvoiceItem'] = __('Are you sure you wish to delete this item?', 'invoicing'); |
|
286 | + $localize['FillBillingDetails'] = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'); |
|
287 | + $localize['confirmCalcTotals'] = __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing'); |
|
288 | + $localize['AreYouSure'] = __('Are you sure?', 'invoicing'); |
|
289 | + $localize['hasGD'] = wpinv_gd_active(); ; |
|
290 | 290 | $localize['hasPM'] = wpinv_pm_active(); |
291 | - $localize['emptyInvoice'] = __( 'Add atleast one item to save invoice!', 'invoicing' ); |
|
292 | - $localize['deletePackage'] = __( 'GD package items should be deleted from GD payment manager only, otherwise it will break invoices that created with this package!', 'invoicing' ); |
|
293 | - $localize['deletePackages'] = __( 'GD package items should be deleted from GD payment manager only', 'invoicing' ); |
|
294 | - $localize['deleteInvoiceFirst'] = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ); |
|
291 | + $localize['emptyInvoice'] = __('Add atleast one item to save invoice!', 'invoicing'); |
|
292 | + $localize['deletePackage'] = __('GD package items should be deleted from GD payment manager only, otherwise it will break invoices that created with this package!', 'invoicing'); |
|
293 | + $localize['deletePackages'] = __('GD package items should be deleted from GD payment manager only', 'invoicing'); |
|
294 | + $localize['deleteInvoiceFirst'] = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'); |
|
295 | 295 | |
296 | - wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize ); |
|
296 | + wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize); |
|
297 | 297 | } |
298 | 298 | |
299 | - public function admin_body_class( $classes ) { |
|
299 | + public function admin_body_class($classes) { |
|
300 | 300 | global $pagenow; |
301 | 301 | |
302 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
302 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
303 | 303 | |
304 | 304 | $add_class = false; |
305 | - if ( $pagenow == 'admin.php' && $page ) { |
|
306 | - $add_class = strpos( $page, 'wpinv-' ); |
|
305 | + if ($pagenow == 'admin.php' && $page) { |
|
306 | + $add_class = strpos($page, 'wpinv-'); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | $settings_class = array(); |
310 | - if ( $page == 'wpinv-settings' ) { |
|
311 | - if ( !empty( $_REQUEST['tab'] ) ) { |
|
312 | - $settings_class[] = sanitize_text_field( $_REQUEST['tab'] ); |
|
310 | + if ($page == 'wpinv-settings') { |
|
311 | + if (!empty($_REQUEST['tab'])) { |
|
312 | + $settings_class[] = sanitize_text_field($_REQUEST['tab']); |
|
313 | 313 | } |
314 | 314 | |
315 | - if ( !empty( $_REQUEST['section'] ) ) { |
|
316 | - $settings_class[] = sanitize_text_field( $_REQUEST['section'] ); |
|
315 | + if (!empty($_REQUEST['section'])) { |
|
316 | + $settings_class[] = sanitize_text_field($_REQUEST['section']); |
|
317 | 317 | } |
318 | 318 | |
319 | - $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main'; |
|
319 | + $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main'; |
|
320 | 320 | } |
321 | 321 | |
322 | - if ( !empty( $settings_class ) ) { |
|
323 | - $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) ); |
|
322 | + if (!empty($settings_class)) { |
|
323 | + $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-')); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | $post_type = wpinv_admin_post_type(); |
327 | 327 | |
328 | - if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) { |
|
328 | + if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) { |
|
329 | 329 | return $classes .= ' wpinv'; |
330 | 330 | } else { |
331 | 331 | return $classes; |
@@ -337,26 +337,26 @@ discard block |
||
337 | 337 | public function admin_print_scripts_edit_php() { |
338 | 338 | $post_type = wpinv_admin_post_type(); |
339 | 339 | |
340 | - if ( $post_type == 'wpi_item' ) { |
|
341 | - wp_enqueue_script( 'wpinv-inline-edit-post', WPINV_PLUGIN_URL . 'assets/js/quick-edit.js', array( 'jquery', 'inline-edit-post' ), '', true ); |
|
340 | + if ($post_type == 'wpi_item') { |
|
341 | + wp_enqueue_script('wpinv-inline-edit-post', WPINV_PLUGIN_URL . 'assets/js/quick-edit.js', array('jquery', 'inline-edit-post'), '', true); |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
345 | 345 | public function wpinv_actions() { |
346 | - if ( isset( $_REQUEST['wpi_action'] ) ) { |
|
347 | - do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST ); |
|
346 | + if (isset($_REQUEST['wpi_action'])) { |
|
347 | + do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - public function pre_get_posts( $wp_query ) { |
|
352 | - if ( !empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) { |
|
353 | - $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() ); |
|
351 | + public function pre_get_posts($wp_query) { |
|
352 | + if (!empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query()) { |
|
353 | + $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses()); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | return $wp_query; |
357 | 357 | } |
358 | 358 | |
359 | 359 | public function bp_invoicing_init() { |
360 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
|
360 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php'); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | \ No newline at end of file |
@@ -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,26 +91,26 @@ discard block |
||
91 | 91 | <?php if ( 1 < $user_invoices->max_num_pages ) : ?> |
92 | 92 | <div class="invoicing-Pagination"> |
93 | 93 | <?php |
94 | - $big = 999999; |
|
95 | - $wpinv_cpt = isset($_REQUEST['wpinv-cpt']) ? $_REQUEST['wpinv-cpt'] : ''; |
|
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; |
|
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, |
|
109 | - 'add_args' => array( |
|
110 | - 'wpinv-cpt' => 'wpi_invoice', |
|
111 | - ) |
|
112 | - ) ); |
|
113 | - ?> |
|
94 | + $big = 999999; |
|
95 | + $wpinv_cpt = isset($_REQUEST['wpinv-cpt']) ? $_REQUEST['wpinv-cpt'] : ''; |
|
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; |
|
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, |
|
109 | + 'add_args' => array( |
|
110 | + 'wpinv-cpt' => 'wpi_invoice', |
|
111 | + ) |
|
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 = isset($_REQUEST['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 ) ) ), |
@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Details { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | $currency_symbol = wpinv_currency_symbol(); |
10 | 10 | $statuses = wpinv_get_invoice_statuses(); |
11 | 11 | |
12 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
13 | - $invoice = new WPInv_Invoice( $post_id ); |
|
12 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
13 | + $invoice = new WPInv_Invoice($post_id); |
|
14 | 14 | |
15 | - $status = $invoice->get_status( false ); // Current status |
|
15 | + $status = $invoice->get_status(false); // Current status |
|
16 | 16 | $discount = $invoice->get_discount(); |
17 | 17 | $discount_code = $discount > 0 ? $invoice->get_discount_code() : ''; |
18 | 18 | $invoice_number = $invoice->get_number(); |
19 | 19 | |
20 | 20 | $date_created = $invoice->get_created_date(); |
21 | - $datetime_created = strtotime( $date_created ); |
|
22 | - $date_created = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $datetime_created ) : ''; |
|
21 | + $datetime_created = strtotime($date_created); |
|
22 | + $date_created = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $datetime_created) : ''; |
|
23 | 23 | $date_completed = $invoice->get_completed_date(); |
24 | - $date_completed = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $date_completed ) ) : 'n/a'; |
|
25 | - $title['status'] = __( 'Invoice Status:', 'invoicing' ); |
|
26 | - $title['number'] = __( 'Invoice Number:', 'invoicing' ); |
|
27 | - $mail_notice = esc_attr__( 'After save invoice this will send a copy of the invoice to the user’s email address.', 'invoicing' ); |
|
24 | + $date_completed = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($date_completed)) : 'n/a'; |
|
25 | + $title['status'] = __('Invoice Status:', 'invoicing'); |
|
26 | + $title['number'] = __('Invoice Number:', 'invoicing'); |
|
27 | + $mail_notice = esc_attr__('After save invoice this will send a copy of the invoice to the user’s email address.', 'invoicing'); |
|
28 | 28 | |
29 | 29 | $title = apply_filters('wpinv_details_metabox_titles', $title, $invoice); |
30 | 30 | $statuses = apply_filters('wpinv_invoice_statuses', $statuses, $invoice); |
@@ -34,29 +34,29 @@ discard block |
||
34 | 34 | <div class="gdmbx2-wrap form-table"> |
35 | 35 | <div class="gdmbx2-metabox gdmbx-field-list" id="gdmbx2-metabox-wpinv_details"> |
36 | 36 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-created"> |
37 | - <div class="gdmbx-th"><label><?php _e( 'Date Created:', 'invoicing' );?></label></div> |
|
38 | - <div class="gdmbx-td"><?php echo $date_created;?></div> |
|
37 | + <div class="gdmbx-th"><label><?php _e('Date Created:', 'invoicing'); ?></label></div> |
|
38 | + <div class="gdmbx-td"><?php echo $date_created; ?></div> |
|
39 | 39 | </div> |
40 | - <?php if ( wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->has_status( array( 'auto-draft' ) ) ) ) { ?> |
|
40 | + <?php if (wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->has_status(array('auto-draft')))) { ?> |
|
41 | 41 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-overdue"> |
42 | - <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e( 'Due Date:', 'invoicing' );?></label></div> |
|
42 | + <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e('Due Date:', 'invoicing'); ?></label></div> |
|
43 | 43 | <div class="gdmbx-td"> |
44 | - <input type="text" placeholder="<?php esc_attr_e( 'Y-m-d', 'invoicing' );?>" value="<?php echo esc_attr( $invoice->get_due_date() );?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr( date_i18n( 'Y-m-d', $datetime_created ) );?>" data-dateFormat="yy-mm-dd"> |
|
44 | + <input type="text" placeholder="<?php esc_attr_e('Y-m-d', 'invoicing'); ?>" value="<?php echo esc_attr($invoice->get_due_date()); ?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr(date_i18n('Y-m-d', $datetime_created)); ?>" data-dateFormat="yy-mm-dd"> |
|
45 | 45 | </div> |
46 | 46 | </div> |
47 | 47 | <?php } ?> |
48 | - <?php if ( $date_completed && $date_completed != 'n/a' ) { ?> |
|
48 | + <?php if ($date_completed && $date_completed != 'n/a') { ?> |
|
49 | 49 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-completed"> |
50 | - <div class="gdmbx-th"><label><?php _e( 'Payment Date:', 'invoicing' );?></label></div> |
|
51 | - <div class="gdmbx-td"><?php echo $date_completed;?></div> |
|
50 | + <div class="gdmbx-th"><label><?php _e('Payment Date:', 'invoicing'); ?></label></div> |
|
51 | + <div class="gdmbx-td"><?php echo $date_completed; ?></div> |
|
52 | 52 | </div> |
53 | 53 | <?php } ?> |
54 | 54 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-status"> |
55 | 55 | <div class="gdmbx-th"><label for="wpinv_status"><?php echo $title['status']; ?></label></div> |
56 | 56 | <div class="gdmbx-td"> |
57 | 57 | <select required="required" id="wpinv_status" name="wpinv_status" class="gdmbx2_select"> |
58 | - <?php foreach ( $statuses as $value => $label ) { ?> |
|
59 | - <option value="<?php echo $value;?>" <?php selected( $status, $value );?>><?php echo $label;?></option> |
|
58 | + <?php foreach ($statuses as $value => $label) { ?> |
|
59 | + <option value="<?php echo $value; ?>" <?php selected($status, $value); ?>><?php echo $label; ?></option> |
|
60 | 60 | <?php } ?> |
61 | 61 | </select> |
62 | 62 | </div> |
@@ -64,107 +64,107 @@ discard block |
||
64 | 64 | <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-number table-layout"> |
65 | 65 | <div class="gdmbx-th"><label for="wpinv_number"><?php echo $title['number']; ?></label></div> |
66 | 66 | <div class="gdmbx-td"> |
67 | - <input type="text" placeholder="<?php echo esc_attr( wpinv_format_invoice_number( 1 ) ); ?>" value="<?php echo esc_attr( $invoice_number );?>" id="wpinv_number" name="wpinv_number" class="regular-text"> |
|
67 | + <input type="text" placeholder="<?php echo esc_attr(wpinv_format_invoice_number(1)); ?>" value="<?php echo esc_attr($invoice_number); ?>" id="wpinv_number" name="wpinv_number" class="regular-text"> |
|
68 | 68 | </div> |
69 | 69 | </div> |
70 | - <?php do_action( 'wpinv_meta_box_details_inner', $post_id ); ?> |
|
71 | - <?php if ( !( $is_paid = $invoice->is_paid() ) || $discount_code ) { ?> |
|
70 | + <?php do_action('wpinv_meta_box_details_inner', $post_id); ?> |
|
71 | + <?php if (!($is_paid = $invoice->is_paid()) || $discount_code) { ?> |
|
72 | 72 | <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-discount-code table-layout"> |
73 | - <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e( 'Discount Code:', 'invoicing' );?></label></div> |
|
73 | + <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e('Discount Code:', 'invoicing'); ?></label></div> |
|
74 | 74 | <div class="gdmbx-td"> |
75 | - <input type="text" value="<?php echo esc_attr( $discount_code ); ?>" id="wpinv_discount" class="medium-text" <?php echo ( $discount_code ? 'readonly' : '' ); ?> /><?php if ( !$is_paid ) { ?><input value="<?php echo esc_attr_e( 'Apply', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-hide' : 'wpi-inlineb' ); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e( 'Remove', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-inlineb' : 'wpi-hide' ); ?>" id="wpinv-remove-code" type="button" /><?php } ?> |
|
75 | + <input type="text" value="<?php echo esc_attr($discount_code); ?>" id="wpinv_discount" class="medium-text" <?php echo ($discount_code ? 'readonly' : ''); ?> /><?php if (!$is_paid) { ?><input value="<?php echo esc_attr_e('Apply', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-hide' : 'wpi-inlineb'); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e('Remove', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-inlineb' : 'wpi-hide'); ?>" id="wpinv-remove-code" type="button" /><?php } ?> |
|
76 | 76 | </div> |
77 | 77 | </div> |
78 | 78 | <?php } ?> |
79 | 79 | </div> |
80 | 80 | </div> |
81 | 81 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-save-send table-layout"> |
82 | - <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__( 'Send %s:', 'invoicing' ),$post_obj->labels->singular_name) ; ?></label> |
|
82 | + <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__('Send %s:', 'invoicing'), $post_obj->labels->singular_name); ?></label> |
|
83 | 83 | <select id="wpi_save_send" name="wpi_save_send"> |
84 | - <option value="1"><?php _e( 'Yes', 'invoicing' ); ?></option> |
|
85 | - <option value="" selected="selected"><?php _e( 'No', 'invoicing' ); ?></option> |
|
84 | + <option value="1"><?php _e('Yes', 'invoicing'); ?></option> |
|
85 | + <option value="" selected="selected"><?php _e('No', 'invoicing'); ?></option> |
|
86 | 86 | </select> |
87 | 87 | </p> |
88 | 88 | <p class="wpi-meta-row wpi-send-info"><?php echo $mail_notice; ?></p> |
89 | 89 | </div> |
90 | -<?php wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ;?> |
|
90 | +<?php wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); ?> |
|
91 | 91 | <?php |
92 | 92 | } |
93 | 93 | |
94 | - public static function resend_invoice( $post ) { |
|
94 | + public static function resend_invoice($post) { |
|
95 | 95 | global $wpi_mb_invoice; |
96 | 96 | |
97 | - if ( empty( $wpi_mb_invoice ) ) { |
|
97 | + if (empty($wpi_mb_invoice)) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | |
101 | 101 | $text = array( |
102 | - 'message' => esc_attr__( 'This will send a copy of the invoice to the customer’s email address.', 'invoicing' ), |
|
103 | - 'button_text' => __( 'Resend Invoice', 'invoicing' ), |
|
102 | + 'message' => esc_attr__('This will send a copy of the invoice to the customer’s email address.', 'invoicing'), |
|
103 | + 'button_text' => __('Resend Invoice', 'invoicing'), |
|
104 | 104 | ); |
105 | 105 | |
106 | 106 | $text = apply_filters('wpinv_resend_invoice_metabox_text', $text); |
107 | - do_action( 'wpinv_metabox_resend_invoice_before', $wpi_mb_invoice ); |
|
107 | + do_action('wpinv_metabox_resend_invoice_before', $wpi_mb_invoice); |
|
108 | 108 | |
109 | - if ( $email = $wpi_mb_invoice->get_email() ) { |
|
109 | + if ($email = $wpi_mb_invoice->get_email()) { |
|
110 | 110 | $email_actions = array(); |
111 | - $email_actions['email_url'] = add_query_arg( array( 'wpi_action' => 'send_invoice', 'invoice_id' => $post->ID ) ); |
|
112 | - $email_actions['reminder_url'] = add_query_arg( array( 'wpi_action' => 'send_reminder', 'invoice_id' => $post->ID ) ); |
|
111 | + $email_actions['email_url'] = add_query_arg(array('wpi_action' => 'send_invoice', 'invoice_id' => $post->ID)); |
|
112 | + $email_actions['reminder_url'] = add_query_arg(array('wpi_action' => 'send_reminder', 'invoice_id' => $post->ID)); |
|
113 | 113 | |
114 | - $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions ); |
|
114 | + $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions); |
|
115 | 115 | ?> |
116 | 116 | <p class="wpi-meta-row wpi-resend-info"><?php echo $text['message']; ?></p> |
117 | - <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url( $email_actions['email_url'] ); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p> |
|
118 | - <?php if ( wpinv_get_option( 'overdue_active' ) && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ( $due_date = $wpi_mb_invoice->get_due_date() ) ) { ?> |
|
119 | - <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e( 'Send overdue reminder notification to customer', 'invoicing' ); ?>" href="<?php echo esc_url( $email_actions['reminder_url'] ); ?>" class="button button-secondary"><?php esc_attr_e( 'Send Reminder', 'invoicing' ); ?></a></p> |
|
117 | + <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url($email_actions['email_url']); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p> |
|
118 | + <?php if (wpinv_get_option('overdue_active') && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ($due_date = $wpi_mb_invoice->get_due_date())) { ?> |
|
119 | + <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e('Send overdue reminder notification to customer', 'invoicing'); ?>" href="<?php echo esc_url($email_actions['reminder_url']); ?>" class="button button-secondary"><?php esc_attr_e('Send Reminder', 'invoicing'); ?></a></p> |
|
120 | 120 | <?php } ?> |
121 | 121 | <?php |
122 | 122 | } |
123 | 123 | |
124 | - do_action( 'wpinv_metabox_resend_invoice_after', $wpi_mb_invoice ); |
|
124 | + do_action('wpinv_metabox_resend_invoice_after', $wpi_mb_invoice); |
|
125 | 125 | } |
126 | 126 | |
127 | - public static function subscriptions( $post ) { |
|
127 | + public static function subscriptions($post) { |
|
128 | 128 | global $wpi_mb_invoice; |
129 | 129 | |
130 | 130 | $invoice = $wpi_mb_invoice; |
131 | 131 | |
132 | - if ( !empty( $invoice ) && $invoice->is_recurring() && $invoice->is_parent() ) { |
|
132 | + if (!empty($invoice) && $invoice->is_recurring() && $invoice->is_parent()) { |
|
133 | 133 | $payments = $invoice->get_child_payments(); |
134 | 134 | |
135 | 135 | $total_payments = (int)$invoice->get_total_payments(); |
136 | 136 | $subscription = $invoice->get_subscription_data(); |
137 | 137 | |
138 | - $billing_cycle = wpinv_get_billing_cycle( $subscription['initial_amount'], $subscription['recurring_amount'], $subscription['period'], $subscription['interval'], $subscription['bill_times'], $subscription['trial_period'], $subscription['trial_interval'], $invoice->get_currency() ); |
|
139 | - $times_billed = $total_payments . ' / ' . ( ( (int)$subscription['bill_times'] == 0 ) ? __( 'Until cancelled', 'invoicing' ) : $subscription['bill_times'] ); |
|
138 | + $billing_cycle = wpinv_get_billing_cycle($subscription['initial_amount'], $subscription['recurring_amount'], $subscription['period'], $subscription['interval'], $subscription['bill_times'], $subscription['trial_period'], $subscription['trial_interval'], $invoice->get_currency()); |
|
139 | + $times_billed = $total_payments . ' / ' . (((int)$subscription['bill_times'] == 0) ? __('Until cancelled', 'invoicing') : $subscription['bill_times']); |
|
140 | 140 | $subscription_status = $invoice->get_subscription_status(); |
141 | 141 | ?> |
142 | - <p class="wpi-meta-row wpi-sub-label"><?php _e( 'Recurring Payment', 'invoicing' );?></p> |
|
143 | - <?php if ( $subscription_id = $invoice->get_subscription_id() ) { ?> |
|
144 | - <p class="wpi-meta-row wpi-sub-id"><label><?php _e( 'Subscription ID:', 'invoicing' );?> </label><?php echo $subscription_id; ?></p> |
|
142 | + <p class="wpi-meta-row wpi-sub-label"><?php _e('Recurring Payment', 'invoicing'); ?></p> |
|
143 | + <?php if ($subscription_id = $invoice->get_subscription_id()) { ?> |
|
144 | + <p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><?php echo $subscription_id; ?></p> |
|
145 | 145 | <?php } ?> |
146 | - <p class="wpi-meta-row wpi-bill-cycle"><label><?php _e( 'Billing Cycle:', 'invoicing' );?> </label><?php echo $billing_cycle; ?></p> |
|
147 | - <p class="wpi-meta-row wpi-billed-times"><label><?php _e( 'Times Billed:', 'invoicing' );?> </label><?php echo $times_billed; ?></p> |
|
148 | - <?php if ( !empty( $payments ) || $invoice->is_paid() ) { ?> |
|
149 | - <p class="wpi-meta-row wpi-start-date"><label><?php _e( 'Start Date:', 'invoicing' );?> </label><?php echo $invoice->get_subscription_start(); ?></p> |
|
150 | - <p class="wpi-meta-row wpi-end-date"><label><?php _e( 'Expiration Date:', 'invoicing' );?> </label><?php echo $invoice->get_subscription_end(); ?></p> |
|
151 | - <?php if ( $status_label = $invoice->get_subscription_status_label( $subscription_status ) ) { ?> |
|
152 | - <p class="wpi-meta-row wpi-sub-status"><label><?php _e( 'Subscription Status:', 'invoicing' );?> </label><?php echo $status_label; ?></p> |
|
146 | + <p class="wpi-meta-row wpi-bill-cycle"><label><?php _e('Billing Cycle:', 'invoicing'); ?> </label><?php echo $billing_cycle; ?></p> |
|
147 | + <p class="wpi-meta-row wpi-billed-times"><label><?php _e('Times Billed:', 'invoicing'); ?> </label><?php echo $times_billed; ?></p> |
|
148 | + <?php if (!empty($payments) || $invoice->is_paid()) { ?> |
|
149 | + <p class="wpi-meta-row wpi-start-date"><label><?php _e('Start Date:', 'invoicing'); ?> </label><?php echo $invoice->get_subscription_start(); ?></p> |
|
150 | + <p class="wpi-meta-row wpi-end-date"><label><?php _e('Expiration Date:', 'invoicing'); ?> </label><?php echo $invoice->get_subscription_end(); ?></p> |
|
151 | + <?php if ($status_label = $invoice->get_subscription_status_label($subscription_status)) { ?> |
|
152 | + <p class="wpi-meta-row wpi-sub-status"><label><?php _e('Subscription Status:', 'invoicing'); ?> </label><?php echo $status_label; ?></p> |
|
153 | 153 | <?php } ?> |
154 | - <?php if ( $subscription_status == 'trialing' && $trial_end_date = $invoice->get_trial_end_date() ) { ?> |
|
155 | - <p class="wpi-meta-row wpi-trial-date"><label><?php _e( 'Trial Until:', 'invoicing' );?> </label><?php echo $trial_end_date; ?></p> |
|
154 | + <?php if ($subscription_status == 'trialing' && $trial_end_date = $invoice->get_trial_end_date()) { ?> |
|
155 | + <p class="wpi-meta-row wpi-trial-date"><label><?php _e('Trial Until:', 'invoicing'); ?> </label><?php echo $trial_end_date; ?></p> |
|
156 | 156 | <?php } ?> |
157 | - <?php if ( $cancelled_date = $invoice->get_cancelled_date() ) { ?> |
|
158 | - <p class="wpi-meta-row wpi-cancel-date"><label><?php _e( 'Cancelled On:', 'invoicing' );?> </label><?php echo $cancelled_date; ?></p> |
|
157 | + <?php if ($cancelled_date = $invoice->get_cancelled_date()) { ?> |
|
158 | + <p class="wpi-meta-row wpi-cancel-date"><label><?php _e('Cancelled On:', 'invoicing'); ?> </label><?php echo $cancelled_date; ?></p> |
|
159 | 159 | <?php } ?> |
160 | - <?php if ( !empty( $payments ) ) { ?> |
|
161 | - <p><strong><?php _e( 'Renewal Payments:', 'invoicing' ); ?></strong></p> |
|
160 | + <?php if (!empty($payments)) { ?> |
|
161 | + <p><strong><?php _e('Renewal Payments:', 'invoicing'); ?></strong></p> |
|
162 | 162 | <ul id="wpi-sub-payments"> |
163 | - <?php foreach ( $payments as $invoice_id ) { ?> |
|
163 | + <?php foreach ($payments as $invoice_id) { ?> |
|
164 | 164 | <li> |
165 | - <a href="<?php echo esc_url( get_edit_post_link( $invoice_id ) ); ?>"><?php echo wpinv_get_invoice_number( $invoice_id ); ?></a> – |
|
166 | - <span><?php echo wpinv_get_invoice_date( $invoice_id ); ?> – </span> |
|
167 | - <span><?php echo wpinv_payment_total( $invoice_id, true ); ?></span> |
|
165 | + <a href="<?php echo esc_url(get_edit_post_link($invoice_id)); ?>"><?php echo wpinv_get_invoice_number($invoice_id); ?></a> – |
|
166 | + <span><?php echo wpinv_get_invoice_date($invoice_id); ?> – </span> |
|
167 | + <span><?php echo wpinv_payment_total($invoice_id, true); ?></span> |
|
168 | 168 | </li> |
169 | 169 | <?php } ?> |
170 | 170 | </ul> |
@@ -172,47 +172,47 @@ discard block |
||
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | - public static function renewals( $post ) { |
|
175 | + public static function renewals($post) { |
|
176 | 176 | global $wpi_mb_invoice; |
177 | 177 | |
178 | - if ( wpinv_is_subscription_payment( $wpi_mb_invoice ) ) { |
|
179 | - $parent_url = get_edit_post_link( $wpi_mb_invoice->parent_invoice ); |
|
180 | - $parent_id = wpinv_get_invoice_number( $wpi_mb_invoice->parent_invoice ); |
|
178 | + if (wpinv_is_subscription_payment($wpi_mb_invoice)) { |
|
179 | + $parent_url = get_edit_post_link($wpi_mb_invoice->parent_invoice); |
|
180 | + $parent_id = wpinv_get_invoice_number($wpi_mb_invoice->parent_invoice); |
|
181 | 181 | ?> |
182 | - <p class="wpi-meta-row wpi-sub-id"><label><?php _e( 'Subscription ID:', 'invoicing' );?> </label><?php echo $wpi_mb_invoice->get_subscription_id(); ?></p> |
|
183 | - <p class="wpi-meta-row wpi-parent-id"><label><?php _e( 'Parent Invoice:', 'invoicing' );?> </label><a href="<?php echo esc_url( $parent_url ); ?>"><?php echo $parent_id; ?></a></p> |
|
182 | + <p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><?php echo $wpi_mb_invoice->get_subscription_id(); ?></p> |
|
183 | + <p class="wpi-meta-row wpi-parent-id"><label><?php _e('Parent Invoice:', 'invoicing'); ?> </label><a href="<?php echo esc_url($parent_url); ?>"><?php echo $parent_id; ?></a></p> |
|
184 | 184 | <?php |
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | - public static function payment_meta( $post ) { |
|
188 | + public static function payment_meta($post) { |
|
189 | 189 | global $wpi_mb_invoice; |
190 | 190 | |
191 | - $set_dateway = empty( $wpi_mb_invoice->gateway ) ? true : false; |
|
192 | - if ( !$set_dateway && !$wpi_mb_invoice->get_meta( '_wpinv_checkout', true ) && !$wpi_mb_invoice->is_paid() ) { |
|
191 | + $set_dateway = empty($wpi_mb_invoice->gateway) ? true : false; |
|
192 | + if (!$set_dateway && !$wpi_mb_invoice->get_meta('_wpinv_checkout', true) && !$wpi_mb_invoice->is_paid()) { |
|
193 | 193 | $set_dateway = true; |
194 | 194 | } |
195 | 195 | |
196 | 196 | ?> |
197 | 197 | <p class="wpi-meta-row"> |
198 | - <?php if ( $set_dateway ) { $gateways = wpinv_get_enabled_payment_gateways( true ); ?> |
|
199 | - <label for="wpinv_gateway"><?php _e( 'Gateway:', 'invoicing' ) ; ?></label> |
|
198 | + <?php if ($set_dateway) { $gateways = wpinv_get_enabled_payment_gateways(true); ?> |
|
199 | + <label for="wpinv_gateway"><?php _e('Gateway:', 'invoicing'); ?></label> |
|
200 | 200 | <select required="required" id="wpinv_gateway" name="wpinv_gateway"> |
201 | - <?php foreach ( $gateways as $name => $gateway ) { |
|
202 | - if ( $wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription( $name ) ) { |
|
201 | + <?php foreach ($gateways as $name => $gateway) { |
|
202 | + if ($wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription($name)) { |
|
203 | 203 | continue; |
204 | 204 | } |
205 | 205 | ?> |
206 | - <option value="<?php echo $name;?>" <?php selected( $wpi_mb_invoice->gateway, $name );?>><?php echo !empty( $gateway['admin_label'] ) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option> |
|
206 | + <option value="<?php echo $name; ?>" <?php selected($wpi_mb_invoice->gateway, $name); ?>><?php echo !empty($gateway['admin_label']) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option> |
|
207 | 207 | <?php } ?> |
208 | 208 | </select> |
209 | 209 | <?php } else { |
210 | - echo wp_sprintf( __( '<label>Gateway:</label> %s', 'invoicing' ), wpinv_get_gateway_checkout_label( $wpi_mb_invoice->gateway ) ); |
|
210 | + echo wp_sprintf(__('<label>Gateway:</label> %s', 'invoicing'), wpinv_get_gateway_checkout_label($wpi_mb_invoice->gateway)); |
|
211 | 211 | } ?> |
212 | 212 | </p> |
213 | - <?php if ( $wpi_mb_invoice->is_paid() ) { ?> |
|
214 | - <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Key:</label> %s', 'invoicing' ), $wpi_mb_invoice->get_key() ); ?></p> |
|
215 | - <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Transaction ID:</label> %s', 'invoicing' ), wpinv_payment_link_transaction_id( $wpi_mb_invoice ) ); ?></p> |
|
213 | + <?php if ($wpi_mb_invoice->is_paid()) { ?> |
|
214 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Key:</label> %s', 'invoicing'), $wpi_mb_invoice->get_key()); ?></p> |
|
215 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Transaction ID:</label> %s', 'invoicing'), wpinv_payment_link_transaction_id($wpi_mb_invoice)); ?></p> |
|
216 | 216 | <?php } ?> |
217 | 217 | <?php |
218 | 218 | } |
@@ -664,6 +664,9 @@ discard block |
||
664 | 664 | return $sent; |
665 | 665 | } |
666 | 666 | |
667 | +/** |
|
668 | + * @return string |
|
669 | + */ |
|
667 | 670 | function wpinv_mail_get_from_address() { |
668 | 671 | $from_address = apply_filters( 'wpinv_mail_from_address', wpinv_get_option( 'email_from' ) ); |
669 | 672 | return sanitize_email( $from_address ); |
@@ -1123,6 +1126,9 @@ discard block |
||
1123 | 1126 | } |
1124 | 1127 | add_filter( 'wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1 ); |
1125 | 1128 | |
1129 | +/** |
|
1130 | + * @param string $email_type |
|
1131 | + */ |
|
1126 | 1132 | function wpinv_email_is_enabled( $email_type ) { |
1127 | 1133 | $emails = wpinv_get_emails(); |
1128 | 1134 | $enabled = isset( $emails[$email_type] ) && wpinv_get_option( $email_type . '_active', 0 ) ? true : false; |
@@ -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,53 +570,53 @@ 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 | 593 | |
594 | - $invoice->add_note( $note, '', '', true ); // Add system note. |
|
594 | + $invoice->add_note($note, '', '', true); // Add system note. |
|
595 | 595 | |
596 | - if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
|
597 | - $recipient = wpinv_get_admin_email(); |
|
598 | - $subject .= ' - ADMIN BCC COPY'; |
|
599 | - wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
596 | + if (wpinv_mail_admin_bcc_active($email_type)) { |
|
597 | + $recipient = wpinv_get_admin_email(); |
|
598 | + $subject .= ' - ADMIN BCC COPY'; |
|
599 | + wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | return $sent; |
603 | 603 | } |
604 | 604 | |
605 | -function wpinv_user_note_notification( $invoice_id, $args = array() ) { |
|
605 | +function wpinv_user_note_notification($invoice_id, $args = array()) { |
|
606 | 606 | global $wpinv_email_search, $wpinv_email_replace; |
607 | 607 | |
608 | 608 | $email_type = 'user_note'; |
609 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
609 | + if (!wpinv_email_is_enabled($email_type)) { |
|
610 | 610 | return false; |
611 | 611 | } |
612 | 612 | |
613 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
614 | - if ( empty( $invoice ) ) { |
|
613 | + $invoice = wpinv_get_invoice($invoice_id); |
|
614 | + if (empty($invoice)) { |
|
615 | 615 | return false; |
616 | 616 | } |
617 | 617 | |
618 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
619 | - if ( !is_email( $recipient ) ) { |
|
618 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
619 | + if (!is_email($recipient)) { |
|
620 | 620 | return false; |
621 | 621 | } |
622 | 622 | |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | 'user_note' => '' |
625 | 625 | ); |
626 | 626 | |
627 | - $args = wp_parse_args( $args, $defaults ); |
|
627 | + $args = wp_parse_args($args, $defaults); |
|
628 | 628 | |
629 | 629 | $search = array(); |
630 | 630 | $search['invoice_number'] = '{invoice_number}'; |
@@ -643,46 +643,46 @@ discard block |
||
643 | 643 | $wpinv_email_search = $search; |
644 | 644 | $wpinv_email_replace = $replace; |
645 | 645 | |
646 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
647 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
648 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
649 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
646 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
647 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
648 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
649 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
650 | 650 | |
651 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
651 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
652 | 652 | 'invoice' => $invoice, |
653 | 653 | 'email_type' => $email_type, |
654 | 654 | 'email_heading' => $email_heading, |
655 | 655 | 'sent_to_admin' => false, |
656 | 656 | 'plain_text' => false, |
657 | 657 | 'customer_note' => $args['user_note'] |
658 | - ) ); |
|
658 | + )); |
|
659 | 659 | |
660 | - $content = wpinv_email_format_text( $content ); |
|
660 | + $content = wpinv_email_format_text($content); |
|
661 | 661 | |
662 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
662 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
663 | 663 | |
664 | 664 | return $sent; |
665 | 665 | } |
666 | 666 | |
667 | 667 | function wpinv_mail_get_from_address() { |
668 | - $from_address = apply_filters( 'wpinv_mail_from_address', wpinv_get_option( 'email_from' ) ); |
|
669 | - return sanitize_email( $from_address ); |
|
668 | + $from_address = apply_filters('wpinv_mail_from_address', wpinv_get_option('email_from')); |
|
669 | + return sanitize_email($from_address); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | function wpinv_mail_get_from_name() { |
673 | - $from_name = apply_filters( 'wpinv_mail_from_name', wpinv_get_option( 'email_from_name' ) ); |
|
674 | - return wp_specialchars_decode( esc_html( $from_name ), ENT_QUOTES ); |
|
673 | + $from_name = apply_filters('wpinv_mail_from_name', wpinv_get_option('email_from_name')); |
|
674 | + return wp_specialchars_decode(esc_html($from_name), ENT_QUOTES); |
|
675 | 675 | } |
676 | 676 | |
677 | -function wpinv_mail_admin_bcc_active( $mail_type = '' ) { |
|
678 | - $active = apply_filters( 'wpinv_mail_admin_bcc_active', wpinv_get_option( 'email_' . $mail_type . '_admin_bcc' ) ); |
|
679 | - return ( $active ? true : false ); |
|
677 | +function wpinv_mail_admin_bcc_active($mail_type = '') { |
|
678 | + $active = apply_filters('wpinv_mail_admin_bcc_active', wpinv_get_option('email_' . $mail_type . '_admin_bcc')); |
|
679 | + return ($active ? true : false); |
|
680 | 680 | } |
681 | 681 | |
682 | -function wpinv_mail_get_content_type( $content_type = 'text/html', $email_type = 'html' ) { |
|
683 | - $email_type = apply_filters( 'wpinv_mail_content_type', $email_type ); |
|
682 | +function wpinv_mail_get_content_type($content_type = 'text/html', $email_type = 'html') { |
|
683 | + $email_type = apply_filters('wpinv_mail_content_type', $email_type); |
|
684 | 684 | |
685 | - switch ( $email_type ) { |
|
685 | + switch ($email_type) { |
|
686 | 686 | case 'html' : |
687 | 687 | $content_type = 'text/html'; |
688 | 688 | break; |
@@ -697,35 +697,35 @@ discard block |
||
697 | 697 | return $content_type; |
698 | 698 | } |
699 | 699 | |
700 | -function wpinv_mail_send( $to, $subject, $message, $headers, $attachments ) { |
|
701 | - add_filter( 'wp_mail_from', 'wpinv_mail_get_from_address' ); |
|
702 | - add_filter( 'wp_mail_from_name', 'wpinv_mail_get_from_name' ); |
|
703 | - add_filter( 'wp_mail_content_type', 'wpinv_mail_get_content_type' ); |
|
700 | +function wpinv_mail_send($to, $subject, $message, $headers, $attachments) { |
|
701 | + add_filter('wp_mail_from', 'wpinv_mail_get_from_address'); |
|
702 | + add_filter('wp_mail_from_name', 'wpinv_mail_get_from_name'); |
|
703 | + add_filter('wp_mail_content_type', 'wpinv_mail_get_content_type'); |
|
704 | 704 | |
705 | - $message = wpinv_email_style_body( $message ); |
|
706 | - $message = apply_filters( 'wpinv_mail_content', $message ); |
|
705 | + $message = wpinv_email_style_body($message); |
|
706 | + $message = apply_filters('wpinv_mail_content', $message); |
|
707 | 707 | |
708 | - $sent = wp_mail( $to, $subject, $message, $headers, $attachments ); |
|
708 | + $sent = wp_mail($to, $subject, $message, $headers, $attachments); |
|
709 | 709 | |
710 | - if ( !$sent ) { |
|
711 | - $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 ); |
|
712 | - wpinv_error_log( $log_message, __( "Email from Invoicing plugin failed to send", 'invoicing' ), __FILE__, __LINE__ ); |
|
710 | + if (!$sent) { |
|
711 | + $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); |
|
712 | + wpinv_error_log($log_message, __("Email from Invoicing plugin failed to send", 'invoicing'), __FILE__, __LINE__); |
|
713 | 713 | } |
714 | 714 | |
715 | - remove_filter( 'wp_mail_from', 'wpinv_mail_get_from_address' ); |
|
716 | - remove_filter( 'wp_mail_from_name', 'wpinv_mail_get_from_name' ); |
|
717 | - remove_filter( 'wp_mail_content_type', 'wpinv_mail_get_content_type' ); |
|
715 | + remove_filter('wp_mail_from', 'wpinv_mail_get_from_address'); |
|
716 | + remove_filter('wp_mail_from_name', 'wpinv_mail_get_from_name'); |
|
717 | + remove_filter('wp_mail_content_type', 'wpinv_mail_get_content_type'); |
|
718 | 718 | |
719 | 719 | return $sent; |
720 | 720 | } |
721 | 721 | |
722 | 722 | function wpinv_get_emails() { |
723 | 723 | $overdue_days_options = array(); |
724 | - $overdue_days_options[0] = __( 'On the Due Date', 'invoicing' ); |
|
725 | - $overdue_days_options[1] = __( '1 day after Due Date', 'invoicing' ); |
|
724 | + $overdue_days_options[0] = __('On the Due Date', 'invoicing'); |
|
725 | + $overdue_days_options[1] = __('1 day after Due Date', 'invoicing'); |
|
726 | 726 | |
727 | - for ( $i = 2; $i <= 10; $i++ ) { |
|
728 | - $overdue_days_options[$i] = wp_sprintf( __( '%d days after Due Date', 'invoicing' ), $i ); |
|
727 | + for ($i = 2; $i <= 10; $i++) { |
|
728 | + $overdue_days_options[$i] = wp_sprintf(__('%d days after Due Date', 'invoicing'), $i); |
|
729 | 729 | } |
730 | 730 | |
731 | 731 | // Default, built-in gateways |
@@ -733,130 +733,130 @@ discard block |
||
733 | 733 | 'new_invoice' => array( |
734 | 734 | 'email_new_invoice_header' => array( |
735 | 735 | 'id' => 'email_new_invoice_header', |
736 | - 'name' => '<h3>' . __( 'New Invoice', 'invoicing' ) . '</h3>', |
|
737 | - 'desc' => __( 'New invoice emails are sent to admin when a new invoice is received.', 'invoicing' ), |
|
736 | + 'name' => '<h3>' . __('New Invoice', 'invoicing') . '</h3>', |
|
737 | + 'desc' => __('New invoice emails are sent to admin when a new invoice is received.', 'invoicing'), |
|
738 | 738 | 'type' => 'header', |
739 | 739 | ), |
740 | 740 | 'email_new_invoice_active' => array( |
741 | 741 | 'id' => 'email_new_invoice_active', |
742 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
743 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
742 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
743 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
744 | 744 | 'type' => 'checkbox', |
745 | 745 | 'std' => 1 |
746 | 746 | ), |
747 | 747 | 'email_new_invoice_subject' => array( |
748 | 748 | 'id' => 'email_new_invoice_subject', |
749 | - 'name' => __( 'Subject', 'invoicing' ), |
|
750 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
749 | + 'name' => __('Subject', 'invoicing'), |
|
750 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
751 | 751 | 'type' => 'text', |
752 | - 'std' => __( '[{site_title}] New payment invoice ({invoice_number}) - {invoice_date}', 'invoicing' ), |
|
752 | + 'std' => __('[{site_title}] New payment invoice ({invoice_number}) - {invoice_date}', 'invoicing'), |
|
753 | 753 | 'size' => 'large' |
754 | 754 | ), |
755 | 755 | 'email_new_invoice_heading' => array( |
756 | 756 | 'id' => 'email_new_invoice_heading', |
757 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
758 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
757 | + 'name' => __('Email Heading', 'invoicing'), |
|
758 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
759 | 759 | 'type' => 'text', |
760 | - 'std' => __( 'New payment invoice', 'invoicing' ), |
|
760 | + 'std' => __('New payment invoice', 'invoicing'), |
|
761 | 761 | 'size' => 'large' |
762 | 762 | ), |
763 | 763 | ), |
764 | 764 | 'cancelled_invoice' => array( |
765 | 765 | 'email_cancelled_invoice_header' => array( |
766 | 766 | 'id' => 'email_cancelled_invoice_header', |
767 | - 'name' => '<h3>' . __( 'Cancelled Invoice', 'invoicing' ) . '</h3>', |
|
768 | - 'desc' => __( 'Cancelled invoice emails are sent to admin when invoices have been marked cancelled.', 'invoicing' ), |
|
767 | + 'name' => '<h3>' . __('Cancelled Invoice', 'invoicing') . '</h3>', |
|
768 | + 'desc' => __('Cancelled invoice emails are sent to admin when invoices have been marked cancelled.', 'invoicing'), |
|
769 | 769 | 'type' => 'header', |
770 | 770 | ), |
771 | 771 | 'email_cancelled_invoice_active' => array( |
772 | 772 | 'id' => 'email_cancelled_invoice_active', |
773 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
774 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
773 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
774 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
775 | 775 | 'type' => 'checkbox', |
776 | 776 | 'std' => 1 |
777 | 777 | ), |
778 | 778 | 'email_cancelled_invoice_subject' => array( |
779 | 779 | 'id' => 'email_cancelled_invoice_subject', |
780 | - 'name' => __( 'Subject', 'invoicing' ), |
|
781 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
780 | + 'name' => __('Subject', 'invoicing'), |
|
781 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
782 | 782 | 'type' => 'text', |
783 | - 'std' => __( '[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing' ), |
|
783 | + 'std' => __('[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing'), |
|
784 | 784 | 'size' => 'large' |
785 | 785 | ), |
786 | 786 | 'email_cancelled_invoice_heading' => array( |
787 | 787 | 'id' => 'email_cancelled_invoice_heading', |
788 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
789 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
788 | + 'name' => __('Email Heading', 'invoicing'), |
|
789 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
790 | 790 | 'type' => 'text', |
791 | - 'std' => __( 'Cancelled invoice', 'invoicing' ), |
|
791 | + 'std' => __('Cancelled invoice', 'invoicing'), |
|
792 | 792 | 'size' => 'large' |
793 | 793 | ), |
794 | 794 | ), |
795 | 795 | 'failed_invoice' => array( |
796 | 796 | 'email_failed_invoice_header' => array( |
797 | 797 | 'id' => 'email_failed_invoice_header', |
798 | - 'name' => '<h3>' . __( 'Failed Invoice', 'invoicing' ) . '</h3>', |
|
799 | - 'desc' => __( 'Failed invoice emails are sent to admin when invoices have been marked failed (if they were previously processing or on-hold).', 'invoicing' ), |
|
798 | + 'name' => '<h3>' . __('Failed Invoice', 'invoicing') . '</h3>', |
|
799 | + 'desc' => __('Failed invoice emails are sent to admin when invoices have been marked failed (if they were previously processing or on-hold).', 'invoicing'), |
|
800 | 800 | 'type' => 'header', |
801 | 801 | ), |
802 | 802 | 'email_failed_invoice_active' => array( |
803 | 803 | 'id' => 'email_failed_invoice_active', |
804 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
805 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
804 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
805 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
806 | 806 | 'type' => 'checkbox', |
807 | 807 | 'std' => 1 |
808 | 808 | ), |
809 | 809 | 'email_failed_invoice_subject' => array( |
810 | 810 | 'id' => 'email_failed_invoice_subject', |
811 | - 'name' => __( 'Subject', 'invoicing' ), |
|
812 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
811 | + 'name' => __('Subject', 'invoicing'), |
|
812 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
813 | 813 | 'type' => 'text', |
814 | - 'std' => __( '[{site_title}] Failed invoice ({invoice_number})', 'invoicing' ), |
|
814 | + 'std' => __('[{site_title}] Failed invoice ({invoice_number})', 'invoicing'), |
|
815 | 815 | 'size' => 'large' |
816 | 816 | ), |
817 | 817 | 'email_failed_invoice_heading' => array( |
818 | 818 | 'id' => 'email_failed_invoice_heading', |
819 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
820 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
819 | + 'name' => __('Email Heading', 'invoicing'), |
|
820 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
821 | 821 | 'type' => 'text', |
822 | - 'std' => __( 'Failed invoice', 'invoicing' ), |
|
822 | + 'std' => __('Failed invoice', 'invoicing'), |
|
823 | 823 | 'size' => 'large' |
824 | 824 | ) |
825 | 825 | ), |
826 | 826 | 'onhold_invoice' => array( |
827 | 827 | 'email_onhold_invoice_header' => array( |
828 | 828 | 'id' => 'email_onhold_invoice_header', |
829 | - 'name' => '<h3>' . __( 'On Hold Invoice', 'invoicing' ) . '</h3>', |
|
830 | - 'desc' => __( 'This is an invoice notification sent to users containing invoice details after an invoice is placed on-hold.', 'invoicing' ), |
|
829 | + 'name' => '<h3>' . __('On Hold Invoice', 'invoicing') . '</h3>', |
|
830 | + 'desc' => __('This is an invoice notification sent to users containing invoice details after an invoice is placed on-hold.', 'invoicing'), |
|
831 | 831 | 'type' => 'header', |
832 | 832 | ), |
833 | 833 | 'email_onhold_invoice_active' => array( |
834 | 834 | 'id' => 'email_onhold_invoice_active', |
835 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
836 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
835 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
836 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
837 | 837 | 'type' => 'checkbox', |
838 | 838 | 'std' => 1 |
839 | 839 | ), |
840 | 840 | 'email_onhold_invoice_subject' => array( |
841 | 841 | 'id' => 'email_onhold_invoice_subject', |
842 | - 'name' => __( 'Subject', 'invoicing' ), |
|
843 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
842 | + 'name' => __('Subject', 'invoicing'), |
|
843 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
844 | 844 | 'type' => 'text', |
845 | - 'std' => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ), |
|
845 | + 'std' => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'), |
|
846 | 846 | 'size' => 'large' |
847 | 847 | ), |
848 | 848 | 'email_onhold_invoice_heading' => array( |
849 | 849 | 'id' => 'email_onhold_invoice_heading', |
850 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
851 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
850 | + 'name' => __('Email Heading', 'invoicing'), |
|
851 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
852 | 852 | 'type' => 'text', |
853 | - 'std' => __( 'Thank you for your invoice', 'invoicing' ), |
|
853 | + 'std' => __('Thank you for your invoice', 'invoicing'), |
|
854 | 854 | 'size' => 'large' |
855 | 855 | ), |
856 | 856 | 'email_onhold_invoice_admin_bcc' => array( |
857 | 857 | 'id' => 'email_onhold_invoice_admin_bcc', |
858 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
859 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
858 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
859 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
860 | 860 | 'type' => 'checkbox', |
861 | 861 | 'std' => 1 |
862 | 862 | ), |
@@ -864,37 +864,37 @@ discard block |
||
864 | 864 | 'processing_invoice' => array( |
865 | 865 | 'email_processing_invoice_header' => array( |
866 | 866 | 'id' => 'email_processing_invoice_header', |
867 | - 'name' => '<h3>' . __( 'Processing Invoice', 'invoicing' ) . '</h3>', |
|
868 | - 'desc' => __( 'This is an invoice notification sent to users containing invoice details after payment.', 'invoicing' ), |
|
867 | + 'name' => '<h3>' . __('Processing Invoice', 'invoicing') . '</h3>', |
|
868 | + 'desc' => __('This is an invoice notification sent to users containing invoice details after payment.', 'invoicing'), |
|
869 | 869 | 'type' => 'header', |
870 | 870 | ), |
871 | 871 | 'email_processing_invoice_active' => array( |
872 | 872 | 'id' => 'email_processing_invoice_active', |
873 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
874 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
873 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
874 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
875 | 875 | 'type' => 'checkbox', |
876 | 876 | 'std' => 1 |
877 | 877 | ), |
878 | 878 | 'email_processing_invoice_subject' => array( |
879 | 879 | 'id' => 'email_processing_invoice_subject', |
880 | - 'name' => __( 'Subject', 'invoicing' ), |
|
881 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
880 | + 'name' => __('Subject', 'invoicing'), |
|
881 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
882 | 882 | 'type' => 'text', |
883 | - 'std' => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ), |
|
883 | + 'std' => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'), |
|
884 | 884 | 'size' => 'large' |
885 | 885 | ), |
886 | 886 | 'email_processing_invoice_heading' => array( |
887 | 887 | 'id' => 'email_processing_invoice_heading', |
888 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
889 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
888 | + 'name' => __('Email Heading', 'invoicing'), |
|
889 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
890 | 890 | 'type' => 'text', |
891 | - 'std' => __( 'Thank you for your invoice', 'invoicing' ), |
|
891 | + 'std' => __('Thank you for your invoice', 'invoicing'), |
|
892 | 892 | 'size' => 'large' |
893 | 893 | ), |
894 | 894 | 'email_processing_invoice_admin_bcc' => array( |
895 | 895 | 'id' => 'email_processing_invoice_admin_bcc', |
896 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
897 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
896 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
897 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
898 | 898 | 'type' => 'checkbox', |
899 | 899 | 'std' => 1 |
900 | 900 | ), |
@@ -902,37 +902,37 @@ discard block |
||
902 | 902 | 'completed_invoice' => array( |
903 | 903 | 'email_completed_invoice_header' => array( |
904 | 904 | 'id' => 'email_completed_invoice_header', |
905 | - 'name' => '<h3>' . __( 'Paid Invoice', 'invoicing' ) . '</h3>', |
|
906 | - 'desc' => __( 'Invoice paid emails are sent to users when their invoices are marked paid and usually indicate that their payment has been done.', 'invoicing' ), |
|
905 | + 'name' => '<h3>' . __('Paid Invoice', 'invoicing') . '</h3>', |
|
906 | + 'desc' => __('Invoice paid emails are sent to users when their invoices are marked paid and usually indicate that their payment has been done.', 'invoicing'), |
|
907 | 907 | 'type' => 'header', |
908 | 908 | ), |
909 | 909 | 'email_completed_invoice_active' => array( |
910 | 910 | 'id' => 'email_completed_invoice_active', |
911 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
912 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
911 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
912 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
913 | 913 | 'type' => 'checkbox', |
914 | 914 | 'std' => 1 |
915 | 915 | ), |
916 | 916 | 'email_completed_invoice_subject' => array( |
917 | 917 | 'id' => 'email_completed_invoice_subject', |
918 | - 'name' => __( 'Subject', 'invoicing' ), |
|
919 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
918 | + 'name' => __('Subject', 'invoicing'), |
|
919 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
920 | 920 | 'type' => 'text', |
921 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing' ), |
|
921 | + 'std' => __('[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing'), |
|
922 | 922 | 'size' => 'large' |
923 | 923 | ), |
924 | 924 | 'email_completed_invoice_heading' => array( |
925 | 925 | 'id' => 'email_completed_invoice_heading', |
926 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
927 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
926 | + 'name' => __('Email Heading', 'invoicing'), |
|
927 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
928 | 928 | 'type' => 'text', |
929 | - 'std' => __( 'Your invoice has been paid', 'invoicing' ), |
|
929 | + 'std' => __('Your invoice has been paid', 'invoicing'), |
|
930 | 930 | 'size' => 'large' |
931 | 931 | ), |
932 | 932 | 'email_completed_invoice_admin_bcc' => array( |
933 | 933 | 'id' => 'email_completed_invoice_admin_bcc', |
934 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
935 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
934 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
935 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
936 | 936 | 'type' => 'checkbox', |
937 | 937 | ), |
938 | 938 | 'std' => 1 |
@@ -940,37 +940,37 @@ discard block |
||
940 | 940 | 'refunded_invoice' => array( |
941 | 941 | 'email_refunded_invoice_header' => array( |
942 | 942 | 'id' => 'email_refunded_invoice_header', |
943 | - 'name' => '<h3>' . __( 'Refunded Invoice', 'invoicing' ) . '</h3>', |
|
944 | - 'desc' => __( 'Invoice refunded emails are sent to users when their invoices are marked refunded.', 'invoicing' ), |
|
943 | + 'name' => '<h3>' . __('Refunded Invoice', 'invoicing') . '</h3>', |
|
944 | + 'desc' => __('Invoice refunded emails are sent to users when their invoices are marked refunded.', 'invoicing'), |
|
945 | 945 | 'type' => 'header', |
946 | 946 | ), |
947 | 947 | 'email_refunded_invoice_active' => array( |
948 | 948 | 'id' => 'email_refunded_invoice_active', |
949 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
950 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
949 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
950 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
951 | 951 | 'type' => 'checkbox', |
952 | 952 | 'std' => 1 |
953 | 953 | ), |
954 | 954 | 'email_refunded_invoice_subject' => array( |
955 | 955 | 'id' => 'email_refunded_invoice_subject', |
956 | - 'name' => __( 'Subject', 'invoicing' ), |
|
957 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
956 | + 'name' => __('Subject', 'invoicing'), |
|
957 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
958 | 958 | 'type' => 'text', |
959 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing' ), |
|
959 | + 'std' => __('[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing'), |
|
960 | 960 | 'size' => 'large' |
961 | 961 | ), |
962 | 962 | 'email_refunded_invoice_heading' => array( |
963 | 963 | 'id' => 'email_refunded_invoice_heading', |
964 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
965 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
964 | + 'name' => __('Email Heading', 'invoicing'), |
|
965 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
966 | 966 | 'type' => 'text', |
967 | - 'std' => __( 'Your invoice has been refunded', 'invoicing' ), |
|
967 | + 'std' => __('Your invoice has been refunded', 'invoicing'), |
|
968 | 968 | 'size' => 'large' |
969 | 969 | ), |
970 | 970 | 'email_refunded_invoice_admin_bcc' => array( |
971 | 971 | 'id' => 'email_refunded_invoice_admin_bcc', |
972 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
973 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
972 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
973 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
974 | 974 | 'type' => 'checkbox', |
975 | 975 | 'std' => 1 |
976 | 976 | ), |
@@ -978,37 +978,37 @@ discard block |
||
978 | 978 | 'user_invoice' => array( |
979 | 979 | 'email_user_invoice_header' => array( |
980 | 980 | 'id' => 'email_user_invoice_header', |
981 | - 'name' => '<h3>' . __( 'Customer Invoice', 'invoicing' ) . '</h3>', |
|
982 | - 'desc' => __( 'Customer invoice emails can be sent to customers containing their invoice information and payment links.', 'invoicing' ), |
|
981 | + 'name' => '<h3>' . __('Customer Invoice', 'invoicing') . '</h3>', |
|
982 | + 'desc' => __('Customer invoice emails can be sent to customers containing their invoice information and payment links.', 'invoicing'), |
|
983 | 983 | 'type' => 'header', |
984 | 984 | ), |
985 | 985 | 'email_user_invoice_active' => array( |
986 | 986 | 'id' => 'email_user_invoice_active', |
987 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
988 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
987 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
988 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
989 | 989 | 'type' => 'checkbox', |
990 | 990 | 'std' => 1 |
991 | 991 | ), |
992 | 992 | 'email_user_invoice_subject' => array( |
993 | 993 | 'id' => 'email_user_invoice_subject', |
994 | - 'name' => __( 'Subject', 'invoicing' ), |
|
995 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
994 | + 'name' => __('Subject', 'invoicing'), |
|
995 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
996 | 996 | 'type' => 'text', |
997 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date}', 'invoicing' ), |
|
997 | + 'std' => __('[{site_title}] Your invoice from {invoice_date}', 'invoicing'), |
|
998 | 998 | 'size' => 'large' |
999 | 999 | ), |
1000 | 1000 | 'email_user_invoice_heading' => array( |
1001 | 1001 | 'id' => 'email_user_invoice_heading', |
1002 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
1003 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
1002 | + 'name' => __('Email Heading', 'invoicing'), |
|
1003 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
1004 | 1004 | 'type' => 'text', |
1005 | - 'std' => __( 'Your invoice {invoice_number} details', 'invoicing' ), |
|
1005 | + 'std' => __('Your invoice {invoice_number} details', 'invoicing'), |
|
1006 | 1006 | 'size' => 'large' |
1007 | 1007 | ), |
1008 | 1008 | 'email_user_invoice_admin_bcc' => array( |
1009 | 1009 | 'id' => 'email_user_invoice_admin_bcc', |
1010 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
1011 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
1010 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
1011 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
1012 | 1012 | 'type' => 'checkbox', |
1013 | 1013 | 'std' => 1 |
1014 | 1014 | ), |
@@ -1016,177 +1016,177 @@ discard block |
||
1016 | 1016 | 'user_note' => array( |
1017 | 1017 | 'email_user_note_header' => array( |
1018 | 1018 | 'id' => 'email_user_note_header', |
1019 | - 'name' => '<h3>' . __( 'Customer Note', 'invoicing' ) . '</h3>', |
|
1020 | - 'desc' => __( 'Customer note emails are sent when you add a note to an invoice.', 'invoicing' ), |
|
1019 | + 'name' => '<h3>' . __('Customer Note', 'invoicing') . '</h3>', |
|
1020 | + 'desc' => __('Customer note emails are sent when you add a note to an invoice.', 'invoicing'), |
|
1021 | 1021 | 'type' => 'header', |
1022 | 1022 | ), |
1023 | 1023 | 'email_user_note_active' => array( |
1024 | 1024 | 'id' => 'email_user_note_active', |
1025 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
1026 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
1025 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
1026 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
1027 | 1027 | 'type' => 'checkbox', |
1028 | 1028 | 'std' => 1 |
1029 | 1029 | ), |
1030 | 1030 | 'email_user_note_subject' => array( |
1031 | 1031 | 'id' => 'email_user_note_subject', |
1032 | - 'name' => __( 'Subject', 'invoicing' ), |
|
1033 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
1032 | + 'name' => __('Subject', 'invoicing'), |
|
1033 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
1034 | 1034 | 'type' => 'text', |
1035 | - 'std' => __( '[{site_title}] Note added to your invoice #{invoice_number} from {invoice_date}', 'invoicing' ), |
|
1035 | + 'std' => __('[{site_title}] Note added to your invoice #{invoice_number} from {invoice_date}', 'invoicing'), |
|
1036 | 1036 | 'size' => 'large' |
1037 | 1037 | ), |
1038 | 1038 | 'email_user_note_heading' => array( |
1039 | 1039 | 'id' => 'email_user_note_heading', |
1040 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
1041 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
1040 | + 'name' => __('Email Heading', 'invoicing'), |
|
1041 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
1042 | 1042 | 'type' => 'text', |
1043 | - 'std' => __( 'A note has been added to your invoice', 'invoicing' ), |
|
1043 | + 'std' => __('A note has been added to your invoice', 'invoicing'), |
|
1044 | 1044 | 'size' => 'large' |
1045 | 1045 | ), |
1046 | 1046 | ), |
1047 | 1047 | 'overdue' => array( |
1048 | 1048 | 'email_overdue_header' => array( |
1049 | 1049 | 'id' => 'email_overdue_header', |
1050 | - 'name' => '<h3>' . __( 'Payment Reminder', 'invoicing' ) . '</h3>', |
|
1051 | - 'desc' => __( 'Payment reminder emails are sent to user automatically.', 'invoicing' ), |
|
1050 | + 'name' => '<h3>' . __('Payment Reminder', 'invoicing') . '</h3>', |
|
1051 | + 'desc' => __('Payment reminder emails are sent to user automatically.', 'invoicing'), |
|
1052 | 1052 | 'type' => 'header', |
1053 | 1053 | ), |
1054 | 1054 | 'email_overdue_active' => array( |
1055 | 1055 | 'id' => 'email_overdue_active', |
1056 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
1057 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
1056 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
1057 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
1058 | 1058 | 'type' => 'checkbox', |
1059 | 1059 | 'std' => 1 |
1060 | 1060 | ), |
1061 | 1061 | 'email_due_reminder_days' => array( |
1062 | 1062 | 'id' => 'email_due_reminder_days', |
1063 | - 'name' => __( 'When to Send', 'sliced-invoices' ), |
|
1064 | - 'desc' => __( 'Check when you would like payment reminders sent out.', 'invoicing' ), |
|
1063 | + 'name' => __('When to Send', 'sliced-invoices'), |
|
1064 | + 'desc' => __('Check when you would like payment reminders sent out.', 'invoicing'), |
|
1065 | 1065 | 'default' => '', |
1066 | 1066 | 'type' => 'multicheck', |
1067 | 1067 | 'options' => $overdue_days_options, |
1068 | 1068 | ), |
1069 | 1069 | 'email_overdue_subject' => array( |
1070 | 1070 | 'id' => 'email_overdue_subject', |
1071 | - 'name' => __( 'Subject', 'invoicing' ), |
|
1072 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
1071 | + 'name' => __('Subject', 'invoicing'), |
|
1072 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
1073 | 1073 | 'type' => 'text', |
1074 | - 'std' => __( '[{site_title}] Payment Reminder', 'invoicing' ), |
|
1074 | + 'std' => __('[{site_title}] Payment Reminder', 'invoicing'), |
|
1075 | 1075 | 'size' => 'large' |
1076 | 1076 | ), |
1077 | 1077 | 'email_overdue_heading' => array( |
1078 | 1078 | 'id' => 'email_overdue_heading', |
1079 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
1080 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
1079 | + 'name' => __('Email Heading', 'invoicing'), |
|
1080 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
1081 | 1081 | 'type' => 'text', |
1082 | - 'std' => __( 'Payment reminder for your invoice', 'invoicing' ), |
|
1082 | + 'std' => __('Payment reminder for your invoice', 'invoicing'), |
|
1083 | 1083 | 'size' => 'large' |
1084 | 1084 | ), |
1085 | 1085 | 'email_overdue_body' => array( |
1086 | 1086 | 'id' => 'email_overdue_body', |
1087 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
1088 | - 'desc' => __( 'The content of the email.', 'invoicing' ), |
|
1087 | + 'name' => __('Email Content', 'invoicing'), |
|
1088 | + 'desc' => __('The content of the email.', 'invoicing'), |
|
1089 | 1089 | 'type' => 'rich_editor', |
1090 | - '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 | + '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'), |
|
1091 | 1091 | 'class' => 'large', |
1092 | 1092 | 'size' => 10, |
1093 | 1093 | ), |
1094 | 1094 | ), |
1095 | 1095 | ); |
1096 | 1096 | |
1097 | - return apply_filters( 'wpinv_get_emails', $emails ); |
|
1097 | + return apply_filters('wpinv_get_emails', $emails); |
|
1098 | 1098 | } |
1099 | 1099 | |
1100 | -function wpinv_settings_emails( $settings = array() ) { |
|
1100 | +function wpinv_settings_emails($settings = array()) { |
|
1101 | 1101 | $emails = wpinv_get_emails(); |
1102 | 1102 | |
1103 | - if ( !empty( $emails ) ) { |
|
1104 | - foreach ( $emails as $key => $email ) { |
|
1103 | + if (!empty($emails)) { |
|
1104 | + foreach ($emails as $key => $email) { |
|
1105 | 1105 | $settings[$key] = $email; |
1106 | 1106 | } |
1107 | 1107 | } |
1108 | 1108 | |
1109 | - return apply_filters( 'wpinv_settings_get_emails', $settings ); |
|
1109 | + return apply_filters('wpinv_settings_get_emails', $settings); |
|
1110 | 1110 | } |
1111 | -add_filter( 'wpinv_settings_emails', 'wpinv_settings_emails', 10, 1 ); |
|
1111 | +add_filter('wpinv_settings_emails', 'wpinv_settings_emails', 10, 1); |
|
1112 | 1112 | |
1113 | -function wpinv_settings_sections_emails( $settings ) { |
|
1113 | +function wpinv_settings_sections_emails($settings) { |
|
1114 | 1114 | $emails = wpinv_get_emails(); |
1115 | 1115 | |
1116 | 1116 | if (!empty($emails)) { |
1117 | - foreach ($emails as $key => $email) { |
|
1118 | - $settings[$key] = !empty( $email['email_' . $key . '_header']['name'] ) ? strip_tags( $email['email_' . $key . '_header']['name'] ) : $key; |
|
1117 | + foreach ($emails as $key => $email) { |
|
1118 | + $settings[$key] = !empty($email['email_' . $key . '_header']['name']) ? strip_tags($email['email_' . $key . '_header']['name']) : $key; |
|
1119 | 1119 | } |
1120 | 1120 | } |
1121 | 1121 | |
1122 | 1122 | return $settings; |
1123 | 1123 | } |
1124 | -add_filter( 'wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1 ); |
|
1124 | +add_filter('wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1); |
|
1125 | 1125 | |
1126 | -function wpinv_email_is_enabled( $email_type ) { |
|
1126 | +function wpinv_email_is_enabled($email_type) { |
|
1127 | 1127 | $emails = wpinv_get_emails(); |
1128 | - $enabled = isset( $emails[$email_type] ) && wpinv_get_option( $email_type . '_active', 0 ) ? true : false; |
|
1128 | + $enabled = isset($emails[$email_type]) && wpinv_get_option($email_type . '_active', 0) ? true : false; |
|
1129 | 1129 | |
1130 | - return apply_filters( 'wpinv_email_is_enabled', $enabled, $email_type ); |
|
1130 | + return apply_filters('wpinv_email_is_enabled', $enabled, $email_type); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | -function wpinv_email_get_recipient( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1134 | - switch ( $email_type ) { |
|
1133 | +function wpinv_email_get_recipient($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1134 | + switch ($email_type) { |
|
1135 | 1135 | case 'new_invoice': |
1136 | 1136 | case 'cancelled_invoice': |
1137 | 1137 | case 'failed_invoice': |
1138 | 1138 | $recipient = wpinv_get_admin_email(); |
1139 | 1139 | break; |
1140 | 1140 | default: |
1141 | - $invoice = !empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : NULL ); |
|
1142 | - $recipient = !empty( $invoice ) ? $invoice->get_email() : ''; |
|
1141 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : NULL); |
|
1142 | + $recipient = !empty($invoice) ? $invoice->get_email() : ''; |
|
1143 | 1143 | break; |
1144 | 1144 | } |
1145 | 1145 | |
1146 | - return apply_filters( 'wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice ); |
|
1146 | + return apply_filters('wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice); |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | -function wpinv_email_get_subject( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1150 | - $subject = wpinv_get_option( 'email_' . $email_type . '_subject' ); |
|
1149 | +function wpinv_email_get_subject($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1150 | + $subject = wpinv_get_option('email_' . $email_type . '_subject'); |
|
1151 | 1151 | |
1152 | - $subject = wpinv_email_format_text( $subject ); |
|
1152 | + $subject = wpinv_email_format_text($subject); |
|
1153 | 1153 | |
1154 | - return apply_filters( 'wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice ); |
|
1154 | + return apply_filters('wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice); |
|
1155 | 1155 | } |
1156 | 1156 | |
1157 | -function wpinv_email_get_heading( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1158 | - $email_heading = wpinv_get_option( 'email_' . $email_type . '_heading' ); |
|
1157 | +function wpinv_email_get_heading($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1158 | + $email_heading = wpinv_get_option('email_' . $email_type . '_heading'); |
|
1159 | 1159 | |
1160 | - $email_heading = wpinv_email_format_text( $email_heading ); |
|
1160 | + $email_heading = wpinv_email_format_text($email_heading); |
|
1161 | 1161 | |
1162 | - return apply_filters( 'wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice ); |
|
1162 | + return apply_filters('wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice); |
|
1163 | 1163 | } |
1164 | 1164 | |
1165 | -function wpinv_email_get_content( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1166 | - $content = wpinv_get_option( 'email_' . $email_type . '_body' ); |
|
1165 | +function wpinv_email_get_content($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1166 | + $content = wpinv_get_option('email_' . $email_type . '_body'); |
|
1167 | 1167 | |
1168 | - $content = wpinv_email_format_text( $content ); |
|
1168 | + $content = wpinv_email_format_text($content); |
|
1169 | 1169 | |
1170 | - return apply_filters( 'wpinv_email_content', $content, $email_type, $invoice_id, $invoice ); |
|
1170 | + return apply_filters('wpinv_email_content', $content, $email_type, $invoice_id, $invoice); |
|
1171 | 1171 | } |
1172 | 1172 | |
1173 | -function wpinv_email_get_headers( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1173 | +function wpinv_email_get_headers($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1174 | 1174 | $from_name = wpinv_mail_get_from_address(); |
1175 | 1175 | $from_email = wpinv_mail_get_from_address(); |
1176 | 1176 | |
1177 | - $invoice = !empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : NULL ); |
|
1177 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : NULL); |
|
1178 | 1178 | |
1179 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
1180 | - $headers .= "Reply-To: ". $from_email . "\r\n"; |
|
1179 | + $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <$from_email>\r\n"; |
|
1180 | + $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
1181 | 1181 | $headers .= "Content-Type: " . wpinv_mail_get_content_type() . "\r\n"; |
1182 | 1182 | |
1183 | - return apply_filters( 'wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice ); |
|
1183 | + return apply_filters('wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | -function wpinv_email_get_attachments( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
1186 | +function wpinv_email_get_attachments($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
1187 | 1187 | $attachments = array(); |
1188 | 1188 | |
1189 | - return apply_filters( 'wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice ); |
|
1189 | + return apply_filters('wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice); |
|
1190 | 1190 | } |
1191 | 1191 | |
1192 | 1192 | function wpinv_email_global_vars() { |
@@ -1203,73 +1203,73 @@ discard block |
||
1203 | 1203 | $replace['sitename'] = $blogname; |
1204 | 1204 | $replace['site-title'] = $blogname; |
1205 | 1205 | |
1206 | - return apply_filters( 'wpinv_email_global_vars', array( $search, $replace ) ); |
|
1206 | + return apply_filters('wpinv_email_global_vars', array($search, $replace)); |
|
1207 | 1207 | } |
1208 | 1208 | |
1209 | -function wpinv_email_format_text( $content ) { |
|
1209 | +function wpinv_email_format_text($content) { |
|
1210 | 1210 | global $wpinv_email_search, $wpinv_email_replace; |
1211 | 1211 | |
1212 | - if ( empty( $wpinv_email_search ) ) { |
|
1212 | + if (empty($wpinv_email_search)) { |
|
1213 | 1213 | $wpinv_email_search = array(); |
1214 | 1214 | } |
1215 | 1215 | |
1216 | - if ( empty( $wpinv_email_replace ) ) { |
|
1216 | + if (empty($wpinv_email_replace)) { |
|
1217 | 1217 | $wpinv_email_replace = array(); |
1218 | 1218 | } |
1219 | 1219 | |
1220 | - $wpinv_email_search = (array)apply_filters( 'wpinv_email_format_text_search', $wpinv_email_search ); |
|
1221 | - $wpinv_email_replace = (array)apply_filters( 'wpinv_email_format_text_replace', $wpinv_email_replace ); |
|
1220 | + $wpinv_email_search = (array)apply_filters('wpinv_email_format_text_search', $wpinv_email_search); |
|
1221 | + $wpinv_email_replace = (array)apply_filters('wpinv_email_format_text_replace', $wpinv_email_replace); |
|
1222 | 1222 | |
1223 | 1223 | $global_vars = wpinv_email_global_vars(); |
1224 | 1224 | |
1225 | - $search = array_merge( $global_vars[0], $wpinv_email_search ); |
|
1226 | - $replace = array_merge( $global_vars[1], $wpinv_email_replace ); |
|
1225 | + $search = array_merge($global_vars[0], $wpinv_email_search); |
|
1226 | + $replace = array_merge($global_vars[1], $wpinv_email_replace); |
|
1227 | 1227 | |
1228 | - if ( empty( $search ) || empty( $replace ) || !is_array( $search ) || !is_array( $replace ) ) { |
|
1228 | + if (empty($search) || empty($replace) || !is_array($search) || !is_array($replace)) { |
|
1229 | 1229 | return $content; |
1230 | 1230 | } |
1231 | 1231 | |
1232 | - return str_replace( $search, $replace, $content ); |
|
1232 | + return str_replace($search, $replace, $content); |
|
1233 | 1233 | } |
1234 | 1234 | |
1235 | -function wpinv_email_style_body( $content ) { |
|
1235 | +function wpinv_email_style_body($content) { |
|
1236 | 1236 | // make sure we only inline CSS for html emails |
1237 | - if ( in_array( wpinv_mail_get_content_type(), array( 'text/html', 'multipart/alternative' ) ) && class_exists( 'DOMDocument' ) ) { |
|
1237 | + if (in_array(wpinv_mail_get_content_type(), array('text/html', 'multipart/alternative')) && class_exists('DOMDocument')) { |
|
1238 | 1238 | ob_start(); |
1239 | - wpinv_get_template( 'emails/wpinv-email-styles.php' ); |
|
1240 | - $css = apply_filters( 'wpinv_email_styles', ob_get_clean() ); |
|
1239 | + wpinv_get_template('emails/wpinv-email-styles.php'); |
|
1240 | + $css = apply_filters('wpinv_email_styles', ob_get_clean()); |
|
1241 | 1241 | |
1242 | 1242 | // apply CSS styles inline for picky email clients |
1243 | 1243 | try { |
1244 | - $emogrifier = new Emogrifier( $content, $css ); |
|
1244 | + $emogrifier = new Emogrifier($content, $css); |
|
1245 | 1245 | $content = $emogrifier->emogrify(); |
1246 | - } catch ( Exception $e ) { |
|
1247 | - wpinv_error_log( $e->getMessage(), 'emogrifier' ); |
|
1246 | + } catch (Exception $e) { |
|
1247 | + wpinv_error_log($e->getMessage(), 'emogrifier'); |
|
1248 | 1248 | } |
1249 | 1249 | } |
1250 | 1250 | return $content; |
1251 | 1251 | } |
1252 | 1252 | |
1253 | -function wpinv_email_header( $email_heading = '', $invoice = array(), $email_type = '', $sent_to_admin = false ) { |
|
1254 | - 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 ) ); |
|
1253 | +function wpinv_email_header($email_heading = '', $invoice = array(), $email_type = '', $sent_to_admin = false) { |
|
1254 | + 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)); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | /** |
1258 | 1258 | * Get the email footer. |
1259 | 1259 | */ |
1260 | -function wpinv_email_footer( $invoice = array(), $email_type = '', $sent_to_admin = false ) { |
|
1261 | - wpinv_get_template( 'emails/wpinv-email-footer.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
1260 | +function wpinv_email_footer($invoice = array(), $email_type = '', $sent_to_admin = false) { |
|
1261 | + wpinv_get_template('emails/wpinv-email-footer.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
1262 | 1262 | } |
1263 | 1263 | |
1264 | -function wpinv_email_wrap_message( $message ) { |
|
1264 | +function wpinv_email_wrap_message($message) { |
|
1265 | 1265 | // Buffer |
1266 | 1266 | ob_start(); |
1267 | 1267 | |
1268 | - do_action( 'wpinv_email_header' ); |
|
1268 | + do_action('wpinv_email_header'); |
|
1269 | 1269 | |
1270 | - echo wpautop( wptexturize( $message ) ); |
|
1270 | + echo wpautop(wptexturize($message)); |
|
1271 | 1271 | |
1272 | - do_action( 'wpinv_email_footer' ); |
|
1272 | + do_action('wpinv_email_footer'); |
|
1273 | 1273 | |
1274 | 1274 | // Get contents |
1275 | 1275 | $message = ob_get_clean(); |
@@ -1277,86 +1277,86 @@ discard block |
||
1277 | 1277 | return $message; |
1278 | 1278 | } |
1279 | 1279 | |
1280 | -function wpinv_email_invoice_details( $invoice, $email_type = '', $sent_to_admin = false ) { |
|
1281 | - wpinv_get_template( 'emails/wpinv-email-invoice-details.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
1280 | +function wpinv_email_invoice_details($invoice, $email_type = '', $sent_to_admin = false) { |
|
1281 | + wpinv_get_template('emails/wpinv-email-invoice-details.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
1282 | 1282 | } |
1283 | 1283 | |
1284 | -function wpinv_email_invoice_items( $invoice, $email_type = '', $sent_to_admin = false ) { |
|
1285 | - wpinv_get_template( 'emails/wpinv-email-invoice-items.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
1284 | +function wpinv_email_invoice_items($invoice, $email_type = '', $sent_to_admin = false) { |
|
1285 | + wpinv_get_template('emails/wpinv-email-invoice-items.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
1286 | 1286 | } |
1287 | 1287 | |
1288 | -function wpinv_email_billing_details( $invoice, $email_type = '', $sent_to_admin = false ) { |
|
1289 | - wpinv_get_template( 'emails/wpinv-email-billing-details.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
|
1288 | +function wpinv_email_billing_details($invoice, $email_type = '', $sent_to_admin = false) { |
|
1289 | + wpinv_get_template('emails/wpinv-email-billing-details.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin)); |
|
1290 | 1290 | } |
1291 | 1291 | |
1292 | -function wpinv_send_customer_invoice( $data = array() ) { |
|
1293 | - $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
|
1292 | +function wpinv_send_customer_invoice($data = array()) { |
|
1293 | + $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL; |
|
1294 | 1294 | |
1295 | - if ( empty( $invoice_id ) ) { |
|
1295 | + if (empty($invoice_id)) { |
|
1296 | 1296 | return; |
1297 | 1297 | } |
1298 | 1298 | |
1299 | - if ( !current_user_can( 'manage_options' ) ) { |
|
1300 | - wp_die( __( 'You do not have permission to send invoice notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
1299 | + if (!current_user_can('manage_options')) { |
|
1300 | + wp_die(__('You do not have permission to send invoice notification', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
1301 | 1301 | } |
1302 | 1302 | |
1303 | - $sent = wpinv_user_invoice_notification( $invoice_id ); |
|
1303 | + $sent = wpinv_user_invoice_notification($invoice_id); |
|
1304 | 1304 | |
1305 | 1305 | $status = $sent ? 'email_sent' : 'email_fail'; |
1306 | 1306 | |
1307 | - $redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) ); |
|
1308 | - wp_redirect( $redirect ); |
|
1307 | + $redirect = add_query_arg(array('wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false)); |
|
1308 | + wp_redirect($redirect); |
|
1309 | 1309 | exit; |
1310 | 1310 | } |
1311 | -add_action( 'wpinv_send_invoice', 'wpinv_send_customer_invoice' ); |
|
1311 | +add_action('wpinv_send_invoice', 'wpinv_send_customer_invoice'); |
|
1312 | 1312 | |
1313 | -function wpinv_send_overdue_reminder( $data = array() ) { |
|
1314 | - $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
|
1313 | +function wpinv_send_overdue_reminder($data = array()) { |
|
1314 | + $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL; |
|
1315 | 1315 | |
1316 | - if ( empty( $invoice_id ) ) { |
|
1316 | + if (empty($invoice_id)) { |
|
1317 | 1317 | return; |
1318 | 1318 | } |
1319 | 1319 | |
1320 | - if ( !current_user_can( 'manage_options' ) ) { |
|
1321 | - wp_die( __( 'You do not have permission to send reminder notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
1320 | + if (!current_user_can('manage_options')) { |
|
1321 | + wp_die(__('You do not have permission to send reminder notification', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
1322 | 1322 | } |
1323 | 1323 | |
1324 | - $sent = wpinv_send_payment_reminder_notification( $invoice_id ); |
|
1324 | + $sent = wpinv_send_payment_reminder_notification($invoice_id); |
|
1325 | 1325 | |
1326 | 1326 | $status = $sent ? 'email_sent' : 'email_fail'; |
1327 | 1327 | |
1328 | - $redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) ); |
|
1329 | - wp_redirect( $redirect ); |
|
1328 | + $redirect = add_query_arg(array('wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false)); |
|
1329 | + wp_redirect($redirect); |
|
1330 | 1330 | exit; |
1331 | 1331 | } |
1332 | -add_action( 'wpinv_send_reminder', 'wpinv_send_overdue_reminder' ); |
|
1332 | +add_action('wpinv_send_reminder', 'wpinv_send_overdue_reminder'); |
|
1333 | 1333 | |
1334 | -function wpinv_send_customer_note_email( $data ) { |
|
1335 | - $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
|
1334 | +function wpinv_send_customer_note_email($data) { |
|
1335 | + $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL; |
|
1336 | 1336 | |
1337 | - if ( empty( $invoice_id ) ) { |
|
1337 | + if (empty($invoice_id)) { |
|
1338 | 1338 | return; |
1339 | 1339 | } |
1340 | 1340 | |
1341 | - $sent = wpinv_user_note_notification( $invoice_id, $data ); |
|
1341 | + $sent = wpinv_user_note_notification($invoice_id, $data); |
|
1342 | 1342 | } |
1343 | -add_action( 'wpinv_new_customer_note', 'wpinv_send_customer_note_email', 10, 1 ); |
|
1343 | +add_action('wpinv_new_customer_note', 'wpinv_send_customer_note_email', 10, 1); |
|
1344 | 1344 | |
1345 | -function wpinv_add_notes_to_invoice_email( $invoice, $email_type, $sent_to_admin ) { |
|
1346 | - if ( !empty( $invoice ) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes( $invoice->ID, true ) ) { |
|
1347 | - $date_format = get_option( 'date_format' ); |
|
1348 | - $time_format = get_option( 'time_format' ); |
|
1345 | +function wpinv_add_notes_to_invoice_email($invoice, $email_type, $sent_to_admin) { |
|
1346 | + if (!empty($invoice) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes($invoice->ID, true)) { |
|
1347 | + $date_format = get_option('date_format'); |
|
1348 | + $time_format = get_option('time_format'); |
|
1349 | 1349 | ?> |
1350 | 1350 | <div id="wpinv-email-notes"> |
1351 | - <h3 class="wpinv-notes-t"><?php echo apply_filters( 'wpinv_email_invoice_notes_title', __( 'Invoice Notes', 'invoicing' ) ); ?></h3> |
|
1351 | + <h3 class="wpinv-notes-t"><?php echo apply_filters('wpinv_email_invoice_notes_title', __('Invoice Notes', 'invoicing')); ?></h3> |
|
1352 | 1352 | <ol class="wpinv-notes-lists"> |
1353 | 1353 | <?php |
1354 | - foreach ( $invoice_notes as $note ) { |
|
1355 | - $note_time = strtotime( $note->comment_date ); |
|
1354 | + foreach ($invoice_notes as $note) { |
|
1355 | + $note_time = strtotime($note->comment_date); |
|
1356 | 1356 | ?> |
1357 | 1357 | <li class="comment wpinv-note"> |
1358 | - <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> |
|
1359 | - <div class="wpinv-note-desc description"><?php echo wpautop( wptexturize( $note->comment_content ) ); ?></div> |
|
1358 | + <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> |
|
1359 | + <div class="wpinv-note-desc description"><?php echo wpautop(wptexturize($note->comment_content)); ?></div> |
|
1360 | 1360 | </li> |
1361 | 1361 | <?php |
1362 | 1362 | } |
@@ -1365,21 +1365,21 @@ discard block |
||
1365 | 1365 | <?php |
1366 | 1366 | } |
1367 | 1367 | } |
1368 | -add_action( 'wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3 ); |
|
1368 | +add_action('wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3); |
|
1369 | 1369 | |
1370 | 1370 | function wpinv_email_payment_reminders() { |
1371 | 1371 | global $wpi_auto_reminder; |
1372 | - if ( !wpinv_get_option( 'email_overdue_active' ) ) { |
|
1372 | + if (!wpinv_get_option('email_overdue_active')) { |
|
1373 | 1373 | return; |
1374 | 1374 | } |
1375 | 1375 | |
1376 | - if ( $reminder_days = wpinv_get_option( 'email_due_reminder_days' ) ) { |
|
1377 | - $reminder_days = is_array( $reminder_days ) ? array_values( $reminder_days ) : ''; |
|
1376 | + if ($reminder_days = wpinv_get_option('email_due_reminder_days')) { |
|
1377 | + $reminder_days = is_array($reminder_days) ? array_values($reminder_days) : ''; |
|
1378 | 1378 | |
1379 | - if ( empty( $reminder_days ) ) { |
|
1379 | + if (empty($reminder_days)) { |
|
1380 | 1380 | return; |
1381 | 1381 | } |
1382 | - $reminder_days = array_unique( array_map( 'absint', $reminder_days ) ); |
|
1382 | + $reminder_days = array_unique(array_map('absint', $reminder_days)); |
|
1383 | 1383 | |
1384 | 1384 | $args = array( |
1385 | 1385 | 'post_type' => 'wpi_invoice', |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | 'meta_query' => array( |
1390 | 1390 | array( |
1391 | 1391 | 'key' => '_wpinv_due_date', |
1392 | - 'value' => array( '', 'none' ), |
|
1392 | + 'value' => array('', 'none'), |
|
1393 | 1393 | 'compare' => 'NOT IN', |
1394 | 1394 | ) |
1395 | 1395 | ), |
@@ -1398,64 +1398,64 @@ discard block |
||
1398 | 1398 | 'order' => 'ASC', |
1399 | 1399 | ); |
1400 | 1400 | |
1401 | - $invoices = get_posts( $args ); |
|
1401 | + $invoices = get_posts($args); |
|
1402 | 1402 | |
1403 | - if ( empty( $invoices ) ) { |
|
1403 | + if (empty($invoices)) { |
|
1404 | 1404 | return; |
1405 | 1405 | } |
1406 | 1406 | |
1407 | - $date_to_send = array(); |
|
1407 | + $date_to_send = array(); |
|
1408 | 1408 | |
1409 | - foreach ( $invoices as $id ) { |
|
1410 | - $due_date = get_post_meta( $id, '_wpinv_due_date', true ); |
|
1409 | + foreach ($invoices as $id) { |
|
1410 | + $due_date = get_post_meta($id, '_wpinv_due_date', true); |
|
1411 | 1411 | |
1412 | - foreach ( $reminder_days as $key => $days ) { |
|
1413 | - if ( $days !== '' ) { |
|
1414 | - $date_to_send[$id][] = date_i18n( 'Y-m-d', strtotime( $due_date ) + ( $days * DAY_IN_SECONDS ) ); |
|
1412 | + foreach ($reminder_days as $key => $days) { |
|
1413 | + if ($days !== '') { |
|
1414 | + $date_to_send[$id][] = date_i18n('Y-m-d', strtotime($due_date) + ($days * DAY_IN_SECONDS)); |
|
1415 | 1415 | } |
1416 | 1416 | } |
1417 | 1417 | } |
1418 | 1418 | |
1419 | - $today = date_i18n( 'Y-m-d' ); |
|
1419 | + $today = date_i18n('Y-m-d'); |
|
1420 | 1420 | $wpi_auto_reminder = true; |
1421 | 1421 | |
1422 | - foreach ( $date_to_send as $id => $values ) { |
|
1423 | - if ( in_array( $today, $values ) ) { |
|
1424 | - $sent = get_post_meta( $id, '_wpinv_reminder_sent', true ); |
|
1422 | + foreach ($date_to_send as $id => $values) { |
|
1423 | + if (in_array($today, $values)) { |
|
1424 | + $sent = get_post_meta($id, '_wpinv_reminder_sent', true); |
|
1425 | 1425 | |
1426 | - if ( isset( $sent ) && !empty( $sent ) ) { |
|
1427 | - if ( !in_array( $today, $sent ) ) { |
|
1428 | - do_action( 'wpinv_send_payment_reminder_notification', $id ); |
|
1426 | + if (isset($sent) && !empty($sent)) { |
|
1427 | + if (!in_array($today, $sent)) { |
|
1428 | + do_action('wpinv_send_payment_reminder_notification', $id); |
|
1429 | 1429 | } |
1430 | 1430 | } else { |
1431 | - do_action( 'wpinv_send_payment_reminder_notification', $id ); |
|
1431 | + do_action('wpinv_send_payment_reminder_notification', $id); |
|
1432 | 1432 | } |
1433 | 1433 | } |
1434 | 1434 | } |
1435 | 1435 | |
1436 | - $wpi_auto_reminder = false; |
|
1436 | + $wpi_auto_reminder = false; |
|
1437 | 1437 | } |
1438 | 1438 | } |
1439 | 1439 | |
1440 | -function wpinv_send_payment_reminder_notification( $invoice_id ) { |
|
1440 | +function wpinv_send_payment_reminder_notification($invoice_id) { |
|
1441 | 1441 | global $wpinv_email_search, $wpinv_email_replace; |
1442 | 1442 | |
1443 | 1443 | $email_type = 'overdue'; |
1444 | - if ( !wpinv_email_is_enabled( $email_type ) ) { |
|
1444 | + if (!wpinv_email_is_enabled($email_type)) { |
|
1445 | 1445 | return false; |
1446 | 1446 | } |
1447 | 1447 | |
1448 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
1449 | - if ( empty( $invoice ) ) { |
|
1448 | + $invoice = wpinv_get_invoice($invoice_id); |
|
1449 | + if (empty($invoice)) { |
|
1450 | 1450 | return false; |
1451 | 1451 | } |
1452 | 1452 | |
1453 | - if ( !$invoice->needs_payment() ) { |
|
1453 | + if (!$invoice->needs_payment()) { |
|
1454 | 1454 | return false; |
1455 | 1455 | } |
1456 | 1456 | |
1457 | - $recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
|
1458 | - if ( !is_email( $recipient ) ) { |
|
1457 | + $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice); |
|
1458 | + if (!is_email($recipient)) { |
|
1459 | 1459 | return false; |
1460 | 1460 | } |
1461 | 1461 | |
@@ -1471,70 +1471,70 @@ discard block |
||
1471 | 1471 | $replace = array(); |
1472 | 1472 | $replace['full_name'] = $invoice->get_user_full_name(); |
1473 | 1473 | $replace['invoice_number'] = $invoice->get_number(); |
1474 | - $replace['invoice_due_date']= $invoice->get_due_date( true ); |
|
1475 | - $replace['invoice_total'] = $invoice->get_total( true ); |
|
1476 | - $replace['invoice_link'] = $invoice->get_view_url( true ); |
|
1477 | - $replace['invoice_pay_link']= $invoice->get_checkout_payment_url( false, true ); |
|
1478 | - $replace['is_was'] = strtotime( $invoice->get_due_date() ) < strtotime( date_i18n( 'Y-m-d' ) ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ); |
|
1474 | + $replace['invoice_due_date'] = $invoice->get_due_date(true); |
|
1475 | + $replace['invoice_total'] = $invoice->get_total(true); |
|
1476 | + $replace['invoice_link'] = $invoice->get_view_url(true); |
|
1477 | + $replace['invoice_pay_link'] = $invoice->get_checkout_payment_url(false, true); |
|
1478 | + $replace['is_was'] = strtotime($invoice->get_due_date()) < strtotime(date_i18n('Y-m-d')) ? __('was', 'invoicing') : __('is', 'invoicing'); |
|
1479 | 1479 | |
1480 | 1480 | $wpinv_email_search = $search; |
1481 | 1481 | $wpinv_email_replace = $replace; |
1482 | 1482 | |
1483 | - $subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
|
1484 | - $email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
|
1485 | - $headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
|
1486 | - $attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
|
1483 | + $subject = wpinv_email_get_subject($email_type, $invoice_id, $invoice); |
|
1484 | + $email_heading = wpinv_email_get_heading($email_type, $invoice_id, $invoice); |
|
1485 | + $headers = wpinv_email_get_headers($email_type, $invoice_id, $invoice); |
|
1486 | + $attachments = wpinv_email_get_attachments($email_type, $invoice_id, $invoice); |
|
1487 | 1487 | |
1488 | - $message_body = wpinv_email_get_content( $email_type, $invoice_id, $invoice ); |
|
1488 | + $message_body = wpinv_email_get_content($email_type, $invoice_id, $invoice); |
|
1489 | 1489 | |
1490 | - $content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
|
1490 | + $content = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array( |
|
1491 | 1491 | 'invoice' => $invoice, |
1492 | 1492 | 'email_type' => $email_type, |
1493 | 1493 | 'email_heading' => $email_heading, |
1494 | 1494 | 'sent_to_admin' => false, |
1495 | 1495 | 'plain_text' => false, |
1496 | 1496 | 'message_body' => $message_body |
1497 | - ) ); |
|
1497 | + )); |
|
1498 | 1498 | |
1499 | - $content = wpinv_email_format_text( $content ); |
|
1499 | + $content = wpinv_email_format_text($content); |
|
1500 | 1500 | |
1501 | - $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
|
1502 | - if ( $sent ) { |
|
1503 | - do_action( 'wpinv_payment_reminder_sent', $invoice_id, $invoice ); |
|
1501 | + $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments); |
|
1502 | + if ($sent) { |
|
1503 | + do_action('wpinv_payment_reminder_sent', $invoice_id, $invoice); |
|
1504 | 1504 | } |
1505 | 1505 | |
1506 | 1506 | return $sent; |
1507 | 1507 | } |
1508 | -add_action( 'wpinv_send_payment_reminder_notification', 'wpinv_send_payment_reminder_notification', 10, 1 ); |
|
1508 | +add_action('wpinv_send_payment_reminder_notification', 'wpinv_send_payment_reminder_notification', 10, 1); |
|
1509 | 1509 | |
1510 | -function wpinv_payment_reminder_sent( $invoice_id, $invoice ) { |
|
1510 | +function wpinv_payment_reminder_sent($invoice_id, $invoice) { |
|
1511 | 1511 | global $wpi_auto_reminder; |
1512 | 1512 | |
1513 | - $sent = get_post_meta( $invoice_id, '_wpinv_reminder_sent', true ); |
|
1513 | + $sent = get_post_meta($invoice_id, '_wpinv_reminder_sent', true); |
|
1514 | 1514 | |
1515 | - if ( empty( $sent ) ) { |
|
1515 | + if (empty($sent)) { |
|
1516 | 1516 | $sent = array(); |
1517 | 1517 | } |
1518 | - $sent[] = date_i18n( 'Y-m-d' ); |
|
1518 | + $sent[] = date_i18n('Y-m-d'); |
|
1519 | 1519 | |
1520 | - update_post_meta( $invoice_id, '_wpinv_reminder_sent', $sent ); |
|
1520 | + update_post_meta($invoice_id, '_wpinv_reminder_sent', $sent); |
|
1521 | 1521 | |
1522 | - if ( $wpi_auto_reminder ) { // Auto reminder note. |
|
1523 | - $note = __( 'Manual reminder sent to the user.', 'invoicing' ); |
|
1524 | - $invoice->add_note( $note, false, false, true ); |
|
1522 | + if ($wpi_auto_reminder) { // Auto reminder note. |
|
1523 | + $note = __('Manual reminder sent to the user.', 'invoicing'); |
|
1524 | + $invoice->add_note($note, false, false, true); |
|
1525 | 1525 | } else { // Menual reminder note. |
1526 | - $note = __( 'Manual reminder sent to the user.', 'invoicing' ); |
|
1527 | - $invoice->add_note( $note ); |
|
1526 | + $note = __('Manual reminder sent to the user.', 'invoicing'); |
|
1527 | + $invoice->add_note($note); |
|
1528 | 1528 | } |
1529 | 1529 | } |
1530 | -add_action( 'wpinv_payment_reminder_sent', 'wpinv_payment_reminder_sent', 10, 2 ); |
|
1530 | +add_action('wpinv_payment_reminder_sent', 'wpinv_payment_reminder_sent', 10, 2); |
|
1531 | 1531 | |
1532 | -function wpinv_email_before_note_details( $invoice, $email_type, $sent_to_admin, $customer_note ) { |
|
1532 | +function wpinv_email_before_note_details($invoice, $email_type, $sent_to_admin, $customer_note) { |
|
1533 | 1533 | if ("wpi_invoice" === $invoice->post_type && !empty($customer_note)) { |
1534 | 1534 | $before_note = ''; |
1535 | - $before_note .= __( 'Hello, a note has just been added to your invoice:', 'invoicing' ); |
|
1536 | - $before_note .= '<blockquote class="wpinv-note">'.wpautop( wptexturize( $customer_note ) ).'</blockquote>'; |
|
1537 | - $before_note .= __( 'For your reference, your invoice details are shown below.', 'invoicing' ); |
|
1535 | + $before_note .= __('Hello, a note has just been added to your invoice:', 'invoicing'); |
|
1536 | + $before_note .= '<blockquote class="wpinv-note">' . wpautop(wptexturize($customer_note)) . '</blockquote>'; |
|
1537 | + $before_note .= __('For your reference, your invoice details are shown below.', 'invoicing'); |
|
1538 | 1538 | echo $before_note; |
1539 | 1539 | } |
1540 | 1540 | } |
1541 | 1541 | \ No newline at end of file |