@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * GetPaid_Reports_Export Class. |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | public function display() { |
20 | 20 | |
21 | 21 | echo "<div class='row mt-4' style='max-width: 920px;' >"; |
22 | - foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) { |
|
23 | - $this->display_post_type_export( $post_type ); |
|
22 | + foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) { |
|
23 | + $this->display_post_type_export($post_type); |
|
24 | 24 | } |
25 | 25 | $this->display_subscription_export(); |
26 | 26 | echo '</div>'; |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | * Retrieves the download url. |
32 | 32 | * |
33 | 33 | */ |
34 | - public function get_download_url( $post_type ) { |
|
34 | + public function get_download_url($post_type) { |
|
35 | 35 | |
36 | 36 | return wp_nonce_url( |
37 | 37 | add_query_arg( |
38 | 38 | array( |
39 | 39 | 'getpaid-admin-action' => 'export_invoices', |
40 | - 'post_type' => urlencode( $post_type ), |
|
40 | + 'post_type' => urlencode($post_type), |
|
41 | 41 | ) |
42 | 42 | ), |
43 | 43 | 'getpaid-nonce', |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * Displays a single post type export card. |
51 | 51 | * |
52 | 52 | */ |
53 | - public function display_post_type_export( $post_type ) { |
|
53 | + public function display_post_type_export($post_type) { |
|
54 | 54 | |
55 | 55 | ?> |
56 | 56 | |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | <strong> |
62 | 62 | <?php |
63 | 63 | printf( |
64 | - esc_html__( 'Export %s', 'invoicing' ), |
|
65 | - esc_html( getpaid_get_post_type_label( $post_type ) ) |
|
64 | + esc_html__('Export %s', 'invoicing'), |
|
65 | + esc_html(getpaid_get_post_type_label($post_type)) |
|
66 | 66 | ); |
67 | 67 | ?> |
68 | 68 | </strong> |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | |
71 | 71 | <div class="card-body"> |
72 | 72 | |
73 | - <form method="post" action="<?php echo esc_url( $this->get_download_url( $post_type ) ); ?>"> |
|
73 | + <form method="post" action="<?php echo esc_url($this->get_download_url($post_type)); ?>"> |
|
74 | 74 | |
75 | 75 | <?php |
76 | - $this->generate_from_date( $post_type ); |
|
77 | - $this->generate_to_date( $post_type ); |
|
78 | - $this->generate_post_status_select( $post_type ); |
|
79 | - $this->generate_file_type_select( $post_type ); |
|
80 | - submit_button( __( 'Download', 'invoicing' ) ); |
|
76 | + $this->generate_from_date($post_type); |
|
77 | + $this->generate_to_date($post_type); |
|
78 | + $this->generate_post_status_select($post_type); |
|
79 | + $this->generate_file_type_select($post_type); |
|
80 | + submit_button(__('Download', 'invoicing')); |
|
81 | 81 | ?> |
82 | 82 | |
83 | 83 | </form> |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | * Generates the from date input field. |
96 | 96 | * |
97 | 97 | */ |
98 | - public function generate_from_date( $post_type ) { |
|
98 | + public function generate_from_date($post_type) { |
|
99 | 99 | |
100 | 100 | aui()->input( |
101 | 101 | array( |
102 | 102 | 'type' => 'datepicker', |
103 | - 'id' => esc_attr( "$post_type-from_date" ), |
|
103 | + 'id' => esc_attr("$post_type-from_date"), |
|
104 | 104 | 'name' => 'from_date', |
105 | - 'label' => __( 'From Date', 'invoicing' ), |
|
105 | + 'label' => __('From Date', 'invoicing'), |
|
106 | 106 | 'label_type' => 'vertical', |
107 | 107 | 'placeholder' => 'YYYY-MM-DD', |
108 | 108 | 'extra_attributes' => array( |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | * Generates the to date input field. |
120 | 120 | * |
121 | 121 | */ |
122 | - public function generate_to_date( $post_type ) { |
|
122 | + public function generate_to_date($post_type) { |
|
123 | 123 | |
124 | 124 | aui()->input( |
125 | 125 | array( |
126 | 126 | 'type' => 'datepicker', |
127 | - 'id' => esc_attr( "$post_type-to_date" ), |
|
127 | + 'id' => esc_attr("$post_type-to_date"), |
|
128 | 128 | 'name' => 'to_date', |
129 | - 'label' => __( 'To Date', 'invoicing' ), |
|
129 | + 'label' => __('To Date', 'invoicing'), |
|
130 | 130 | 'label_type' => 'vertical', |
131 | 131 | 'placeholder' => 'YYYY-MM-DD', |
132 | 132 | 'extra_attributes' => array( |
@@ -142,20 +142,20 @@ discard block |
||
142 | 142 | * Generates the to post status select field. |
143 | 143 | * |
144 | 144 | */ |
145 | - public function generate_post_status_select( $post_type ) { |
|
145 | + public function generate_post_status_select($post_type) { |
|
146 | 146 | |
147 | - if ( 'subscriptions' === $post_type ) { |
|
147 | + if ('subscriptions' === $post_type) { |
|
148 | 148 | $options = getpaid_get_subscription_statuses(); |
149 | 149 | } else { |
150 | - $options = wpinv_get_invoice_statuses( true, false, $post_type ); |
|
150 | + $options = wpinv_get_invoice_statuses(true, false, $post_type); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | aui()->select( |
154 | 154 | array( |
155 | 155 | 'name' => 'status', |
156 | - 'id' => esc_attr( "$post_type-status" ), |
|
157 | - 'placeholder' => __( 'All Statuses', 'invoicing' ), |
|
158 | - 'label' => __( 'Status', 'invoicing' ), |
|
156 | + 'id' => esc_attr("$post_type-status"), |
|
157 | + 'placeholder' => __('All Statuses', 'invoicing'), |
|
158 | + 'label' => __('Status', 'invoicing'), |
|
159 | 159 | 'label_type' => 'vertical', |
160 | 160 | 'label_class' => 'd-block', |
161 | 161 | 'options' => $options, |
@@ -169,21 +169,21 @@ discard block |
||
169 | 169 | * Generates the to file type select field. |
170 | 170 | * |
171 | 171 | */ |
172 | - public function generate_file_type_select( $post_type ) { |
|
172 | + public function generate_file_type_select($post_type) { |
|
173 | 173 | |
174 | 174 | aui()->select( |
175 | 175 | array( |
176 | 176 | 'name' => 'file_type', |
177 | - 'id' => esc_attr( "$post_type-file_type" ), |
|
178 | - 'placeholder' => __( 'Select File Type', 'invoicing' ), |
|
179 | - 'label' => __( 'Export File', 'invoicing' ), |
|
177 | + 'id' => esc_attr("$post_type-file_type"), |
|
178 | + 'placeholder' => __('Select File Type', 'invoicing'), |
|
179 | + 'label' => __('Export File', 'invoicing'), |
|
180 | 180 | 'label_type' => 'vertical', |
181 | 181 | 'label_class' => 'd-block', |
182 | 182 | 'value' => 'csv', |
183 | 183 | 'options' => array( |
184 | - 'csv' => __( 'CSV', 'invoicing' ), |
|
185 | - 'xml' => __( 'XML', 'invoicing' ), |
|
186 | - 'json' => __( 'JSON', 'invoicing' ), |
|
184 | + 'csv' => __('CSV', 'invoicing'), |
|
185 | + 'xml' => __('XML', 'invoicing'), |
|
186 | + 'json' => __('JSON', 'invoicing'), |
|
187 | 187 | ), |
188 | 188 | ), |
189 | 189 | true |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * Displays a field's markup. |
196 | 196 | * |
197 | 197 | */ |
198 | - public function display_markup( $markup ) { |
|
198 | + public function display_markup($markup) { |
|
199 | 199 | |
200 | 200 | echo wp_kses( |
201 | 201 | str_replace( |
@@ -224,20 +224,20 @@ discard block |
||
224 | 224 | |
225 | 225 | <div class="card-header"> |
226 | 226 | <strong> |
227 | - <?php esc_html_e( 'Export Subscriptions', 'invoicing' ); ?> |
|
227 | + <?php esc_html_e('Export Subscriptions', 'invoicing'); ?> |
|
228 | 228 | </strong> |
229 | 229 | </div> |
230 | 230 | |
231 | 231 | <div class="card-body"> |
232 | 232 | |
233 | - <form method="post" action="<?php echo esc_url( $this->get_download_url( 'subscriptions' ) ); ?>"> |
|
233 | + <form method="post" action="<?php echo esc_url($this->get_download_url('subscriptions')); ?>"> |
|
234 | 234 | |
235 | 235 | <?php |
236 | - $this->generate_from_date( 'subscriptions' ); |
|
237 | - $this->generate_to_date( 'subscriptions' ); |
|
238 | - $this->generate_post_status_select( 'subscriptions' ); |
|
239 | - $this->generate_file_type_select( 'subscriptions' ); |
|
240 | - submit_button( __( 'Download', 'invoicing' ) ); |
|
236 | + $this->generate_from_date('subscriptions'); |
|
237 | + $this->generate_to_date('subscriptions'); |
|
238 | + $this->generate_post_status_select('subscriptions'); |
|
239 | + $this->generate_file_type_select('subscriptions'); |
|
240 | + submit_button(__('Download', 'invoicing')); |
|
241 | 241 | ?> |
242 | 242 | |
243 | 243 | </form> |