@@ -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,122 +36,122 @@ 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', 'draft', 'wpi-pending', 'wpi-quote-pending' ) ) ) { ?> |
|
41 | + <?php if ($invoice->has_status(array('auto-draft', '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, |
94 | 94 | 'show_option_all' => false, |
95 | 95 | 'show_option_none' => false, |
96 | 96 | 'class' => 'gdmbx2-text-large', |
97 | - 'placeholder' => __( 'Choose a country', 'invoicing' ), |
|
97 | + 'placeholder' => __('Choose a country', 'invoicing'), |
|
98 | 98 | 'required' => false, |
99 | - ) ); |
|
99 | + )); |
|
100 | 100 | ?> |
101 | 101 | </div> |
102 | 102 | </div> |
103 | 103 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-state table-layout"> |
104 | - <div class="gdmbx-th"><label for="wpinv_state"><?php _e( 'State', 'invoicing' );?></label></div> |
|
104 | + <div class="gdmbx-th"><label for="wpinv_state"><?php _e('State', 'invoicing'); ?></label></div> |
|
105 | 105 | <div class="gdmbx-td"> |
106 | 106 | <?php |
107 | - $states = wpinv_get_country_states( $invoice->country ); |
|
108 | - if( !empty( $states ) ) { |
|
109 | - echo wpinv_html_select( array( |
|
110 | - 'options' => array_merge( array( '' => __( 'Choose a state', 'invoicing' ) ), $states ), |
|
107 | + $states = wpinv_get_country_states($invoice->country); |
|
108 | + if (!empty($states)) { |
|
109 | + echo wpinv_html_select(array( |
|
110 | + 'options' => array_merge(array('' => __('Choose a state', 'invoicing')), $states), |
|
111 | 111 | 'name' => 'wpinv_state', |
112 | 112 | 'id' => 'wpinv_state', |
113 | 113 | 'selected' => $invoice->state, |
114 | 114 | 'show_option_all' => false, |
115 | 115 | 'show_option_none' => false, |
116 | 116 | 'class' => 'gdmbx2-text-large', |
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 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Personal data exporters. |
4 | 4 | */ |
5 | 5 | |
6 | -defined( 'ABSPATH' ) || exit; |
|
6 | +defined('ABSPATH') || exit; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * WPInv_Privacy_Exporters Class. |
@@ -17,37 +17,37 @@ discard block |
||
17 | 17 | * @param int $page Page. |
18 | 18 | * @return array An array of invoice data in name value pairs |
19 | 19 | */ |
20 | - public static function customer_invoice_data_exporter( $email_address, $page ) { |
|
20 | + public static function customer_invoice_data_exporter($email_address, $page) { |
|
21 | 21 | $done = false; |
22 | - $page = (int) $page; |
|
22 | + $page = (int)$page; |
|
23 | 23 | $data_to_export = array(); |
24 | 24 | |
25 | - $user = get_user_by( 'email', $email_address ); |
|
26 | - if ( ! $user instanceof WP_User ) { |
|
25 | + $user = get_user_by('email', $email_address); |
|
26 | + if (!$user instanceof WP_User) { |
|
27 | 27 | return array( |
28 | 28 | 'data' => $data_to_export, |
29 | 29 | 'done' => true, |
30 | 30 | ); |
31 | 31 | } |
32 | 32 | |
33 | - $args = array( |
|
33 | + $args = array( |
|
34 | 34 | 'limit' => 30, |
35 | 35 | 'page' => $page, |
36 | 36 | 'user' => $user->ID, |
37 | 37 | ); |
38 | 38 | |
39 | - $invoices = wpinv_get_invoices( $args ); |
|
39 | + $invoices = wpinv_get_invoices($args); |
|
40 | 40 | |
41 | - if ( 0 < count( $invoices ) ) { |
|
42 | - foreach ( $invoices as $invoice ) { |
|
41 | + if (0 < count($invoices)) { |
|
42 | + foreach ($invoices as $invoice) { |
|
43 | 43 | $data_to_export[] = array( |
44 | 44 | 'group_id' => 'customer_invoices', |
45 | - 'group_label' => __( 'Invoicing Data', 'invoicing' ), |
|
45 | + 'group_label' => __('Invoicing Data', 'invoicing'), |
|
46 | 46 | 'item_id' => "wpinv-{$invoice->ID}", |
47 | - 'data' => self::get_customer_invoice_data( $invoice ), |
|
47 | + 'data' => self::get_customer_invoice_data($invoice), |
|
48 | 48 | ); |
49 | 49 | } |
50 | - $done = 30 > count( $invoices ); |
|
50 | + $done = 30 > count($invoices); |
|
51 | 51 | } else { |
52 | 52 | $done = true; |
53 | 53 | } |
@@ -65,59 +65,59 @@ discard block |
||
65 | 65 | * @param WPInv_Invoice $invoice invoice object. |
66 | 66 | * @return array |
67 | 67 | */ |
68 | - public static function get_customer_invoice_data( $invoice ) { |
|
68 | + public static function get_customer_invoice_data($invoice) { |
|
69 | 69 | $personal_data = array(); |
70 | 70 | |
71 | 71 | $props_to_export = array( |
72 | - 'number' => __( 'Invoice Number', 'invoicing' ), |
|
73 | - 'created_date' => __( 'Invoice Date', 'invoicing' ), |
|
74 | - 'status' => __( 'Invoice Status', 'invoicing' ), |
|
75 | - 'total' => __( 'Invoice Total', 'invoicing' ), |
|
76 | - 'items' => __( 'Invoice Items', 'invoicing' ), |
|
77 | - 'first_name' => __( 'First Name', 'invoicing' ), |
|
78 | - 'last_name' => __( 'Last Name', 'invoicing' ), |
|
79 | - 'email' => __( 'Email Address', 'invoicing' ), |
|
80 | - '_wpinv_company' => __( 'Company', 'invoicing' ), |
|
81 | - 'phone' => __( 'Phone Number', 'invoicing' ), |
|
82 | - 'address' => __( 'Address', 'invoicing' ), |
|
83 | - '_wpinv_city' => __( 'City', 'invoicing' ), |
|
84 | - '_wpinv_country' => __( 'Country', 'invoicing' ), |
|
85 | - '_wpinv_state' => __( 'State', 'invoicing' ), |
|
86 | - '_wpinv_zip' => __( 'Zip Code', 'invoicing' ), |
|
72 | + 'number' => __('Invoice Number', 'invoicing'), |
|
73 | + 'created_date' => __('Invoice Date', 'invoicing'), |
|
74 | + 'status' => __('Invoice Status', 'invoicing'), |
|
75 | + 'total' => __('Invoice Total', 'invoicing'), |
|
76 | + 'items' => __('Invoice Items', 'invoicing'), |
|
77 | + 'first_name' => __('First Name', 'invoicing'), |
|
78 | + 'last_name' => __('Last Name', 'invoicing'), |
|
79 | + 'email' => __('Email Address', 'invoicing'), |
|
80 | + '_wpinv_company' => __('Company', 'invoicing'), |
|
81 | + 'phone' => __('Phone Number', 'invoicing'), |
|
82 | + 'address' => __('Address', 'invoicing'), |
|
83 | + '_wpinv_city' => __('City', 'invoicing'), |
|
84 | + '_wpinv_country' => __('Country', 'invoicing'), |
|
85 | + '_wpinv_state' => __('State', 'invoicing'), |
|
86 | + '_wpinv_zip' => __('Zip Code', 'invoicing'), |
|
87 | 87 | ); |
88 | 88 | |
89 | - $subscription = wpinv_get_subscription( $invoice ); |
|
89 | + $subscription = wpinv_get_subscription($invoice); |
|
90 | 90 | $period = $initial_amt = $bill_times = $billed = $renewal_date = ''; |
91 | 91 | |
92 | - if ( $invoice->is_recurring() && !empty( $subscription ) ) { |
|
93 | - $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $subscription->period,$subscription->frequency ); |
|
94 | - $period = wpinv_price( wpinv_format_amount( $subscription->recurring_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) ) . ' / ' . $frequency; |
|
95 | - $initial_amt = wpinv_price( wpinv_format_amount( $subscription->initial_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) ); |
|
96 | - $bill_times = $subscription->get_times_billed() . ' / ' . ( ( $subscription->bill_times == 0 ) ? 'Until Cancelled' : $subscription->bill_times ); |
|
97 | - $renewal_date = ! empty( $subscription->expiration ) ? date_i18n( get_option( 'date_format' ), strtotime( $subscription->expiration ) ) : __( 'N/A', 'invoicing' ); |
|
98 | - |
|
99 | - $props_to_export['period'] = __( 'Billing Cycle', 'invoicing' ); |
|
100 | - $props_to_export['initial_amount'] = __( 'Initial Amount', 'invoicing' ); |
|
101 | - $props_to_export['bill_times'] = __( 'Times Billed', 'invoicing' ); |
|
102 | - $props_to_export['renewal_date'] = __( 'Renewal Date', 'invoicing' ); |
|
92 | + if ($invoice->is_recurring() && !empty($subscription)) { |
|
93 | + $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency($subscription->period, $subscription->frequency); |
|
94 | + $period = wpinv_price(wpinv_format_amount($subscription->recurring_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id)) . ' / ' . $frequency; |
|
95 | + $initial_amt = wpinv_price(wpinv_format_amount($subscription->initial_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id)); |
|
96 | + $bill_times = $subscription->get_times_billed() . ' / ' . (($subscription->bill_times == 0) ? 'Until Cancelled' : $subscription->bill_times); |
|
97 | + $renewal_date = !empty($subscription->expiration) ? date_i18n(get_option('date_format'), strtotime($subscription->expiration)) : __('N/A', 'invoicing'); |
|
98 | + |
|
99 | + $props_to_export['period'] = __('Billing Cycle', 'invoicing'); |
|
100 | + $props_to_export['initial_amount'] = __('Initial Amount', 'invoicing'); |
|
101 | + $props_to_export['bill_times'] = __('Times Billed', 'invoicing'); |
|
102 | + $props_to_export['renewal_date'] = __('Renewal Date', 'invoicing'); |
|
103 | 103 | } |
104 | 104 | |
105 | - $props_to_export['ip'] = __( 'IP Address', 'invoicing' ); |
|
106 | - $props_to_export['view_url'] = __( 'Invoice Link', 'invoicing' ); |
|
105 | + $props_to_export['ip'] = __('IP Address', 'invoicing'); |
|
106 | + $props_to_export['view_url'] = __('Invoice Link', 'invoicing'); |
|
107 | 107 | |
108 | - $props_to_export = apply_filters( 'wpinv_privacy_export_invoice_personal_data_props', $props_to_export, $invoice, $subscription); |
|
108 | + $props_to_export = apply_filters('wpinv_privacy_export_invoice_personal_data_props', $props_to_export, $invoice, $subscription); |
|
109 | 109 | |
110 | - foreach ( $props_to_export as $prop => $name ) { |
|
110 | + foreach ($props_to_export as $prop => $name) { |
|
111 | 111 | $value = ''; |
112 | 112 | |
113 | - switch ( $prop ) { |
|
113 | + switch ($prop) { |
|
114 | 114 | case 'items': |
115 | 115 | $item_names = array(); |
116 | - foreach ( $invoice->get_cart_details() as $key => $cart_item ) { |
|
117 | - $item_quantity = $cart_item['quantity'] > 0 ? absint( $cart_item['quantity'] ) : 1; |
|
116 | + foreach ($invoice->get_cart_details() as $key => $cart_item) { |
|
117 | + $item_quantity = $cart_item['quantity'] > 0 ? absint($cart_item['quantity']) : 1; |
|
118 | 118 | $item_names[] = $cart_item['name'] . ' x ' . $item_quantity; |
119 | 119 | } |
120 | - $value = implode( ', ', $item_names ); |
|
120 | + $value = implode(', ', $item_names); |
|
121 | 121 | break; |
122 | 122 | case 'status': |
123 | 123 | $value = $invoice->get_status(true); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $value = $renewal_date; |
139 | 139 | break; |
140 | 140 | default: |
141 | - if ( is_callable( array( $invoice, 'get_' . $prop ) ) ) { |
|
141 | + if (is_callable(array($invoice, 'get_' . $prop))) { |
|
142 | 142 | $value = $invoice->{"get_$prop"}(); |
143 | 143 | } else { |
144 | 144 | $value = $invoice->get_meta($prop); |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | break; |
147 | 147 | } |
148 | 148 | |
149 | - $value = apply_filters( 'wpi_privacy_export_invoice_personal_data_prop', $value, $prop, $invoice ); |
|
149 | + $value = apply_filters('wpi_privacy_export_invoice_personal_data_prop', $value, $prop, $invoice); |
|
150 | 150 | |
151 | - if ( $value ) { |
|
151 | + if ($value) { |
|
152 | 152 | $personal_data[] = array( |
153 | 153 | 'name' => $name, |
154 | 154 | 'value' => $value, |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | } |
159 | 159 | |
160 | - $personal_data = apply_filters( 'wpinv_privacy_export_invoice_personal_data', $personal_data, $invoice ); |
|
160 | + $personal_data = apply_filters('wpinv_privacy_export_invoice_personal_data', $personal_data, $invoice); |
|
161 | 161 | |
162 | 162 | return $personal_data; |
163 | 163 |
@@ -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(); |
@@ -31,31 +31,31 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | public function define_constants() { |
34 | - define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) ); |
|
35 | - define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) ); |
|
34 | + define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE)); |
|
35 | + define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE)); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | private function actions() { |
39 | 39 | /* Internationalize the text strings used. */ |
40 | - add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) ); |
|
40 | + add_action('plugins_loaded', array(&$this, 'plugins_loaded')); |
|
41 | 41 | |
42 | 42 | /* Perform actions on admin initialization. */ |
43 | - add_action( 'admin_init', array( &$this, 'admin_init') ); |
|
44 | - add_action( 'init', array( &$this, 'init' ), 3 ); |
|
45 | - add_action( 'init', array( 'WPInv_Shortcodes', 'init' ) ); |
|
46 | - add_action( 'init', array( &$this, 'wpinv_actions' ) ); |
|
43 | + add_action('admin_init', array(&$this, 'admin_init')); |
|
44 | + add_action('init', array(&$this, 'init'), 3); |
|
45 | + add_action('init', array('WPInv_Shortcodes', 'init')); |
|
46 | + add_action('init', array(&$this, 'wpinv_actions')); |
|
47 | 47 | |
48 | - if ( class_exists( 'BuddyPress' ) ) { |
|
49 | - add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) ); |
|
48 | + if (class_exists('BuddyPress')) { |
|
49 | + add_action('bp_include', array(&$this, 'bp_invoicing_init')); |
|
50 | 50 | } |
51 | 51 | |
52 | - add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) ); |
|
52 | + add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts')); |
|
53 | 53 | |
54 | - if ( is_admin() ) { |
|
55 | - add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) ); |
|
56 | - add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) ); |
|
54 | + if (is_admin()) { |
|
55 | + add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts')); |
|
56 | + add_action('admin_body_class', array(&$this, 'admin_body_class')); |
|
57 | 57 | } else { |
58 | - add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) ); |
|
58 | + add_filter('pre_get_posts', array(&$this, 'pre_get_posts')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference. |
67 | 67 | */ |
68 | - do_action_ref_array( 'wpinv_actions', array( &$this ) ); |
|
68 | + do_action_ref_array('wpinv_actions', array(&$this)); |
|
69 | 69 | |
70 | - add_action( 'admin_init', array( &$this, 'activation_redirect') ); |
|
70 | + add_action('admin_init', array(&$this, 'activation_redirect')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | public function plugins_loaded() { |
74 | 74 | /* Internationalize the text strings used. */ |
75 | 75 | $this->load_textdomain(); |
76 | 76 | |
77 | - do_action( 'wpinv_loaded' ); |
|
77 | + do_action('wpinv_loaded'); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -82,211 +82,211 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @since 1.0 |
84 | 84 | */ |
85 | - public function load_textdomain( $locale = NULL ) { |
|
86 | - if ( empty( $locale ) ) { |
|
87 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
85 | + public function load_textdomain($locale = NULL) { |
|
86 | + if (empty($locale)) { |
|
87 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
88 | 88 | } |
89 | 89 | |
90 | - $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' ); |
|
90 | + $locale = apply_filters('plugin_locale', $locale, 'invoicing'); |
|
91 | 91 | |
92 | - unload_textdomain( 'invoicing' ); |
|
93 | - load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' ); |
|
94 | - load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' ); |
|
92 | + unload_textdomain('invoicing'); |
|
93 | + load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo'); |
|
94 | + load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages'); |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Define language constants. |
98 | 98 | */ |
99 | - require_once( WPINV_PLUGIN_DIR . 'language.php' ); |
|
99 | + require_once(WPINV_PLUGIN_DIR . 'language.php'); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | public function includes() { |
103 | 103 | global $wpinv_options; |
104 | 104 | |
105 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' ); |
|
105 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php'); |
|
106 | 106 | $wpinv_options = wpinv_get_settings(); |
107 | 107 | |
108 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' ); |
|
109 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' ); |
|
110 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' ); |
|
111 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' ); |
|
112 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' ); |
|
113 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' ); |
|
114 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' ); |
|
115 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' ); |
|
116 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' ); |
|
117 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' ); |
|
118 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' ); |
|
119 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' ); |
|
120 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' ); |
|
121 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' ); |
|
122 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' ); |
|
123 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' ); |
|
124 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' ); |
|
125 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session.php' ); |
|
126 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' ); |
|
127 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' ); |
|
128 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' ); |
|
129 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-shortcodes.php' ); |
|
130 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' ); |
|
131 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' ); |
|
132 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
|
133 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' ); |
|
134 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php' ); |
|
135 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' ); |
|
136 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php' ); |
|
137 | - require_once( WPINV_PLUGIN_DIR . 'includes/abstract-wpinv-privacy.php' ); |
|
138 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' ); |
|
139 | - if ( !class_exists( 'WPInv_EUVat' ) ) { |
|
140 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' ); |
|
108 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php'); |
|
109 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php'); |
|
110 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php'); |
|
111 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php'); |
|
112 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php'); |
|
113 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php'); |
|
114 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php'); |
|
115 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php'); |
|
116 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php'); |
|
117 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php'); |
|
118 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php'); |
|
119 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php'); |
|
120 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php'); |
|
121 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php'); |
|
122 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php'); |
|
123 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php'); |
|
124 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php'); |
|
125 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session.php'); |
|
126 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php'); |
|
127 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php'); |
|
128 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php'); |
|
129 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-shortcodes.php'); |
|
130 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php'); |
|
131 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php'); |
|
132 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php'); |
|
133 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php'); |
|
134 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php'); |
|
135 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php'); |
|
136 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php'); |
|
137 | + require_once(WPINV_PLUGIN_DIR . 'includes/abstract-wpinv-privacy.php'); |
|
138 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php'); |
|
139 | + if (!class_exists('WPInv_EUVat')) { |
|
140 | + require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php'); |
|
141 | 141 | } |
142 | 142 | |
143 | - $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
144 | - if ( !empty( $gateways ) ) { |
|
145 | - foreach ( $gateways as $gateway ) { |
|
146 | - if ( $gateway == 'manual' ) { |
|
143 | + $gateways = array_keys(wpinv_get_enabled_payment_gateways()); |
|
144 | + if (!empty($gateways)) { |
|
145 | + foreach ($gateways as $gateway) { |
|
146 | + if ($gateway == 'manual') { |
|
147 | 147 | continue; |
148 | 148 | } |
149 | 149 | |
150 | 150 | $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php'; |
151 | 151 | |
152 | - if ( file_exists( $gateway_file ) ) { |
|
153 | - require_once( $gateway_file ); |
|
152 | + if (file_exists($gateway_file)) { |
|
153 | + require_once($gateway_file); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | } |
157 | - require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' ); |
|
157 | + require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php'); |
|
158 | 158 | |
159 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
160 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' ); |
|
161 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' ); |
|
162 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' ); |
|
159 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
160 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php'); |
|
161 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php'); |
|
162 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php'); |
|
163 | 163 | //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' ); |
164 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' ); |
|
165 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' ); |
|
166 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' ); |
|
167 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' ); |
|
168 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' ); |
|
164 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php'); |
|
165 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php'); |
|
166 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php'); |
|
167 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php'); |
|
168 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php'); |
|
169 | 169 | //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
170 | 170 | } |
171 | 171 | |
172 | 172 | // include css inliner |
173 | - if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) { |
|
174 | - include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' ); |
|
173 | + if (!class_exists('Emogrifier') && class_exists('DOMDocument')) { |
|
174 | + include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php'); |
|
175 | 175 | } |
176 | 176 | |
177 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' ); |
|
177 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | public function init() { |
181 | 181 | } |
182 | 182 | |
183 | 183 | public function admin_init() { |
184 | - if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) { |
|
184 | + if (!(defined('DOING_AJAX') && DOING_AJAX)) { |
|
185 | 185 | } |
186 | 186 | |
187 | - add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) ); |
|
187 | + add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php')); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | public function activation_redirect() { |
191 | 191 | // Bail if no activation redirect |
192 | - if ( !get_transient( '_wpinv_activation_redirect' ) ) { |
|
192 | + if (!get_transient('_wpinv_activation_redirect')) { |
|
193 | 193 | return; |
194 | 194 | } |
195 | 195 | |
196 | 196 | // Delete the redirect transient |
197 | - delete_transient( '_wpinv_activation_redirect' ); |
|
197 | + delete_transient('_wpinv_activation_redirect'); |
|
198 | 198 | |
199 | 199 | // Bail if activating from network, or bulk |
200 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
200 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
201 | 201 | return; |
202 | 202 | } |
203 | 203 | |
204 | - wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) ); |
|
204 | + wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general')); |
|
205 | 205 | exit; |
206 | 206 | } |
207 | 207 | |
208 | 208 | public function enqueue_scripts() { |
209 | - $suffix = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
209 | + $suffix = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
210 | 210 | |
211 | - wp_deregister_style( 'font-awesome' ); |
|
212 | - wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0' ); |
|
213 | - wp_enqueue_style( 'font-awesome' ); |
|
211 | + wp_deregister_style('font-awesome'); |
|
212 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0'); |
|
213 | + wp_enqueue_style('font-awesome'); |
|
214 | 214 | |
215 | - wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION ); |
|
216 | - wp_enqueue_style( 'wpinv_front_style' ); |
|
215 | + wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION); |
|
216 | + wp_enqueue_style('wpinv_front_style'); |
|
217 | 217 | |
218 | 218 | // Register scripts |
219 | - wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
220 | - wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front' . $suffix . '.js', array( 'jquery', 'wpinv-vat-script' ), WPINV_VERSION ); |
|
219 | + wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true); |
|
220 | + wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front' . $suffix . '.js', array('jquery', 'wpinv-vat-script'), WPINV_VERSION); |
|
221 | 221 | |
222 | 222 | $localize = array(); |
223 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
224 | - $localize['nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
223 | + $localize['ajax_url'] = admin_url('admin-ajax.php'); |
|
224 | + $localize['nonce'] = wp_create_nonce('wpinv-nonce'); |
|
225 | 225 | $localize['currency_symbol'] = wpinv_currency_symbol(); |
226 | 226 | $localize['currency_pos'] = wpinv_currency_position(); |
227 | 227 | $localize['thousand_sep'] = wpinv_thousands_separator(); |
228 | 228 | $localize['decimal_sep'] = wpinv_decimal_separator(); |
229 | 229 | $localize['decimals'] = wpinv_decimals(); |
230 | - $localize['txtComplete'] = __( 'Complete', 'invoicing' ); |
|
230 | + $localize['txtComplete'] = __('Complete', 'invoicing'); |
|
231 | 231 | |
232 | - $localize = apply_filters( 'wpinv_front_js_localize', $localize ); |
|
232 | + $localize = apply_filters('wpinv_front_js_localize', $localize); |
|
233 | 233 | |
234 | - wp_enqueue_script( 'jquery-blockui' ); |
|
234 | + wp_enqueue_script('jquery-blockui'); |
|
235 | 235 | $autofill_api = wpinv_get_option('address_autofill_api'); |
236 | 236 | $autofill_active = wpinv_get_option('address_autofill_active'); |
237 | - if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) { |
|
238 | - if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) { |
|
239 | - wp_dequeue_script( 'google-maps-api' ); |
|
237 | + if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) { |
|
238 | + if (wp_script_is('google-maps-api', 'enqueued')) { |
|
239 | + wp_dequeue_script('google-maps-api'); |
|
240 | 240 | } |
241 | - wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false ); |
|
242 | - wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true ); |
|
241 | + wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false); |
|
242 | + wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true); |
|
243 | 243 | } |
244 | - wp_enqueue_script( 'wpinv-front-script' ); |
|
245 | - wp_localize_script( 'wpinv-front-script', 'WPInv', $localize ); |
|
244 | + wp_enqueue_script('wpinv-front-script'); |
|
245 | + wp_localize_script('wpinv-front-script', 'WPInv', $localize); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | public function admin_enqueue_scripts() { |
249 | 249 | global $post, $pagenow; |
250 | 250 | |
251 | 251 | $post_type = wpinv_admin_post_type(); |
252 | - $suffix = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
253 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : ''; |
|
252 | + $suffix = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
253 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : ''; |
|
254 | 254 | |
255 | - wp_deregister_style( 'font-awesome' ); |
|
256 | - wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0' ); |
|
257 | - wp_enqueue_style( 'font-awesome' ); |
|
255 | + wp_deregister_style('font-awesome'); |
|
256 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0'); |
|
257 | + wp_enqueue_style('font-awesome'); |
|
258 | 258 | |
259 | 259 | $jquery_ui_css = false; |
260 | - if ( ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount' ) && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) { |
|
260 | + if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) { |
|
261 | 261 | $jquery_ui_css = true; |
262 | - } else if ( $page == 'wpinv-settings' || $page == 'wpinv-reports' ) { |
|
262 | + } else if ($page == 'wpinv-settings' || $page == 'wpinv-reports') { |
|
263 | 263 | $jquery_ui_css = true; |
264 | 264 | } |
265 | - if ( $jquery_ui_css ) { |
|
266 | - wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' ); |
|
267 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
265 | + if ($jquery_ui_css) { |
|
266 | + wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16'); |
|
267 | + wp_enqueue_style('jquery-ui-css'); |
|
268 | 268 | } |
269 | 269 | |
270 | - wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION ); |
|
271 | - wp_enqueue_style( 'wpinv_meta_box_style' ); |
|
270 | + wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION); |
|
271 | + wp_enqueue_style('wpinv_meta_box_style'); |
|
272 | 272 | |
273 | - wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION ); |
|
274 | - wp_enqueue_style( 'wpinv_admin_style' ); |
|
273 | + wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION); |
|
274 | + wp_enqueue_style('wpinv_admin_style'); |
|
275 | 275 | |
276 | - $enqueue = ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ); |
|
277 | - if ( $page == 'wpinv-subscriptions' ) { |
|
278 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
276 | + $enqueue = ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php')); |
|
277 | + if ($page == 'wpinv-subscriptions') { |
|
278 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
279 | 279 | } |
280 | - $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ); |
|
280 | + $enqueue_datepicker = apply_filters('wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue); |
|
281 | 281 | |
282 | - if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) { |
|
283 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
282 | + if ($enqueue_datepicker = apply_filters('wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue)) { |
|
283 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
284 | 284 | } |
285 | 285 | |
286 | - wp_enqueue_style( 'wp-color-picker' ); |
|
287 | - wp_enqueue_script( 'wp-color-picker' ); |
|
286 | + wp_enqueue_style('wp-color-picker'); |
|
287 | + wp_enqueue_script('wp-color-picker'); |
|
288 | 288 | |
289 | - wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
289 | + wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true); |
|
290 | 290 | |
291 | 291 | if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) { |
292 | 292 | $autofill_api = wpinv_get_option('address_autofill_api'); |
@@ -297,17 +297,17 @@ discard block |
||
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | - wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ), WPINV_VERSION ); |
|
301 | - wp_enqueue_script( 'wpinv-admin-script' ); |
|
300 | + wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), WPINV_VERSION); |
|
301 | + wp_enqueue_script('wpinv-admin-script'); |
|
302 | 302 | |
303 | 303 | $localize = array(); |
304 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
305 | - $localize['post_ID'] = isset( $post->ID ) ? $post->ID : ''; |
|
306 | - $localize['wpinv_nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
307 | - $localize['add_invoice_note_nonce'] = wp_create_nonce( 'add-invoice-note' ); |
|
308 | - $localize['delete_invoice_note_nonce'] = wp_create_nonce( 'delete-invoice-note' ); |
|
309 | - $localize['invoice_item_nonce'] = wp_create_nonce( 'invoice-item' ); |
|
310 | - $localize['billing_details_nonce'] = wp_create_nonce( 'get-billing-details' ); |
|
304 | + $localize['ajax_url'] = admin_url('admin-ajax.php'); |
|
305 | + $localize['post_ID'] = isset($post->ID) ? $post->ID : ''; |
|
306 | + $localize['wpinv_nonce'] = wp_create_nonce('wpinv-nonce'); |
|
307 | + $localize['add_invoice_note_nonce'] = wp_create_nonce('add-invoice-note'); |
|
308 | + $localize['delete_invoice_note_nonce'] = wp_create_nonce('delete-invoice-note'); |
|
309 | + $localize['invoice_item_nonce'] = wp_create_nonce('invoice-item'); |
|
310 | + $localize['billing_details_nonce'] = wp_create_nonce('get-billing-details'); |
|
311 | 311 | $localize['tax'] = wpinv_tax_amount(); |
312 | 312 | $localize['discount'] = wpinv_discount_amount(); |
313 | 313 | $localize['currency_symbol'] = wpinv_currency_symbol(); |
@@ -315,69 +315,69 @@ discard block |
||
315 | 315 | $localize['thousand_sep'] = wpinv_thousands_separator(); |
316 | 316 | $localize['decimal_sep'] = wpinv_decimal_separator(); |
317 | 317 | $localize['decimals'] = wpinv_decimals(); |
318 | - $localize['save_invoice'] = __( 'Save Invoice', 'invoicing' ); |
|
319 | - $localize['status_publish'] = wpinv_status_nicename( 'publish' ); |
|
320 | - $localize['status_pending'] = wpinv_status_nicename( 'wpi-pending' ); |
|
321 | - $localize['delete_tax_rate'] = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ); |
|
322 | - $localize['OneItemMin'] = __( 'Invoice must contain at least one item', 'invoicing' ); |
|
323 | - $localize['DeleteInvoiceItem'] = __( 'Are you sure you wish to delete this item?', 'invoicing' ); |
|
324 | - $localize['FillBillingDetails'] = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ); |
|
325 | - $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' ); |
|
326 | - $localize['AreYouSure'] = __( 'Are you sure?', 'invoicing' ); |
|
327 | - $localize['emptyInvoice'] = __( 'Add at least one item to save invoice!', 'invoicing' ); |
|
328 | - $localize['errDeleteItem'] = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ); |
|
329 | - $localize['delete_subscription'] = __( 'Are you sure you want to delete this subscription?', 'invoicing' ); |
|
330 | - $localize['action_edit'] = __( 'Edit', 'invoicing' ); |
|
331 | - $localize['action_cancel'] = __( 'Cancel', 'invoicing' ); |
|
318 | + $localize['save_invoice'] = __('Save Invoice', 'invoicing'); |
|
319 | + $localize['status_publish'] = wpinv_status_nicename('publish'); |
|
320 | + $localize['status_pending'] = wpinv_status_nicename('wpi-pending'); |
|
321 | + $localize['delete_tax_rate'] = __('Are you sure you wish to delete this tax rate?', 'invoicing'); |
|
322 | + $localize['OneItemMin'] = __('Invoice must contain at least one item', 'invoicing'); |
|
323 | + $localize['DeleteInvoiceItem'] = __('Are you sure you wish to delete this item?', 'invoicing'); |
|
324 | + $localize['FillBillingDetails'] = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'); |
|
325 | + $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'); |
|
326 | + $localize['AreYouSure'] = __('Are you sure?', 'invoicing'); |
|
327 | + $localize['emptyInvoice'] = __('Add at least one item to save invoice!', 'invoicing'); |
|
328 | + $localize['errDeleteItem'] = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'); |
|
329 | + $localize['delete_subscription'] = __('Are you sure you want to delete this subscription?', 'invoicing'); |
|
330 | + $localize['action_edit'] = __('Edit', 'invoicing'); |
|
331 | + $localize['action_cancel'] = __('Cancel', 'invoicing'); |
|
332 | 332 | |
333 | - $localize = apply_filters( 'wpinv_admin_js_localize', $localize ); |
|
333 | + $localize = apply_filters('wpinv_admin_js_localize', $localize); |
|
334 | 334 | |
335 | - wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize ); |
|
335 | + wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize); |
|
336 | 336 | |
337 | - if ( $page == 'wpinv-subscriptions' ) { |
|
338 | - wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions' . $suffix . '.js', array( 'wpinv-admin-script' ), WPINV_VERSION ); |
|
339 | - wp_enqueue_script( 'wpinv-sub-admin-script' ); |
|
337 | + if ($page == 'wpinv-subscriptions') { |
|
338 | + wp_register_script('wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions' . $suffix . '.js', array('wpinv-admin-script'), WPINV_VERSION); |
|
339 | + wp_enqueue_script('wpinv-sub-admin-script'); |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
343 | - public function admin_body_class( $classes ) { |
|
343 | + public function admin_body_class($classes) { |
|
344 | 344 | global $pagenow, $post, $current_screen; |
345 | 345 | |
346 | - if ( !empty( $current_screen->post_type ) && ( $current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_quote' ) ) { |
|
346 | + if (!empty($current_screen->post_type) && ($current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_quote')) { |
|
347 | 347 | $classes .= ' wpinv-cpt'; |
348 | 348 | } |
349 | 349 | |
350 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
350 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
351 | 351 | |
352 | - $add_class = $page && $pagenow == 'admin.php' && strpos( $page, 'wpinv-' ) === 0 ? true : false; |
|
353 | - if ( $add_class ) { |
|
354 | - $classes .= ' wpi-' . wpinv_sanitize_key( $page ); |
|
352 | + $add_class = $page && $pagenow == 'admin.php' && strpos($page, 'wpinv-') === 0 ? true : false; |
|
353 | + if ($add_class) { |
|
354 | + $classes .= ' wpi-' . wpinv_sanitize_key($page); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | $settings_class = array(); |
358 | - if ( $page == 'wpinv-settings' ) { |
|
359 | - if ( !empty( $_REQUEST['tab'] ) ) { |
|
360 | - $settings_class[] = sanitize_text_field( $_REQUEST['tab'] ); |
|
358 | + if ($page == 'wpinv-settings') { |
|
359 | + if (!empty($_REQUEST['tab'])) { |
|
360 | + $settings_class[] = sanitize_text_field($_REQUEST['tab']); |
|
361 | 361 | } |
362 | 362 | |
363 | - if ( !empty( $_REQUEST['section'] ) ) { |
|
364 | - $settings_class[] = sanitize_text_field( $_REQUEST['section'] ); |
|
363 | + if (!empty($_REQUEST['section'])) { |
|
364 | + $settings_class[] = sanitize_text_field($_REQUEST['section']); |
|
365 | 365 | } |
366 | 366 | |
367 | - $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main'; |
|
367 | + $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main'; |
|
368 | 368 | } |
369 | 369 | |
370 | - if ( !empty( $settings_class ) ) { |
|
371 | - $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) ); |
|
370 | + if (!empty($settings_class)) { |
|
371 | + $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-')); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | $post_type = wpinv_admin_post_type(); |
375 | 375 | |
376 | - if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) { |
|
376 | + if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) { |
|
377 | 377 | return $classes .= ' wpinv'; |
378 | 378 | } |
379 | 379 | |
380 | - if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) { |
|
380 | + if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) { |
|
381 | 381 | $classes .= ' wpi-editable-n'; |
382 | 382 | } |
383 | 383 | |
@@ -389,20 +389,20 @@ discard block |
||
389 | 389 | } |
390 | 390 | |
391 | 391 | public function wpinv_actions() { |
392 | - if ( isset( $_REQUEST['wpi_action'] ) ) { |
|
393 | - do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST ); |
|
392 | + if (isset($_REQUEST['wpi_action'])) { |
|
393 | + do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST); |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
397 | - public function pre_get_posts( $wp_query ) { |
|
398 | - 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() ) { |
|
399 | - $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() ); |
|
397 | + public function pre_get_posts($wp_query) { |
|
398 | + 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()) { |
|
399 | + $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses()); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | return $wp_query; |
403 | 403 | } |
404 | 404 | |
405 | 405 | public function bp_invoicing_init() { |
406 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
|
406 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php'); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | \ No newline at end of file |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Abstract privacy class. |
4 | 4 | */ |
5 | 5 | |
6 | -defined( 'ABSPATH' ) || exit; |
|
6 | +defined('ABSPATH') || exit; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Abstract class that is intended to be extended by |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param string $name Plugin identifier. |
40 | 40 | */ |
41 | - public function __construct( $name = '' ) { |
|
41 | + public function __construct($name = '') { |
|
42 | 42 | $this->name = $name; |
43 | 43 | $this->init(); |
44 | 44 | } |
@@ -47,22 +47,22 @@ discard block |
||
47 | 47 | * Hook in events. |
48 | 48 | */ |
49 | 49 | protected function init() { |
50 | - add_action( 'admin_init', array( $this, 'add_privacy_message' ) ); |
|
50 | + add_action('admin_init', array($this, 'add_privacy_message')); |
|
51 | 51 | // Register data exporters |
52 | - add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_exporters' ), 10 ); |
|
52 | + add_filter('wp_privacy_personal_data_exporters', array($this, 'register_exporters'), 10); |
|
53 | 53 | // Register data erasers |
54 | - add_filter( 'wp_privacy_personal_data_erasers', array( $this, 'register_erasers' ) ); |
|
54 | + add_filter('wp_privacy_personal_data_erasers', array($this, 'register_erasers')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Adds the privacy message on invoicing privacy page. |
59 | 59 | */ |
60 | 60 | public function add_privacy_message() { |
61 | - if ( function_exists( 'wp_add_privacy_policy_content' ) ) { |
|
61 | + if (function_exists('wp_add_privacy_policy_content')) { |
|
62 | 62 | $content = $this->get_privacy_message(); |
63 | 63 | |
64 | - if ( $content ) { |
|
65 | - wp_add_privacy_policy_content( $this->name, $this->get_privacy_message() ); |
|
64 | + if ($content) { |
|
65 | + wp_add_privacy_policy_content($this->name, $this->get_privacy_message()); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | * @param array $exporters List of exporter callbacks. |
84 | 84 | * @return array |
85 | 85 | */ |
86 | - public function register_exporters( $exporters = array() ) { |
|
87 | - foreach ( $this->exporters as $id => $exporter ) { |
|
88 | - $exporters[ $id ] = $exporter; |
|
86 | + public function register_exporters($exporters = array()) { |
|
87 | + foreach ($this->exporters as $id => $exporter) { |
|
88 | + $exporters[$id] = $exporter; |
|
89 | 89 | } |
90 | 90 | return $exporters; |
91 | 91 | } |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | * @param array $erasers List of eraser callbacks. |
97 | 97 | * @return array |
98 | 98 | */ |
99 | - public function register_erasers( $erasers = array() ) { |
|
100 | - foreach ( $this->erasers as $id => $eraser ) { |
|
101 | - $erasers[ $id ] = $eraser; |
|
99 | + public function register_erasers($erasers = array()) { |
|
100 | + foreach ($this->erasers as $id => $eraser) { |
|
101 | + $erasers[$id] = $eraser; |
|
102 | 102 | } |
103 | 103 | return $erasers; |
104 | 104 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function add_exporter( $id, $name, $callback ) { |
|
116 | - $this->exporters[ $id ] = array( |
|
115 | + public function add_exporter($id, $name, $callback) { |
|
116 | + $this->exporters[$id] = array( |
|
117 | 117 | 'exporter_friendly_name' => $name, |
118 | 118 | 'callback' => $callback, |
119 | 119 | ); |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @return array |
131 | 131 | */ |
132 | - public function add_eraser( $id, $name, $callback ) { |
|
133 | - $this->erasers[ $id ] = array( |
|
132 | + public function add_eraser($id, $name, $callback) { |
|
133 | + $this->erasers[$id] = array( |
|
134 | 134 | 'eraser_friendly_name' => $name, |
135 | 135 | 'callback' => $callback, |
136 | 136 | ); |
@@ -31,27 +31,27 @@ |
||
31 | 31 | public function get_privacy_message() { |
32 | 32 | |
33 | 33 | $content = '<h2>' . __( 'Invoices and checkout', 'invoicing' ) . '</h2>' . |
34 | - '<div contenteditable="false">' . |
|
35 | - '<p class="wp-policy-help">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' . |
|
36 | - '</div>' . |
|
37 | - '<p>' . __( 'We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing' ) . '</p>' . |
|
38 | - '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' . |
|
39 | - '<ul>' . |
|
40 | - '<li>' . __( '- Send you important account/order/service information.', 'invoicing' ) . '</li>' . |
|
41 | - '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' . |
|
42 | - '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' . |
|
43 | - '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
44 | - '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' . |
|
45 | - '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
46 | - '</ul>' . |
|
47 | - '<p>' . __( 'In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing' ) . '</p>' . |
|
48 | - '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' . |
|
49 | - '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' . |
|
50 | - '<div contenteditable="false">' . |
|
51 | - '<p class="wp-policy-help">' . __( 'In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing' ) . '</p>' . |
|
52 | - '</div>' . |
|
53 | - '<p>' . __( 'We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing' ) . '</p>' . |
|
54 | - '<p>' . __( 'Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing' ) . '</p>'; |
|
34 | + '<div contenteditable="false">' . |
|
35 | + '<p class="wp-policy-help">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' . |
|
36 | + '</div>' . |
|
37 | + '<p>' . __( 'We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing' ) . '</p>' . |
|
38 | + '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' . |
|
39 | + '<ul>' . |
|
40 | + '<li>' . __( '- Send you important account/order/service information.', 'invoicing' ) . '</li>' . |
|
41 | + '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' . |
|
42 | + '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' . |
|
43 | + '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
44 | + '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' . |
|
45 | + '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
46 | + '</ul>' . |
|
47 | + '<p>' . __( 'In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing' ) . '</p>' . |
|
48 | + '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' . |
|
49 | + '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' . |
|
50 | + '<div contenteditable="false">' . |
|
51 | + '<p class="wp-policy-help">' . __( 'In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing' ) . '</p>' . |
|
52 | + '</div>' . |
|
53 | + '<p>' . __( 'We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing' ) . '</p>' . |
|
54 | + '<p>' . __( 'Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing' ) . '</p>'; |
|
55 | 55 | |
56 | 56 | |
57 | 57 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Privacy/GDPR related functionality which ties into WordPress functionality. |
4 | 4 | */ |
5 | 5 | |
6 | -defined( 'ABSPATH' ) || exit; |
|
6 | +defined('ABSPATH') || exit; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * WPInv_Privacy Class. |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | * Init - hook into events. |
15 | 15 | */ |
16 | 16 | public function __construct() { |
17 | - parent::__construct( __( 'Invoicing', 'invoicing' ) ); |
|
17 | + parent::__construct(__('Invoicing', 'invoicing')); |
|
18 | 18 | |
19 | 19 | // Include supporting classes. |
20 | 20 | include_once 'class-wpinv-privacy-exporters.php'; |
21 | 21 | |
22 | 22 | // This hook registers Invoicing data exporters. |
23 | - $this->add_exporter( 'wpinv-customer-invoices', __( 'Customer Invoices', 'invoicing' ), array( 'WPInv_Privacy_Exporters', 'customer_invoice_data_exporter' ) ); |
|
23 | + $this->add_exporter('wpinv-customer-invoices', __('Customer Invoices', 'invoicing'), array('WPInv_Privacy_Exporters', 'customer_invoice_data_exporter')); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -30,28 +30,28 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function get_privacy_message() { |
32 | 32 | |
33 | - $content = '<h2>' . __( 'Invoices and checkout', 'invoicing' ) . '</h2>' . |
|
33 | + $content = '<h2>' . __('Invoices and checkout', 'invoicing') . '</h2>' . |
|
34 | 34 | '<div contenteditable="false">' . |
35 | - '<p class="wp-policy-help">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' . |
|
35 | + '<p class="wp-policy-help">' . __('Example privacy texts.', 'invoicing') . '</p>' . |
|
36 | 36 | '</div>' . |
37 | - '<p>' . __( 'We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing' ) . '</p>' . |
|
38 | - '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' . |
|
37 | + '<p>' . __('We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing') . '</p>' . |
|
38 | + '<p>' . __('Handling this data also allows us to:', 'invoicing') . '</p>' . |
|
39 | 39 | '<ul>' . |
40 | - '<li>' . __( '- Send you important account/order/service information.', 'invoicing' ) . '</li>' . |
|
41 | - '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' . |
|
42 | - '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' . |
|
43 | - '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
44 | - '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' . |
|
45 | - '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
40 | + '<li>' . __('- Send you important account/order/service information.', 'invoicing') . '</li>' . |
|
41 | + '<li>' . __('- Estimate taxes based on your location.', 'invoicing') . '</li>' . |
|
42 | + '<li>' . __('- Respond to your queries or complaints.', 'invoicing') . '</li>' . |
|
43 | + '<li>' . __('- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing') . '</li>' . |
|
44 | + '<li>' . __('- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing') . '</li>' . |
|
45 | + '<li>' . __('- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing') . '</li>' . |
|
46 | 46 | '</ul>' . |
47 | - '<p>' . __( 'In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing' ) . '</p>' . |
|
48 | - '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' . |
|
49 | - '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' . |
|
47 | + '<p>' . __('In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing') . '</p>' . |
|
48 | + '<h2>' . __('What we share with others', 'invoicing') . '</h2>' . |
|
49 | + '<p>' . __('We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing') . '</p>' . |
|
50 | 50 | '<div contenteditable="false">' . |
51 | - '<p class="wp-policy-help">' . __( 'In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing' ) . '</p>' . |
|
51 | + '<p class="wp-policy-help">' . __('In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing') . '</p>' . |
|
52 | 52 | '</div>' . |
53 | - '<p>' . __( 'We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing' ) . '</p>' . |
|
54 | - '<p>' . __( 'Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing' ) . '</p>'; |
|
53 | + '<p>' . __('We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing') . '</p>' . |
|
54 | + '<p>' . __('Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing') . '</p>'; |
|
55 | 55 | |
56 | 56 | |
57 | 57 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // '</p>' . |
63 | 63 | // '</div>'; |
64 | 64 | |
65 | - return apply_filters( 'wpinv_privacy_policy_content', $content ); |
|
65 | + return apply_filters('wpinv_privacy_policy_content', $content); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | } |