@@ -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,58 +36,58 @@ 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 | - <?php if($invoice->has_status(array('auto-draft', 'wpi-pending', 'wpi-quote-pending'))){ ?> |
|
41 | + <?php if ($invoice->has_status(array('auto-draft', 'wpi-pending', 'wpi-quote-pending'))) { ?> |
|
42 | 42 | <div class="gdmbx-td"> |
43 | - <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> |
|
44 | - <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> |
|
45 | - <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> |
|
43 | + <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> |
|
44 | + <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> |
|
45 | + <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> |
|
46 | 46 | </div> |
47 | 47 | <?php } ?> |
48 | 48 | </div> |
49 | 49 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-first-name table-layout"> |
50 | - <div class="gdmbx-th"><label for="wpinv_first_name"><?php _e( 'First Name', 'invoicing' );?></label></div> |
|
50 | + <div class="gdmbx-th"><label for="wpinv_first_name"><?php _e('First Name', 'invoicing'); ?></label></div> |
|
51 | 51 | <div class="gdmbx-td"> |
52 | - <input type="text" class="gdmbx2-text-large" name="wpinv_first_name" id="wpinv_first_name" value="<?php echo esc_attr( $invoice->first_name );?>" /> |
|
52 | + <input type="text" class="gdmbx2-text-large" name="wpinv_first_name" id="wpinv_first_name" value="<?php echo esc_attr($invoice->first_name); ?>" /> |
|
53 | 53 | </div> |
54 | 54 | </div> |
55 | 55 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-last-name table-layout"> |
56 | - <div class="gdmbx-th"><label for="wpinv_last_name"><?php _e( 'Last Name', 'invoicing' );?></label></div> |
|
56 | + <div class="gdmbx-th"><label for="wpinv_last_name"><?php _e('Last Name', 'invoicing'); ?></label></div> |
|
57 | 57 | <div class="gdmbx-td"> |
58 | - <input type="text" class="gdmbx2-text-large" name="wpinv_last_name" id="wpinv_last_name" value="<?php echo esc_attr( $invoice->last_name );?>" /> |
|
58 | + <input type="text" class="gdmbx2-text-large" name="wpinv_last_name" id="wpinv_last_name" value="<?php echo esc_attr($invoice->last_name); ?>" /> |
|
59 | 59 | </div> |
60 | 60 | </div> |
61 | 61 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-company table-layout"> |
62 | - <div class="gdmbx-th"><label for="wpinv_company"><?php _e( 'Company', 'invoicing' );?></label></div> |
|
62 | + <div class="gdmbx-th"><label for="wpinv_company"><?php _e('Company', 'invoicing'); ?></label></div> |
|
63 | 63 | <div class="gdmbx-td"> |
64 | - <input type="text" class="gdmbx2-text-large" name="wpinv_company" id="wpinv_company" value="<?php echo esc_attr( $invoice->company );?>" /> |
|
64 | + <input type="text" class="gdmbx2-text-large" name="wpinv_company" id="wpinv_company" value="<?php echo esc_attr($invoice->company); ?>" /> |
|
65 | 65 | </div> |
66 | 66 | </div> |
67 | 67 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-vat-number table-layout"> |
68 | - <div class="gdmbx-th"><label for="wpinv_vat_number"><?php _e( 'Vat Number', 'invoicing' );?></label></div> |
|
68 | + <div class="gdmbx-th"><label for="wpinv_vat_number"><?php _e('Vat Number', 'invoicing'); ?></label></div> |
|
69 | 69 | <div class="gdmbx-td"> |
70 | - <input type="text" class="gdmbx2-text-large" name="wpinv_vat_number" id="wpinv_vat_number" value="<?php echo esc_attr( $invoice->vat_number );?>" /> |
|
70 | + <input type="text" class="gdmbx2-text-large" name="wpinv_vat_number" id="wpinv_vat_number" value="<?php echo esc_attr($invoice->vat_number); ?>" /> |
|
71 | 71 | </div> |
72 | 72 | </div> |
73 | 73 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-address table-layout"> |
74 | - <div class="gdmbx-th"><label for="wpinv_address"><?php _e( 'Address', 'invoicing' );?></label></div> |
|
74 | + <div class="gdmbx-th"><label for="wpinv_address"><?php _e('Address', 'invoicing'); ?></label></div> |
|
75 | 75 | <div class="gdmbx-td"> |
76 | - <input type="text" class="gdmbx2-text-large" name="wpinv_address" id="wpinv_address" value="<?php echo esc_attr( $invoice->address );?>" /> |
|
76 | + <input type="text" class="gdmbx2-text-large" name="wpinv_address" id="wpinv_address" value="<?php echo esc_attr($invoice->address); ?>" /> |
|
77 | 77 | </div> |
78 | 78 | </div> |
79 | 79 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-city table-layout"> |
80 | - <div class="gdmbx-th"><label for="wpinv_city"><?php _e( 'City', 'invoicing' );?></label></div> |
|
80 | + <div class="gdmbx-th"><label for="wpinv_city"><?php _e('City', 'invoicing'); ?></label></div> |
|
81 | 81 | <div class="gdmbx-td"> |
82 | - <input type="text" class="gdmbx2-text-large" name="wpinv_city" id="wpinv_city" value="<?php echo esc_attr( $invoice->city );?>" /> |
|
82 | + <input type="text" class="gdmbx2-text-large" name="wpinv_city" id="wpinv_city" value="<?php echo esc_attr($invoice->city); ?>" /> |
|
83 | 83 | </div> |
84 | 84 | </div> |
85 | 85 | <div class="gdmbx-row gdmbx-type-select gdmbx-wpinv-country table-layout"> |
86 | - <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> |
|
86 | + <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> |
|
87 | 87 | <div class="gdmbx-td"> |
88 | 88 | <?php |
89 | - echo wpinv_html_select( array( |
|
90 | - 'options' => array_merge( array( '' => __( 'Choose a country', 'invoicing' ) ), wpinv_get_country_list() ), |
|
89 | + echo wpinv_html_select(array( |
|
90 | + 'options' => array_merge(array('' => __('Choose a country', 'invoicing')), wpinv_get_country_list()), |
|
91 | 91 | 'name' => 'wpinv_country', |
92 | 92 | 'id' => 'wpinv_country', |
93 | 93 | 'selected' => $invoice->country, |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | 'show_option_none' => false, |
96 | 96 | 'class' => 'gdmbx2-text-large', |
97 | 97 | 'chosen' => false, |
98 | - 'placeholder' => __( 'Choose a country', 'invoicing' ), |
|
98 | + 'placeholder' => __('Choose a country', 'invoicing'), |
|
99 | 99 | 'required' => false, |
100 | - ) ); |
|
100 | + )); |
|
101 | 101 | ?> |
102 | 102 | </div> |
103 | 103 | </div> |
104 | 104 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-state table-layout"> |
105 | - <div class="gdmbx-th"><label for="wpinv_state"><?php _e( 'State', 'invoicing' );?></label></div> |
|
105 | + <div class="gdmbx-th"><label for="wpinv_state"><?php _e('State', 'invoicing'); ?></label></div> |
|
106 | 106 | <div class="gdmbx-td"> |
107 | 107 | <?php |
108 | - $states = wpinv_get_country_states( $invoice->country ); |
|
109 | - if( !empty( $states ) ) { |
|
110 | - echo wpinv_html_select( array( |
|
111 | - 'options' => array_merge( array( '' => __( 'Choose a state', 'invoicing' ) ), $states ), |
|
108 | + $states = wpinv_get_country_states($invoice->country); |
|
109 | + if (!empty($states)) { |
|
110 | + echo wpinv_html_select(array( |
|
111 | + 'options' => array_merge(array('' => __('Choose a state', 'invoicing')), $states), |
|
112 | 112 | 'name' => 'wpinv_state', |
113 | 113 | 'id' => 'wpinv_state', |
114 | 114 | 'selected' => $invoice->state, |
@@ -116,44 +116,44 @@ discard block |
||
116 | 116 | 'show_option_none' => false, |
117 | 117 | 'class' => 'gdmbx2-text-large', |
118 | 118 | 'chosen' => false, |
119 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
119 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
120 | 120 | 'required' => false, |
121 | - ) ); |
|
121 | + )); |
|
122 | 122 | } else { |
123 | - echo wpinv_html_text( array( |
|
123 | + echo wpinv_html_text(array( |
|
124 | 124 | 'name' => 'wpinv_state', |
125 | - 'value' => ! empty( $invoice->state ) ? $invoice->state : '', |
|
125 | + 'value' => !empty($invoice->state) ? $invoice->state : '', |
|
126 | 126 | 'id' => 'wpinv_state', |
127 | 127 | 'class' => 'gdmbx2-text-large', |
128 | 128 | 'required' => false, |
129 | - ) ); |
|
129 | + )); |
|
130 | 130 | } |
131 | 131 | ?> |
132 | 132 | </div> |
133 | 133 | </div> |
134 | 134 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-zip table-layout"> |
135 | - <div class="gdmbx-th"><label for="wpinv_zip"><?php _e( 'Zipcode', 'invoicing' );?></label></div> |
|
135 | + <div class="gdmbx-th"><label for="wpinv_zip"><?php _e('Zipcode', 'invoicing'); ?></label></div> |
|
136 | 136 | <div class="gdmbx-td"> |
137 | - <input type="text" class="gdmbx2-text-large" name="wpinv_zip" id="wpinv_zip" value="<?php echo esc_attr( $invoice->zip );?>" /> |
|
137 | + <input type="text" class="gdmbx2-text-large" name="wpinv_zip" id="wpinv_zip" value="<?php echo esc_attr($invoice->zip); ?>" /> |
|
138 | 138 | </div> |
139 | 139 | </div> |
140 | 140 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-phone table-layout"> |
141 | - <div class="gdmbx-th"><label for="wpinv_phone"><?php _e( 'Phone', 'invoicing' );?></label></div> |
|
141 | + <div class="gdmbx-th"><label for="wpinv_phone"><?php _e('Phone', 'invoicing'); ?></label></div> |
|
142 | 142 | <div class="gdmbx-td"> |
143 | - <input type="text" class="gdmbx2-text-large" name="wpinv_phone" id="wpinv_phone" value="<?php echo esc_attr( $invoice->phone );?>" /> |
|
143 | + <input type="text" class="gdmbx2-text-large" name="wpinv_phone" id="wpinv_phone" value="<?php echo esc_attr($invoice->phone); ?>" /> |
|
144 | 144 | </div> |
145 | 145 | </div> |
146 | 146 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-ip table-layout"> |
147 | - <div class="gdmbx-th"><label for="wpinv_ip"><?php _e( 'IP Address', 'invoicing' );?><?php if ($invoice->ip) { ?> |
|
148 | - <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 | + <div class="gdmbx-th"><label for="wpinv_ip"><?php _e('IP Address', 'invoicing'); ?><?php if ($invoice->ip) { ?> |
|
148 | + <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> |
|
149 | 149 | <?php } ?></label></div> |
150 | 150 | <div class="gdmbx-td"> |
151 | - <input type="text" class="gdmbx2-text-large" value="<?php echo esc_attr( $invoice->ip );?>" readonly /> |
|
151 | + <input type="text" class="gdmbx2-text-large" value="<?php echo esc_attr($invoice->ip); ?>" readonly /> |
|
152 | 152 | </div> |
153 | 153 | </div> |
154 | 154 | </div> |
155 | 155 | </div> |
156 | -<?php wp_nonce_field( 'wpinv_save_invoice', 'wpinv_save_invoice' ) ;?> |
|
156 | +<?php wp_nonce_field('wpinv_save_invoice', 'wpinv_save_invoice'); ?> |
|
157 | 157 | <?php |
158 | 158 | } |
159 | 159 | } |
@@ -1,56 +1,56 @@ |
||
1 | 1 | <?php |
2 | -if ( !defined('ABSPATH') ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | -do_action( 'wpinv_invalid_invoice_before_display' ); ?><!DOCTYPE html> |
|
5 | +do_action('wpinv_invalid_invoice_before_display'); ?><!DOCTYPE html> |
|
6 | 6 | <html <?php language_attributes(); ?>> |
7 | 7 | <head> |
8 | 8 | <meta charset="UTF-8"> |
9 | 9 | <title><?php wp_title() ?></title> |
10 | - <meta charset="<?php bloginfo( 'charset' ); ?>" /> |
|
10 | + <meta charset="<?php bloginfo('charset'); ?>" /> |
|
11 | 11 | <meta name="viewport" content="width=device-width,initial-scale=1"> |
12 | 12 | <meta name="robots" content="noindex,nofollow"> |
13 | - <?php do_action( 'wpinv_invalid_invoice_head' ); ?> |
|
13 | + <?php do_action('wpinv_invalid_invoice_head'); ?> |
|
14 | 14 | </head> |
15 | 15 | <body class="body wpinv wpinv-print wpinv-invalid-invoice"> |
16 | - <?php do_action( 'wpinv_invalid_invoice_body_start' ); ?> |
|
16 | + <?php do_action('wpinv_invalid_invoice_body_start'); ?> |
|
17 | 17 | <div class="container wpinv-wrap"> |
18 | 18 | <!-- ///// Start Header --> |
19 | 19 | <htmlpageheader name="wpinv-pdf-header"> |
20 | - <?php do_action( 'wpinv_invalid_invoice_before_header' ); ?> |
|
20 | + <?php do_action('wpinv_invalid_invoice_before_header'); ?> |
|
21 | 21 | <div class="row wpinv-header"> |
22 | 22 | <div class="col-xs-12 wpinv-business"> |
23 | - <a target="_blank" href="<?php echo esc_url( wpinv_get_business_website() ); ?>"> |
|
24 | - <?php if ( $logo = wpinv_get_business_logo() ) { ?> |
|
25 | - <img class="logo" src="<?php echo esc_url( $logo ); ?>"> |
|
23 | + <a target="_blank" href="<?php echo esc_url(wpinv_get_business_website()); ?>"> |
|
24 | + <?php if ($logo = wpinv_get_business_logo()) { ?> |
|
25 | + <img class="logo" src="<?php echo esc_url($logo); ?>"> |
|
26 | 26 | <?php } else { ?> |
27 | - <h1><?php echo esc_html( wpinv_get_business_name() ); ?></h1> |
|
27 | + <h1><?php echo esc_html(wpinv_get_business_name()); ?></h1> |
|
28 | 28 | <?php } ?> |
29 | 29 | </a> |
30 | 30 | </div> |
31 | 31 | </div> |
32 | - <?php do_action( 'wpinv_invalid_invoice_after_header' ); ?> |
|
32 | + <?php do_action('wpinv_invalid_invoice_after_header'); ?> |
|
33 | 33 | </htmlpageheader> |
34 | 34 | <!-- End Header ///// --> |
35 | 35 | |
36 | - <?php do_action( 'wpinv_invalid_invoice_before_content' ); ?> |
|
36 | + <?php do_action('wpinv_invalid_invoice_before_content'); ?> |
|
37 | 37 | |
38 | - <?php do_action( 'wpinv_invalid_invoice_content' ); ?> |
|
38 | + <?php do_action('wpinv_invalid_invoice_content'); ?> |
|
39 | 39 | |
40 | - <?php do_action( 'wpinv_invalid_invoice_after_content' ); ?> |
|
40 | + <?php do_action('wpinv_invalid_invoice_after_content'); ?> |
|
41 | 41 | |
42 | 42 | <!-- ///// Start Footer --> |
43 | 43 | <htmlpagefooter name="wpinv-pdf-footer"> |
44 | - <?php do_action( 'wpinv_invalid_invoice_before_footer' ); ?> |
|
44 | + <?php do_action('wpinv_invalid_invoice_before_footer'); ?> |
|
45 | 45 | <div class="row wpinv-footer"> |
46 | 46 | <div class="col-sm-12"> |
47 | 47 | <div class="footer-text"><?php echo wpinv_get_business_footer(); ?></div> |
48 | 48 | </div> |
49 | 49 | </div> |
50 | - <?php do_action( 'wpinv_invalid_invoice_after_footer' ); ?> |
|
50 | + <?php do_action('wpinv_invalid_invoice_after_footer'); ?> |
|
51 | 51 | </htmlpagefooter> |
52 | 52 | <!-- End Footer ///// --> |
53 | 53 | </div> |
54 | - <?php do_action( 'wpinv_invalid_invoice_body_end' ); ?> |
|
54 | + <?php do_action('wpinv_invalid_invoice_body_end'); ?> |
|
55 | 55 | </body> |
56 | 56 | </html> |
57 | 57 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -function wpinv_get_subscriptions( $args = array() ) { |
|
3 | - if ( empty( $args['parent_invoice_id'] ) ) { |
|
2 | +function wpinv_get_subscriptions($args = array()) { |
|
3 | + if (empty($args['parent_invoice_id'])) { |
|
4 | 4 | return false; |
5 | 5 | } |
6 | 6 | |
@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | ); |
15 | 15 | |
16 | 16 | $args['post_parent'] = $args['parent_invoice_id']; |
17 | - $args = wp_parse_args( $args, $defaults ); |
|
17 | + $args = wp_parse_args($args, $defaults); |
|
18 | 18 | |
19 | - if( $args['numberposts'] < 1 ) { |
|
19 | + if ($args['numberposts'] < 1) { |
|
20 | 20 | $args['numberposts'] = 999999999999; |
21 | 21 | } |
22 | 22 | |
23 | - $posts = get_posts( $args ); |
|
23 | + $posts = get_posts($args); |
|
24 | 24 | $subscriptions = array(); |
25 | - if ( !empty( $posts ) ) { |
|
26 | - foreach ( $posts as $post ) { |
|
27 | - if ( !empty( $post->ID ) ) { |
|
28 | - $subscriptions[] = wpinv_get_invoice( $post->ID ); |
|
25 | + if (!empty($posts)) { |
|
26 | + foreach ($posts as $post) { |
|
27 | + if (!empty($post->ID)) { |
|
28 | + $subscriptions[] = wpinv_get_invoice($post->ID); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | } |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | |
34 | 34 | return $subscriptions; |
35 | 35 | } |
36 | -function wpinv_get_subscription( $id = 0, $by_profile_id = false ) { |
|
36 | +function wpinv_get_subscription($id = 0, $by_profile_id = false) { |
|
37 | 37 | global $wpdb; |
38 | 38 | |
39 | - if ( empty( $id ) ) { |
|
39 | + if (empty($id)) { |
|
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
43 | - $id = esc_sql( $id ); |
|
43 | + $id = esc_sql($id); |
|
44 | 44 | |
45 | - $invoice_id = $wpdb->get_var( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wpinv_profile_id' AND meta_value = '{$id}' LIMIT 1" ); |
|
45 | + $invoice_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wpinv_profile_id' AND meta_value = '{$id}' LIMIT 1"); |
|
46 | 46 | |
47 | - if ( $invoice_id != null ) { |
|
48 | - return wpinv_get_invoice( $invoice_id ); |
|
47 | + if ($invoice_id != null) { |
|
48 | + return wpinv_get_invoice($invoice_id); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return false; |
@@ -55,46 +55,46 @@ discard block |
||
55 | 55 | * Records a new payment on the subscription |
56 | 56 | * |
57 | 57 | */ |
58 | -function wpinv_recurring_add_subscription_payment( $parent_invoice_id, $subscription_args = array() ) { |
|
59 | - $args = wp_parse_args( $subscription_args, array( |
|
58 | +function wpinv_recurring_add_subscription_payment($parent_invoice_id, $subscription_args = array()) { |
|
59 | + $args = wp_parse_args($subscription_args, array( |
|
60 | 60 | 'amount' => '', |
61 | 61 | 'transaction_id' => '', |
62 | 62 | 'gateway' => '' |
63 | - ) ); |
|
63 | + )); |
|
64 | 64 | |
65 | - if ( wpinv_payment_exists( $args['transaction_id'] ) ) { |
|
65 | + if (wpinv_payment_exists($args['transaction_id'])) { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | |
69 | - $parent_invoice = wpinv_get_invoice( $parent_invoice_id ); |
|
70 | - if ( empty( $parent_invoice ) ) { |
|
69 | + $parent_invoice = wpinv_get_invoice($parent_invoice_id); |
|
70 | + if (empty($parent_invoice)) { |
|
71 | 71 | return; |
72 | 72 | } |
73 | 73 | |
74 | 74 | $invoice = new WPInv_Invoice(); |
75 | - $invoice->set( 'parent_invoice', $parent_invoice_id ); |
|
76 | - $invoice->set( 'currency', $parent_invoice->get_currency() ); |
|
77 | - $invoice->set( 'transaction_id', $args['transaction_id'] ); |
|
78 | - $invoice->set( 'key', $parent_invoice->generate_key() ); |
|
79 | - $invoice->set( 'ip', $parent_invoice->ip ); |
|
80 | - $invoice->set( 'user_id', $parent_invoice->get_user_id() ); |
|
81 | - $invoice->set( 'first_name', $parent_invoice->get_first_name() ); |
|
82 | - $invoice->set( 'last_name', $parent_invoice->get_last_name() ); |
|
83 | - $invoice->set( 'phone', $parent_invoice->phone ); |
|
84 | - $invoice->set( 'address', $parent_invoice->address ); |
|
85 | - $invoice->set( 'city', $parent_invoice->city ); |
|
86 | - $invoice->set( 'country', $parent_invoice->country ); |
|
87 | - $invoice->set( 'state', $parent_invoice->state ); |
|
88 | - $invoice->set( 'zip', $parent_invoice->zip ); |
|
89 | - $invoice->set( 'company', $parent_invoice->company ); |
|
90 | - $invoice->set( 'vat_number', $parent_invoice->vat_number ); |
|
91 | - $invoice->set( 'vat_rate', $parent_invoice->vat_rate ); |
|
92 | - $invoice->set( 'adddress_confirmed', $parent_invoice->adddress_confirmed ); |
|
93 | - |
|
94 | - if ( empty( $args['gateway'] ) ) { |
|
95 | - $invoice->set( 'gateway', $parent_invoice->get_gateway() ); |
|
75 | + $invoice->set('parent_invoice', $parent_invoice_id); |
|
76 | + $invoice->set('currency', $parent_invoice->get_currency()); |
|
77 | + $invoice->set('transaction_id', $args['transaction_id']); |
|
78 | + $invoice->set('key', $parent_invoice->generate_key()); |
|
79 | + $invoice->set('ip', $parent_invoice->ip); |
|
80 | + $invoice->set('user_id', $parent_invoice->get_user_id()); |
|
81 | + $invoice->set('first_name', $parent_invoice->get_first_name()); |
|
82 | + $invoice->set('last_name', $parent_invoice->get_last_name()); |
|
83 | + $invoice->set('phone', $parent_invoice->phone); |
|
84 | + $invoice->set('address', $parent_invoice->address); |
|
85 | + $invoice->set('city', $parent_invoice->city); |
|
86 | + $invoice->set('country', $parent_invoice->country); |
|
87 | + $invoice->set('state', $parent_invoice->state); |
|
88 | + $invoice->set('zip', $parent_invoice->zip); |
|
89 | + $invoice->set('company', $parent_invoice->company); |
|
90 | + $invoice->set('vat_number', $parent_invoice->vat_number); |
|
91 | + $invoice->set('vat_rate', $parent_invoice->vat_rate); |
|
92 | + $invoice->set('adddress_confirmed', $parent_invoice->adddress_confirmed); |
|
93 | + |
|
94 | + if (empty($args['gateway'])) { |
|
95 | + $invoice->set('gateway', $parent_invoice->get_gateway()); |
|
96 | 96 | } else { |
97 | - $invoice->set( 'gateway', $args['gateway'] ); |
|
97 | + $invoice->set('gateway', $args['gateway']); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $recurring_details = $parent_invoice->get_recurring_details(); |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | // increase the earnings for each item in the subscription |
103 | 103 | $items = $recurring_details['cart_details']; |
104 | 104 | |
105 | - if ( $items ) { |
|
105 | + if ($items) { |
|
106 | 106 | $add_items = array(); |
107 | 107 | $cart_details = array(); |
108 | 108 | |
109 | - foreach ( $items as $item ) { |
|
109 | + foreach ($items as $item) { |
|
110 | 110 | $add_item = array(); |
111 | 111 | $add_item['id'] = $item['id']; |
112 | 112 | $add_item['quantity'] = $item['quantity']; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | break; |
117 | 117 | } |
118 | 118 | |
119 | - $invoice->set( 'items', $add_items ); |
|
119 | + $invoice->set('items', $add_items); |
|
120 | 120 | $invoice->cart_details = $cart_details; |
121 | 121 | } |
122 | 122 | |
@@ -126,277 +126,277 @@ discard block |
||
126 | 126 | $tax = $recurring_details['tax']; |
127 | 127 | $discount = $recurring_details['discount']; |
128 | 128 | |
129 | - if ( $discount > 0 ) { |
|
130 | - $invoice->set( 'discount_code', $parent_invoice->discount_code ); |
|
129 | + if ($discount > 0) { |
|
130 | + $invoice->set('discount_code', $parent_invoice->discount_code); |
|
131 | 131 | } |
132 | 132 | |
133 | - $invoice->subtotal = wpinv_round_amount( $subtotal ); |
|
134 | - $invoice->tax = wpinv_round_amount( $tax ); |
|
135 | - $invoice->discount = wpinv_round_amount( $discount ); |
|
136 | - $invoice->total = wpinv_round_amount( $total ); |
|
133 | + $invoice->subtotal = wpinv_round_amount($subtotal); |
|
134 | + $invoice->tax = wpinv_round_amount($tax); |
|
135 | + $invoice->discount = wpinv_round_amount($discount); |
|
136 | + $invoice->total = wpinv_round_amount($total); |
|
137 | 137 | $invoice->save(); |
138 | 138 | |
139 | - wpinv_update_payment_status( $invoice->ID, 'publish' ); |
|
139 | + wpinv_update_payment_status($invoice->ID, 'publish'); |
|
140 | 140 | sleep(1); |
141 | - wpinv_update_payment_status( $invoice->ID, 'wpi-renewal' ); |
|
141 | + wpinv_update_payment_status($invoice->ID, 'wpi-renewal'); |
|
142 | 142 | |
143 | - $invoice = wpinv_get_invoice( $invoice->ID ); |
|
143 | + $invoice = wpinv_get_invoice($invoice->ID); |
|
144 | 144 | |
145 | - $subscription_data = wpinv_payment_subscription_data( $parent_invoice ); |
|
145 | + $subscription_data = wpinv_payment_subscription_data($parent_invoice); |
|
146 | 146 | $subscription_data['recurring_amount'] = $invoice->get_total(); |
147 | - $subscription_data['created'] = current_time( 'mysql', 0 ); |
|
148 | - $subscription_data['expiration'] = $invoice->get_new_expiration( $subscription_data['item_id'] ); |
|
147 | + $subscription_data['created'] = current_time('mysql', 0); |
|
148 | + $subscription_data['expiration'] = $invoice->get_new_expiration($subscription_data['item_id']); |
|
149 | 149 | |
150 | 150 | // Retrieve pending subscription from database and update it's status to active and set proper profile ID |
151 | - $invoice->update_subscription( $subscription_data ); |
|
151 | + $invoice->update_subscription($subscription_data); |
|
152 | 152 | |
153 | - do_action( 'wpinv_recurring_add_subscription_payment', $invoice, $parent_invoice, $subscription_args ); |
|
154 | - do_action( 'wpinv_recurring_record_payment', $invoice->ID, $parent_invoice_id, $subscription_args ); |
|
153 | + do_action('wpinv_recurring_add_subscription_payment', $invoice, $parent_invoice, $subscription_args); |
|
154 | + do_action('wpinv_recurring_record_payment', $invoice->ID, $parent_invoice_id, $subscription_args); |
|
155 | 155 | |
156 | 156 | return $invoice; |
157 | 157 | } |
158 | 158 | |
159 | -function wpinv_payment_exists( $txn_id = '' ) { |
|
159 | +function wpinv_payment_exists($txn_id = '') { |
|
160 | 160 | global $wpdb; |
161 | 161 | |
162 | - if ( empty( $txn_id ) ) { |
|
162 | + if (empty($txn_id)) { |
|
163 | 163 | return false; |
164 | 164 | } |
165 | 165 | |
166 | - $txn_id = esc_sql( $txn_id ); |
|
166 | + $txn_id = esc_sql($txn_id); |
|
167 | 167 | |
168 | - $invoice = $wpdb->get_var( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wpinv_transaction_id' AND meta_value = '{$txn_id}' LIMIT 1" ); |
|
168 | + $invoice = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wpinv_transaction_id' AND meta_value = '{$txn_id}' LIMIT 1"); |
|
169 | 169 | |
170 | - if ( $invoice != null ) { |
|
170 | + if ($invoice != null) { |
|
171 | 171 | return true; |
172 | 172 | } |
173 | 173 | |
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | |
177 | -function wpinv_is_subscription_payment( $invoice = '' ) { |
|
178 | - if ( empty( $invoice ) ) { |
|
177 | +function wpinv_is_subscription_payment($invoice = '') { |
|
178 | + if (empty($invoice)) { |
|
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | |
182 | - if ( !is_object( $invoice ) && is_scalar( $invoice ) ) { |
|
183 | - $invoice = wpinv_get_invoice( $invoice ); |
|
182 | + if (!is_object($invoice) && is_scalar($invoice)) { |
|
183 | + $invoice = wpinv_get_invoice($invoice); |
|
184 | 184 | } |
185 | 185 | |
186 | - if ( empty( $invoice ) ) { |
|
186 | + if (empty($invoice)) { |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | |
190 | - if ( $invoice->is_renewal() ) { |
|
190 | + if ($invoice->is_renewal()) { |
|
191 | 191 | return true; |
192 | 192 | } |
193 | 193 | |
194 | 194 | return false; |
195 | 195 | } |
196 | 196 | |
197 | -function wpinv_payment_subscription_data( $invoice = '' ) { |
|
198 | - if ( empty( $invoice ) ) { |
|
197 | +function wpinv_payment_subscription_data($invoice = '') { |
|
198 | + if (empty($invoice)) { |
|
199 | 199 | return false; |
200 | 200 | } |
201 | 201 | |
202 | - if ( !is_object( $invoice ) && is_scalar( $invoice ) ) { |
|
203 | - $invoice = wpinv_get_invoice( $invoice ); |
|
202 | + if (!is_object($invoice) && is_scalar($invoice)) { |
|
203 | + $invoice = wpinv_get_invoice($invoice); |
|
204 | 204 | } |
205 | 205 | |
206 | - if ( empty( $invoice ) ) { |
|
206 | + if (empty($invoice)) { |
|
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | |
210 | 210 | return $invoice->get_subscription_data(); |
211 | 211 | } |
212 | 212 | |
213 | -function wpinv_payment_link_transaction_id( $invoice = '' ) { |
|
214 | - if ( empty( $invoice ) ) { |
|
213 | +function wpinv_payment_link_transaction_id($invoice = '') { |
|
214 | + if (empty($invoice)) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
218 | - if ( !is_object( $invoice ) && is_scalar( $invoice ) ) { |
|
219 | - $invoice = wpinv_get_invoice( $invoice ); |
|
218 | + if (!is_object($invoice) && is_scalar($invoice)) { |
|
219 | + $invoice = wpinv_get_invoice($invoice); |
|
220 | 220 | } |
221 | 221 | |
222 | - if ( empty( $invoice ) ) { |
|
222 | + if (empty($invoice)) { |
|
223 | 223 | return false; |
224 | 224 | } |
225 | 225 | |
226 | - return apply_filters( 'wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice ); |
|
226 | + return apply_filters('wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice); |
|
227 | 227 | } |
228 | 228 | |
229 | -function wpinv_get_pretty_subscription_period( $period ) { |
|
229 | +function wpinv_get_pretty_subscription_period($period) { |
|
230 | 230 | $frequency = ''; |
231 | 231 | //Format period details |
232 | - switch ( $period ) { |
|
232 | + switch ($period) { |
|
233 | 233 | case 'D' : |
234 | 234 | case 'day' : |
235 | - $frequency = __( 'Daily', 'invoicing' ); |
|
235 | + $frequency = __('Daily', 'invoicing'); |
|
236 | 236 | break; |
237 | 237 | case 'W' : |
238 | 238 | case 'week' : |
239 | - $frequency = __( 'Weekly', 'invoicing' ); |
|
239 | + $frequency = __('Weekly', 'invoicing'); |
|
240 | 240 | break; |
241 | 241 | case 'M' : |
242 | 242 | case 'month' : |
243 | - $frequency = __( 'Monthly', 'invoicing' ); |
|
243 | + $frequency = __('Monthly', 'invoicing'); |
|
244 | 244 | break; |
245 | 245 | case 'Y' : |
246 | 246 | case 'year' : |
247 | - $frequency = __( 'Yearly', 'invoicing' ); |
|
247 | + $frequency = __('Yearly', 'invoicing'); |
|
248 | 248 | break; |
249 | 249 | default : |
250 | - $frequency = apply_filters( 'wpinv_pretty_subscription_period', $frequency, $period ); |
|
250 | + $frequency = apply_filters('wpinv_pretty_subscription_period', $frequency, $period); |
|
251 | 251 | break; |
252 | 252 | } |
253 | 253 | |
254 | 254 | return $frequency; |
255 | 255 | } |
256 | 256 | |
257 | -function wpinv_get_pretty_subscription_period_name( $period ) { |
|
257 | +function wpinv_get_pretty_subscription_period_name($period) { |
|
258 | 258 | $frequency = ''; |
259 | 259 | //Format period details |
260 | - switch ( $period ) { |
|
260 | + switch ($period) { |
|
261 | 261 | case 'D' : |
262 | 262 | case 'day' : |
263 | - $frequency = __( 'Day', 'invoicing' ); |
|
263 | + $frequency = __('Day', 'invoicing'); |
|
264 | 264 | break; |
265 | 265 | case 'W' : |
266 | 266 | case 'week' : |
267 | - $frequency = __( 'Week', 'invoicing' ); |
|
267 | + $frequency = __('Week', 'invoicing'); |
|
268 | 268 | break; |
269 | 269 | case 'M' : |
270 | 270 | case 'month' : |
271 | - $frequency = __( 'Month', 'invoicing' ); |
|
271 | + $frequency = __('Month', 'invoicing'); |
|
272 | 272 | break; |
273 | 273 | case 'Y' : |
274 | 274 | case 'year' : |
275 | - $frequency = __( 'Year', 'invoicing' ); |
|
275 | + $frequency = __('Year', 'invoicing'); |
|
276 | 276 | break; |
277 | 277 | default : |
278 | - $frequency = apply_filters( 'wpinv_pretty_subscription_period_name', $frequency, $period ); |
|
278 | + $frequency = apply_filters('wpinv_pretty_subscription_period_name', $frequency, $period); |
|
279 | 279 | break; |
280 | 280 | } |
281 | 281 | |
282 | 282 | return $frequency; |
283 | 283 | } |
284 | 284 | |
285 | -function wpinv_subscription_initial_payment_desc( $amount, $period, $interval, $trial_period = '', $trial_interval = 0 ) { |
|
285 | +function wpinv_subscription_initial_payment_desc($amount, $period, $interval, $trial_period = '', $trial_interval = 0) { |
|
286 | 286 | $interval = (int)$interval > 0 ? (int)$interval : 1; |
287 | 287 | |
288 | - if ( $trial_interval > 0 && !empty( $trial_period ) ) { |
|
289 | - $amount = __( 'Free', 'invoicing' ); |
|
288 | + if ($trial_interval > 0 && !empty($trial_period)) { |
|
289 | + $amount = __('Free', 'invoicing'); |
|
290 | 290 | $interval = $trial_interval; |
291 | 291 | $period = $trial_period; |
292 | 292 | } |
293 | 293 | |
294 | 294 | $description = ''; |
295 | - switch ( $period ) { |
|
295 | + switch ($period) { |
|
296 | 296 | case 'D' : |
297 | 297 | case 'day' : |
298 | - $description = wp_sprintf( _n( '%s for the first day.', '%s for the first %d days.', $interval, 'invoicing' ), $amount, $interval ); |
|
298 | + $description = wp_sprintf(_n('%s for the first day.', '%s for the first %d days.', $interval, 'invoicing'), $amount, $interval); |
|
299 | 299 | break; |
300 | 300 | case 'W' : |
301 | 301 | case 'week' : |
302 | - $description = wp_sprintf( _n( '%s for the first week.', '%s for the first %d weeks.', $interval, 'invoicing' ), $amount, $interval ); |
|
302 | + $description = wp_sprintf(_n('%s for the first week.', '%s for the first %d weeks.', $interval, 'invoicing'), $amount, $interval); |
|
303 | 303 | break; |
304 | 304 | case 'M' : |
305 | 305 | case 'month' : |
306 | - $description = wp_sprintf( _n( '%s for the first month.', '%s for the first %d months.', $interval, 'invoicing' ), $amount, $interval ); |
|
306 | + $description = wp_sprintf(_n('%s for the first month.', '%s for the first %d months.', $interval, 'invoicing'), $amount, $interval); |
|
307 | 307 | break; |
308 | 308 | case 'Y' : |
309 | 309 | case 'year' : |
310 | - $description = wp_sprintf( _n( '%s for the first year.', '%s for the first %d years.', $interval, 'invoicing' ), $amount, $interval ); |
|
310 | + $description = wp_sprintf(_n('%s for the first year.', '%s for the first %d years.', $interval, 'invoicing'), $amount, $interval); |
|
311 | 311 | break; |
312 | 312 | } |
313 | 313 | |
314 | - return apply_filters( 'wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval ); |
|
314 | + return apply_filters('wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval); |
|
315 | 315 | } |
316 | 316 | |
317 | -function wpinv_subscription_recurring_payment_desc( $amount, $period, $interval, $bill_times = 0, $trial_period = '', $trial_interval = 0 ) { |
|
317 | +function wpinv_subscription_recurring_payment_desc($amount, $period, $interval, $bill_times = 0, $trial_period = '', $trial_interval = 0) { |
|
318 | 318 | $interval = (int)$interval > 0 ? (int)$interval : 1; |
319 | 319 | $bill_times = (int)$bill_times > 0 ? (int)$bill_times : 0; |
320 | 320 | |
321 | 321 | $description = ''; |
322 | - switch ( $period ) { |
|
322 | + switch ($period) { |
|
323 | 323 | case 'D' : |
324 | 324 | case 'day' : |
325 | - if ( (int)$bill_times > 0 ) { |
|
326 | - if ( $interval > 1 ) { |
|
327 | - if ( $bill_times > 1 ) { |
|
328 | - $description = wp_sprintf( __( '%s for each %d days, for %d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
325 | + if ((int)$bill_times > 0) { |
|
326 | + if ($interval > 1) { |
|
327 | + if ($bill_times > 1) { |
|
328 | + $description = wp_sprintf(__('%s for each %d days, for %d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
329 | 329 | } else { |
330 | - $description = wp_sprintf( __( '%s for %d days.', 'invoicing' ), $amount, $interval ); |
|
330 | + $description = wp_sprintf(__('%s for %d days.', 'invoicing'), $amount, $interval); |
|
331 | 331 | } |
332 | 332 | } else { |
333 | - $description = wp_sprintf( _n( '%s for one day.', '%s for each day, for %d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
333 | + $description = wp_sprintf(_n('%s for one day.', '%s for each day, for %d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
334 | 334 | } |
335 | 335 | } else { |
336 | - $description = wp_sprintf( _n( '%s for each day.', '%s for each %d days.', $interval, 'invoicing'), $amount, $interval ); |
|
336 | + $description = wp_sprintf(_n('%s for each day.', '%s for each %d days.', $interval, 'invoicing'), $amount, $interval); |
|
337 | 337 | } |
338 | 338 | break; |
339 | 339 | case 'W' : |
340 | 340 | case 'week' : |
341 | - if ( (int)$bill_times > 0 ) { |
|
342 | - if ( $interval > 1 ) { |
|
343 | - if ( $bill_times > 1 ) { |
|
344 | - $description = wp_sprintf( __( '%s for each %d weeks, for %d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
341 | + if ((int)$bill_times > 0) { |
|
342 | + if ($interval > 1) { |
|
343 | + if ($bill_times > 1) { |
|
344 | + $description = wp_sprintf(__('%s for each %d weeks, for %d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
345 | 345 | } else { |
346 | - $description = wp_sprintf( __( '%s for %d weeks.', 'invoicing' ), $amount, $interval ); |
|
346 | + $description = wp_sprintf(__('%s for %d weeks.', 'invoicing'), $amount, $interval); |
|
347 | 347 | } |
348 | 348 | } else { |
349 | - $description = wp_sprintf( _n( '%s for one week.', '%s for each week, for %d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
349 | + $description = wp_sprintf(_n('%s for one week.', '%s for each week, for %d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
350 | 350 | } |
351 | 351 | } else { |
352 | - $description = wp_sprintf( _n( '%s for each week.', '%s for each %d weeks.', $interval, 'invoicing' ), $amount, $interval ); |
|
352 | + $description = wp_sprintf(_n('%s for each week.', '%s for each %d weeks.', $interval, 'invoicing'), $amount, $interval); |
|
353 | 353 | } |
354 | 354 | break; |
355 | 355 | case 'M' : |
356 | 356 | case 'month' : |
357 | - if ( (int)$bill_times > 0 ) { |
|
358 | - if ( $interval > 1 ) { |
|
359 | - if ( $bill_times > 1 ) { |
|
360 | - $description = wp_sprintf( __( '%s for each %d months, for %d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
357 | + if ((int)$bill_times > 0) { |
|
358 | + if ($interval > 1) { |
|
359 | + if ($bill_times > 1) { |
|
360 | + $description = wp_sprintf(__('%s for each %d months, for %d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
361 | 361 | } else { |
362 | - $description = wp_sprintf( __( '%s for %d months.', 'invoicing' ), $amount, $interval ); |
|
362 | + $description = wp_sprintf(__('%s for %d months.', 'invoicing'), $amount, $interval); |
|
363 | 363 | } |
364 | 364 | } else { |
365 | - $description = wp_sprintf( _n( '%s for one month.', '%s for each month, for %d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
365 | + $description = wp_sprintf(_n('%s for one month.', '%s for each month, for %d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
366 | 366 | } |
367 | 367 | } else { |
368 | - $description = wp_sprintf( _n( '%s for each month.', '%s for each %d months.', $interval, 'invoicing' ), $amount, $interval ); |
|
368 | + $description = wp_sprintf(_n('%s for each month.', '%s for each %d months.', $interval, 'invoicing'), $amount, $interval); |
|
369 | 369 | } |
370 | 370 | break; |
371 | 371 | case 'Y' : |
372 | 372 | case 'year' : |
373 | - if ( (int)$bill_times > 0 ) { |
|
374 | - if ( $interval > 1 ) { |
|
375 | - if ( $bill_times > 1 ) { |
|
376 | - $description = wp_sprintf( __( '%s for each %d years, for %d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
373 | + if ((int)$bill_times > 0) { |
|
374 | + if ($interval > 1) { |
|
375 | + if ($bill_times > 1) { |
|
376 | + $description = wp_sprintf(__('%s for each %d years, for %d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
377 | 377 | } else { |
378 | - $description = wp_sprintf( __( '%s for %d years.', 'invoicing'), $amount, $interval ); |
|
378 | + $description = wp_sprintf(__('%s for %d years.', 'invoicing'), $amount, $interval); |
|
379 | 379 | } |
380 | 380 | } else { |
381 | - $description = wp_sprintf( _n( '%s for one year.', '%s for each year, for %d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
381 | + $description = wp_sprintf(_n('%s for one year.', '%s for each year, for %d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
382 | 382 | } |
383 | 383 | } else { |
384 | - $description = wp_sprintf( _n( '%s for each year.', '%s for each %d years.', $interval, 'invoicing' ), $amount, $interval ); |
|
384 | + $description = wp_sprintf(_n('%s for each year.', '%s for each %d years.', $interval, 'invoicing'), $amount, $interval); |
|
385 | 385 | } |
386 | 386 | break; |
387 | 387 | } |
388 | 388 | |
389 | - return apply_filters( 'wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval ); |
|
389 | + return apply_filters('wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval); |
|
390 | 390 | } |
391 | 391 | |
392 | -function wpinv_subscription_payment_desc( $invoice ) { |
|
393 | - if ( empty( $invoice ) ) { |
|
392 | +function wpinv_subscription_payment_desc($invoice) { |
|
393 | + if (empty($invoice)) { |
|
394 | 394 | return NULL; |
395 | 395 | } |
396 | 396 | |
397 | 397 | $description = ''; |
398 | - if ( $invoice->is_parent() && $item = $invoice->get_recurring( true ) ) { |
|
399 | - if ( $item->has_free_trial() ) { |
|
398 | + if ($invoice->is_parent() && $item = $invoice->get_recurring(true)) { |
|
399 | + if ($item->has_free_trial()) { |
|
400 | 400 | $trial_period = $item->get_trial_period(); |
401 | 401 | $trial_interval = $item->get_trial_interval(); |
402 | 402 | } else { |
@@ -404,45 +404,45 @@ discard block |
||
404 | 404 | $trial_interval = 0; |
405 | 405 | } |
406 | 406 | |
407 | - $description = wpinv_get_billing_cycle( $invoice->get_total(), $invoice->get_recurring_details( 'total' ), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency() ); |
|
407 | + $description = wpinv_get_billing_cycle($invoice->get_total(), $invoice->get_recurring_details('total'), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency()); |
|
408 | 408 | } |
409 | 409 | |
410 | - return apply_filters( 'wpinv_subscription_payment_desc', $description, $invoice ); |
|
410 | + return apply_filters('wpinv_subscription_payment_desc', $description, $invoice); |
|
411 | 411 | } |
412 | 412 | |
413 | -function wpinv_get_billing_cycle( $initial, $recurring, $period, $interval, $bill_times, $trial_period = '', $trial_interval = 0, $currency = '' ) { |
|
414 | - $initial_total = wpinv_round_amount( $initial ); |
|
415 | - $recurring_total = wpinv_round_amount( $recurring ); |
|
413 | +function wpinv_get_billing_cycle($initial, $recurring, $period, $interval, $bill_times, $trial_period = '', $trial_interval = 0, $currency = '') { |
|
414 | + $initial_total = wpinv_round_amount($initial); |
|
415 | + $recurring_total = wpinv_round_amount($recurring); |
|
416 | 416 | |
417 | - if ( $trial_interval > 0 && !empty( $trial_period ) ) { |
|
417 | + if ($trial_interval > 0 && !empty($trial_period)) { |
|
418 | 418 | // Free trial |
419 | 419 | } else { |
420 | - if ( $bill_times == 1 ) { |
|
420 | + if ($bill_times == 1) { |
|
421 | 421 | $recurring_total = $initial_total; |
422 | - } else if ( $bill_times > 1 && $initial_total != $recurring_total ) { |
|
422 | + } else if ($bill_times > 1 && $initial_total != $recurring_total) { |
|
423 | 423 | $bill_times--; |
424 | 424 | } |
425 | 425 | } |
426 | 426 | |
427 | - $initial_amount = wpinv_price( wpinv_format_amount( $initial_total ), $currency ); |
|
428 | - $recurring_amount = wpinv_price( wpinv_format_amount( $recurring_total ), $currency ); |
|
427 | + $initial_amount = wpinv_price(wpinv_format_amount($initial_total), $currency); |
|
428 | + $recurring_amount = wpinv_price(wpinv_format_amount($recurring_total), $currency); |
|
429 | 429 | |
430 | - $recurring = wpinv_subscription_recurring_payment_desc( $recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval ); |
|
430 | + $recurring = wpinv_subscription_recurring_payment_desc($recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval); |
|
431 | 431 | |
432 | - if ( $initial_total != $recurring_total ) { |
|
433 | - $initial = wpinv_subscription_initial_payment_desc( $initial_amount, $period, $interval, $trial_period, $trial_interval ); |
|
432 | + if ($initial_total != $recurring_total) { |
|
433 | + $initial = wpinv_subscription_initial_payment_desc($initial_amount, $period, $interval, $trial_period, $trial_interval); |
|
434 | 434 | |
435 | - $description = wp_sprintf( __( '%s Then %s', 'invoicing' ), $initial, $recurring ); |
|
435 | + $description = wp_sprintf(__('%s Then %s', 'invoicing'), $initial, $recurring); |
|
436 | 436 | } else { |
437 | 437 | $description = $recurring; |
438 | 438 | } |
439 | 439 | |
440 | - return apply_filters( 'wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency ); |
|
440 | + return apply_filters('wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency); |
|
441 | 441 | } |
442 | 442 | |
443 | -function wpinv_recurring_send_payment_failed( $invoice ) { |
|
444 | - if ( !empty( $invoice->ID ) ) { |
|
445 | - wpinv_failed_invoice_notification( $invoice->ID ); |
|
443 | +function wpinv_recurring_send_payment_failed($invoice) { |
|
444 | + if (!empty($invoice->ID)) { |
|
445 | + wpinv_failed_invoice_notification($invoice->ID); |
|
446 | 446 | } |
447 | 447 | } |
448 | -add_action( 'wpinv_recurring_payment_failed', 'wpinv_recurring_send_payment_failed', 10, 1 ); |
|
449 | 448 | \ No newline at end of file |
449 | +add_action('wpinv_recurring_payment_failed', 'wpinv_recurring_send_payment_failed', 10, 1); |
|
450 | 450 | \ No newline at end of file |
@@ -10,19 +10,19 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // MUST have WordPress. |
13 | -if ( !defined( 'WPINC' ) ) { |
|
14 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
13 | +if (!defined('WPINC')) { |
|
14 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
15 | 15 | } |
16 | 16 | |
17 | -if ( !defined( 'WPINV_VERSION' ) ) { |
|
18 | - define( 'WPINV_VERSION', '1.0.0' ); |
|
17 | +if (!defined('WPINV_VERSION')) { |
|
18 | + define('WPINV_VERSION', '1.0.0'); |
|
19 | 19 | } |
20 | 20 | |
21 | -if ( !defined( 'WPINV_PLUGIN_FILE' ) ) { |
|
22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
21 | +if (!defined('WPINV_PLUGIN_FILE')) { |
|
22 | + define('WPINV_PLUGIN_FILE', __FILE__); |
|
23 | 23 | } |
24 | 24 | |
25 | -require plugin_dir_path( __FILE__ ) . 'includes/class-wpinv.php'; |
|
25 | +require plugin_dir_path(__FILE__) . 'includes/class-wpinv.php'; |
|
26 | 26 | |
27 | 27 | function wpinv_run() { |
28 | 28 | global $invoicing; |
@@ -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 saving 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 saving 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 ( $invoice->post_type == 'wpi_invoice' && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->has_status( array( 'auto-draft' ) ) ) ) { ?> |
|
40 | + <?php if ($invoice->post_type == 'wpi_invoice' && 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" value="<?php echo esc_attr( $invoice_number );?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly> |
|
67 | + <input type="text" value="<?php echo esc_attr($invoice_number); ?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly> |
|
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() || $invoice->is_refunded() ) ) || $discount_code ) { ?> |
|
70 | + <?php do_action('wpinv_meta_box_details_inner', $post_id); ?> |
|
71 | + <?php if (!($is_paid = ($invoice->is_paid() || $invoice->is_refunded())) || $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,49 +172,49 @@ 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() && !$wpi_mb_invoice->is_refunded() ) { |
|
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() && !$wpi_mb_invoice->is_refunded()) { |
|
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 ( $key = $wpi_mb_invoice->get_key() ) { ?> |
|
214 | - <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Key:</label> %s', 'invoicing' ), $key ); ?></p> |
|
213 | + <?php if ($key = $wpi_mb_invoice->get_key()) { ?> |
|
214 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Key:</label> %s', 'invoicing'), $key); ?></p> |
|
215 | 215 | <?php } ?> |
216 | - <?php if ( $wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded() ) { ?> |
|
217 | - <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 | + <?php if ($wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded()) { ?> |
|
217 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Transaction ID:</label> %s', 'invoicing'), wpinv_payment_link_transaction_id($wpi_mb_invoice)); ?></p> |
|
218 | 218 | <?php } ?> |
219 | 219 | <?php |
220 | 220 | } |
@@ -9,58 +9,58 @@ |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // If uninstall not called from WordPress, then exit. |
12 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
12 | +if (!defined('WP_UNINSTALL_PLUGIN')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | global $wpdb, $wp_version; |
17 | 17 | |
18 | -$remove_data = get_option( 'wpinv_remove_data_on_invoice_unistall' ); |
|
18 | +$remove_data = get_option('wpinv_remove_data_on_invoice_unistall'); |
|
19 | 19 | |
20 | 20 | /* |
21 | 21 | * Only remove ALL product and page data if WPINV_REMOVE_ALL_DATA constant is set to true in user's |
22 | 22 | * wp-config.php. This is to prevent data loss when deleting the plugin from the backend |
23 | 23 | * and to ensure only the site owner can perform this action. |
24 | 24 | */ |
25 | -if ( defined( 'WPINV_REMOVE_ALL_DATA' ) ) { |
|
25 | +if (defined('WPINV_REMOVE_ALL_DATA')) { |
|
26 | 26 | $remove_data = true === WPINV_REMOVE_ALL_DATA ? true : false; |
27 | 27 | } |
28 | 28 | |
29 | -if ( $remove_data ) { |
|
29 | +if ($remove_data) { |
|
30 | 30 | // Load Invoicing file. |
31 | - include_once( 'invoicing.php' ); |
|
31 | + include_once('invoicing.php'); |
|
32 | 32 | |
33 | 33 | // Roles + caps. |
34 | - include_once( dirname( __FILE__ ) . '/includes/admin/install.php' ); |
|
34 | + include_once(dirname(__FILE__) . '/includes/admin/install.php'); |
|
35 | 35 | wpinv_remove_admin_caps(); |
36 | 36 | |
37 | - $settings = get_option( 'wpinv_settings' ); |
|
37 | + $settings = get_option('wpinv_settings'); |
|
38 | 38 | |
39 | 39 | // Delete pages. |
40 | - $wpi_pages = array( 'checkout_page', 'success_page', 'failure_page', 'invoice_history_page', 'quote_history_page' ); |
|
41 | - foreach ( $wpi_pages as $page ) { |
|
42 | - if ( !empty( $page ) && !empty( $settings[ $page ] ) ) { |
|
43 | - wp_delete_post( $settings[ $page ], true ); |
|
40 | + $wpi_pages = array('checkout_page', 'success_page', 'failure_page', 'invoice_history_page', 'quote_history_page'); |
|
41 | + foreach ($wpi_pages as $page) { |
|
42 | + if (!empty($page) && !empty($settings[$page])) { |
|
43 | + wp_delete_post($settings[$page], true); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Delete posts + data. |
48 | - $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'wpi_invoice', 'wpi_item', 'wpi_discount', 'wpi_quote' );" ); |
|
49 | - $wpdb->query( "DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;" ); |
|
48 | + $wpdb->query("DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'wpi_invoice', 'wpi_item', 'wpi_discount', 'wpi_quote' );"); |
|
49 | + $wpdb->query("DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;"); |
|
50 | 50 | |
51 | 51 | // Delete comments. |
52 | - $wpdb->query( "DELETE FROM {$wpdb->comments} WHERE comment_type LIKE 'wpinv_note';" ); |
|
53 | - $wpdb->query( "DELETE meta FROM {$wpdb->commentmeta} meta LEFT JOIN {$wpdb->comments} comments ON comments.comment_ID = meta.comment_id WHERE comments.comment_ID IS NULL;" ); |
|
52 | + $wpdb->query("DELETE FROM {$wpdb->comments} WHERE comment_type LIKE 'wpinv_note';"); |
|
53 | + $wpdb->query("DELETE meta FROM {$wpdb->commentmeta} meta LEFT JOIN {$wpdb->comments} comments ON comments.comment_ID = meta.comment_id WHERE comments.comment_ID IS NULL;"); |
|
54 | 54 | |
55 | 55 | // Delete user meta. |
56 | - $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%_wpinv_%' OR meta_key LIKE '%_wpi_invoice%' OR meta_key LIKE '%_wpi_item%' OR meta_key LIKE '%_wpi_discount%' OR meta_key LIKE '_wpi_stripe%' OR meta_key LIKE '%_wpi_quote%';" ); |
|
56 | + $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%_wpinv_%' OR meta_key LIKE '%_wpi_invoice%' OR meta_key LIKE '%_wpi_item%' OR meta_key LIKE '%_wpi_discount%' OR meta_key LIKE '_wpi_stripe%' OR meta_key LIKE '%_wpi_quote%';"); |
|
57 | 57 | |
58 | 58 | // Cleanup Cron Schedule |
59 | - wp_clear_scheduled_hook( 'wp_session_garbage_collection' ); |
|
60 | - wp_clear_scheduled_hook( 'wpinv_register_schedule_event_twicedaily' ); |
|
59 | + wp_clear_scheduled_hook('wp_session_garbage_collection'); |
|
60 | + wp_clear_scheduled_hook('wpinv_register_schedule_event_twicedaily'); |
|
61 | 61 | |
62 | 62 | // Delete options. |
63 | - $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'wpinv_%' OR option_name LIKE '_wpinv_%' OR option_name LIKE '\_transient\_wpinv\_%';" ); |
|
63 | + $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE 'wpinv_%' OR option_name LIKE '_wpinv_%' OR option_name LIKE '\_transient\_wpinv\_%';"); |
|
64 | 64 | |
65 | 65 | // Clear any cached data that has been removed |
66 | 66 | wp_cache_flush(); |