@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Item_Details { |
18 | 18 | |
19 | 19 | /** |
20 | - * Output the metabox. |
|
21 | - * |
|
22 | - * @param WP_Post $post |
|
23 | - */ |
|
20 | + * Output the metabox. |
|
21 | + * |
|
22 | + * @param WP_Post $post |
|
23 | + */ |
|
24 | 24 | public static function output( $post ) { |
25 | 25 | |
26 | 26 | // Prepare the item. |
@@ -114,23 +114,23 @@ discard block |
||
114 | 114 | // Dynamic pricing. |
115 | 115 | if ( $item->supports_dynamic_pricing() ) { |
116 | 116 | |
117 | - do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
117 | + do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
118 | 118 | |
119 | - // NYP toggle. |
|
120 | - aui()->input( |
|
119 | + // NYP toggle. |
|
120 | + aui()->input( |
|
121 | 121 | array( |
122 | - 'id' => 'wpinv_name_your_price', |
|
123 | - 'name' => 'wpinv_name_your_price', |
|
124 | - 'type' => 'checkbox', |
|
125 | - 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
126 | - 'value' => '1', |
|
127 | - 'checked' => $item->user_can_set_their_price(), |
|
128 | - 'no_wrap' => true, |
|
122 | + 'id' => 'wpinv_name_your_price', |
|
123 | + 'name' => 'wpinv_name_your_price', |
|
124 | + 'type' => 'checkbox', |
|
125 | + 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
126 | + 'value' => '1', |
|
127 | + 'checked' => $item->user_can_set_their_price(), |
|
128 | + 'no_wrap' => true, |
|
129 | 129 | ), |
130 | 130 | true |
131 | 131 | ); |
132 | 132 | |
133 | - do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
133 | + do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
@@ -274,35 +274,35 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
277 | - * Save meta box data. |
|
278 | - * |
|
279 | - * @param int $post_id |
|
280 | - */ |
|
281 | - public static function save( $post_id ) { |
|
277 | + * Save meta box data. |
|
278 | + * |
|
279 | + * @param int $post_id |
|
280 | + */ |
|
281 | + public static function save( $post_id ) { |
|
282 | 282 | |
283 | 283 | // Prepare the item. |
284 | 284 | $item = new WPInv_Item( $post_id ); |
285 | 285 | |
286 | 286 | // Load new data. |
287 | 287 | $item->set_props( |
288 | - array( |
|
289 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null, |
|
290 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
291 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
292 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
293 | - 'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ), |
|
288 | + array( |
|
289 | + 'price' => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null, |
|
290 | + 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
291 | + 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
292 | + 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
293 | + 'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ), |
|
294 | 294 | 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_minimum_price'] ) : null, |
295 | - 'is_recurring' => ! empty( $_POST['wpinv_is_recurring'] ), |
|
296 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
297 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
298 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
299 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
300 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
301 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
302 | - ) |
|
295 | + 'is_recurring' => ! empty( $_POST['wpinv_is_recurring'] ), |
|
296 | + 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
297 | + 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
298 | + 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
299 | + 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
300 | + 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
301 | + 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
302 | + ) |
|
303 | 303 | ); |
304 | 304 | |
305 | - $item->save(); |
|
306 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
307 | - } |
|
305 | + $item->save(); |
|
306 | + do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
307 | + } |
|
308 | 308 | } |
@@ -31,21 +31,21 @@ discard block |
||
31 | 31 | // Item name. |
32 | 32 | if ( 'name' == $column ) { |
33 | 33 | |
34 | - // Display the name. |
|
35 | - echo '<div class="mb-1">' . esc_html( $fee['name'] ) . '</div>'; |
|
34 | + // Display the name. |
|
35 | + echo '<div class="mb-1">' . esc_html( $fee['name'] ) . '</div>'; |
|
36 | 36 | |
37 | - // And an optional description. |
|
38 | - $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] ); |
|
39 | - echo wp_kses_post( "<small class='form-text text-muted pr-2 m-0'>$description</small>" ); |
|
37 | + // And an optional description. |
|
38 | + $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] ); |
|
39 | + echo wp_kses_post( "<small class='form-text text-muted pr-2 m-0'>$description</small>" ); |
|
40 | 40 | |
41 | 41 | } |
42 | 42 | |
43 | 43 | // Item price. |
44 | 44 | if ( 'price' == $column ) { |
45 | 45 | |
46 | - // Display the item price (or recurring price if this is a renewal invoice) |
|
47 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
48 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
46 | + // Display the item price (or recurring price if this is a renewal invoice) |
|
47 | + if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
48 | + wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
49 | 49 | } else { |
50 | 50 | wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
51 | 51 | } |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | |
54 | 54 | // Item quantity. |
55 | 55 | if ( 'quantity' == $column ) { |
56 | - echo '—'; |
|
56 | + echo '—'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Item tax. |
60 | 60 | if ( 'tax_rate' == $column ) { |
61 | - echo '—'; |
|
61 | + echo '—'; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // Item sub total. |
65 | 65 | if ( 'subtotal' == $column ) { |
66 | 66 | |
67 | - // Display the item price (or recurring price if this is a renewal invoice) |
|
68 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
69 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
67 | + // Display the item price (or recurring price if this is a renewal invoice) |
|
68 | + if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
69 | + wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
70 | 70 | } else { |
71 | 71 | wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
72 | 72 | } |
@@ -64,8 +64,8 @@ |
||
64 | 64 | $description = wpinv_get_gateway_description( $gateway ); |
65 | 65 | |
66 | 66 | if ( wpinv_is_test_mode( $gateway ) ) { |
67 | - $sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) ); |
|
68 | - $description = "$description $sandbox_notice"; |
|
67 | + $sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) ); |
|
68 | + $description = "$description $sandbox_notice"; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | echo wp_kses_post( wpautop( $description ) ); |
@@ -30,40 +30,40 @@ |
||
30 | 30 | // Item name. |
31 | 31 | if ( 'name' == $column ) { |
32 | 32 | |
33 | - // Display the name. |
|
34 | - echo '<div class="wpinv_email_cart_item_title">' . esc_html( $item->get_name() ) . '</div>'; |
|
33 | + // Display the name. |
|
34 | + echo '<div class="wpinv_email_cart_item_title">' . esc_html( $item->get_name() ) . '</div>'; |
|
35 | 35 | |
36 | - // And an optional description. |
|
37 | - $description = $item->get_description(); |
|
36 | + // And an optional description. |
|
37 | + $description = $item->get_description(); |
|
38 | 38 | |
39 | - if ( ! empty( $description ) ) { |
|
40 | - echo "<p class='small'>" . wp_kses_post( $description ) . "</p>"; |
|
39 | + if ( ! empty( $description ) ) { |
|
40 | + echo "<p class='small'>" . wp_kses_post( $description ) . "</p>"; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | 44 | // Item price. |
45 | 45 | if ( 'price' == $column ) { |
46 | 46 | |
47 | - // Display the item price (or recurring price if this is a renewal invoice) |
|
48 | - $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
|
49 | - wpinv_the_price( $price, $invoice->get_currency() ); |
|
47 | + // Display the item price (or recurring price if this is a renewal invoice) |
|
48 | + $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
|
49 | + wpinv_the_price( $price, $invoice->get_currency() ); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
53 | 53 | // Item quantity. |
54 | 54 | if ( 'quantity' == $column ) { |
55 | - echo (float) $item->get_quantity(); |
|
55 | + echo (float) $item->get_quantity(); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // Tax rate. |
59 | 59 | if ( 'tax_rate' == $column ) { |
60 | - echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%'; |
|
60 | + echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Item sub total. |
64 | 64 | if ( 'subtotal' == $column ) { |
65 | - $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
|
66 | - wpinv_the_price( $subtotal, $invoice->get_currency() ); |
|
65 | + $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
|
66 | + wpinv_the_price( $subtotal, $invoice->get_currency() ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // Fires when printing a line item column. |
@@ -30,21 +30,21 @@ discard block |
||
30 | 30 | // Item name. |
31 | 31 | if ( 'name' == $column ) { |
32 | 32 | |
33 | - // Display the name. |
|
34 | - echo '<div class="wpinv_email_cart_item_title">' . esc_html( $fee['name'] ) . '</div>'; |
|
33 | + // Display the name. |
|
34 | + echo '<div class="wpinv_email_cart_item_title">' . esc_html( $fee['name'] ) . '</div>'; |
|
35 | 35 | |
36 | - // And an optional description. |
|
37 | - $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] ); |
|
38 | - echo wp_kses_post( "<p class='small'>$description</p>" ); |
|
36 | + // And an optional description. |
|
37 | + $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] ); |
|
38 | + echo wp_kses_post( "<p class='small'>$description</p>" ); |
|
39 | 39 | |
40 | 40 | } |
41 | 41 | |
42 | 42 | // Item price. |
43 | 43 | if ( 'price' == $column ) { |
44 | 44 | |
45 | - // Display the item price (or recurring price if this is a renewal invoice) |
|
46 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
47 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
45 | + // Display the item price (or recurring price if this is a renewal invoice) |
|
46 | + if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
47 | + wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
48 | 48 | } else { |
49 | 49 | wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
50 | 50 | } |
@@ -52,18 +52,18 @@ discard block |
||
52 | 52 | |
53 | 53 | // Item quantity. |
54 | 54 | if ( 'quantity' == $column ) { |
55 | - echo '—'; |
|
55 | + echo '—'; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // Item tax. |
59 | 59 | if ( 'tax_rate' == $column ) { |
60 | - echo '—'; |
|
60 | + echo '—'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Item sub total. |
64 | 64 | if ( 'subtotal' == $column ) { |
65 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
66 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
65 | + if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
66 | + wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
67 | 67 | } else { |
68 | 68 | wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
69 | 69 | } |
@@ -126,25 +126,25 @@ |
||
126 | 126 | |
127 | 127 | if ( ! empty( $invoice_actions ) ) { |
128 | 128 | |
129 | - echo '<div class="wpinv-receipt-actions text-right mt-1 mb-4">'; |
|
129 | + echo '<div class="wpinv-receipt-actions text-right mt-1 mb-4">'; |
|
130 | 130 | |
131 | - foreach ( $invoice_actions as $key => $invoice_action ) { |
|
131 | + foreach ( $invoice_actions as $key => $invoice_action ) { |
|
132 | 132 | |
133 | - $key = sanitize_html_class( $key ); |
|
134 | - $class = empty( $invoice_action['class'] ) ? 'btn-dark' : sanitize_html_class( $invoice_action['class'] ); |
|
135 | - $url = empty( $invoice_action['url'] ) ? '#' : esc_url( $invoice_action['url'] ); |
|
136 | - $attrs = empty( $invoice_action['attrs'] ) ? '' : $invoice_action['attrs']; |
|
137 | - $anchor = esc_html( $invoice_action['name'] ); |
|
133 | + $key = sanitize_html_class( $key ); |
|
134 | + $class = empty( $invoice_action['class'] ) ? 'btn-dark' : sanitize_html_class( $invoice_action['class'] ); |
|
135 | + $url = empty( $invoice_action['url'] ) ? '#' : esc_url( $invoice_action['url'] ); |
|
136 | + $attrs = empty( $invoice_action['attrs'] ) ? '' : $invoice_action['attrs']; |
|
137 | + $anchor = esc_html( $invoice_action['name'] ); |
|
138 | 138 | |
139 | - echo wp_kses_post( "<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>" ); |
|
139 | + echo wp_kses_post( "<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>" ); |
|
140 | 140 | } |
141 | 141 | |
142 | - echo '</div>'; |
|
142 | + echo '</div>'; |
|
143 | 143 | |
144 | 144 | } |
145 | 145 | |
146 | 146 | if ( ! empty( $alert ) ) { |
147 | - echo wp_kses_post( $alert ); |
|
147 | + echo wp_kses_post( $alert ); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | ?> |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param string $default_path The root path to the default template. Defaults to invoicing/templates |
141 | 141 | */ |
142 | 142 | function wpinv_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
143 | - return getpaid_template()->get_template( $template_name, $args, $template_path, $default_path ); |
|
143 | + return getpaid_template()->get_template( $template_name, $args, $template_path, $default_path ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @return string |
159 | 159 | */ |
160 | 160 | function wpinv_get_theme_template_dir_name() { |
161 | - return trailingslashit( apply_filters( 'wpinv_templates_dir', 'invoicing' ) ); |
|
161 | + return trailingslashit( apply_filters( 'wpinv_templates_dir', 'invoicing' ) ); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -175,125 +175,125 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | function wpinv_get_template_part( $slug, $name = null, $load = true ) { |
178 | - do_action( 'get_template_part_' . $slug, $slug, $name ); |
|
178 | + do_action( 'get_template_part_' . $slug, $slug, $name ); |
|
179 | 179 | |
180 | - // Setup possible parts |
|
181 | - $templates = array(); |
|
182 | - if ( isset( $name ) ) { |
|
183 | - $templates[] = $slug . '-' . $name . '.php'; |
|
180 | + // Setup possible parts |
|
181 | + $templates = array(); |
|
182 | + if ( isset( $name ) ) { |
|
183 | + $templates[] = $slug . '-' . $name . '.php'; |
|
184 | 184 | } |
185 | - $templates[] = $slug . '.php'; |
|
185 | + $templates[] = $slug . '.php'; |
|
186 | 186 | |
187 | - // Allow template parts to be filtered |
|
188 | - $templates = apply_filters( 'wpinv_get_template_part', $templates, $slug, $name ); |
|
187 | + // Allow template parts to be filtered |
|
188 | + $templates = apply_filters( 'wpinv_get_template_part', $templates, $slug, $name ); |
|
189 | 189 | |
190 | - // Return the part that is found |
|
191 | - return wpinv_locate_tmpl( $templates, $load, false ); |
|
190 | + // Return the part that is found |
|
191 | + return wpinv_locate_tmpl( $templates, $load, false ); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | function wpinv_locate_tmpl( $template_names, $load = false, $require_once = true ) { |
195 | - // No file found yet |
|
196 | - $located = false; |
|
195 | + // No file found yet |
|
196 | + $located = false; |
|
197 | 197 | |
198 | - // Try to find a template file |
|
199 | - foreach ( (array)$template_names as $template_name ) { |
|
198 | + // Try to find a template file |
|
199 | + foreach ( (array)$template_names as $template_name ) { |
|
200 | 200 | |
201 | - // Continue if template is empty |
|
202 | - if ( empty( $template_name ) ) { |
|
203 | - continue; |
|
201 | + // Continue if template is empty |
|
202 | + if ( empty( $template_name ) ) { |
|
203 | + continue; |
|
204 | 204 | } |
205 | 205 | |
206 | - // Trim off any slashes from the template name |
|
207 | - $template_name = ltrim( $template_name, '/' ); |
|
206 | + // Trim off any slashes from the template name |
|
207 | + $template_name = ltrim( $template_name, '/' ); |
|
208 | 208 | |
209 | - // try locating this template file by looping through the template paths |
|
210 | - foreach ( wpinv_get_theme_template_paths() as $template_path ) { |
|
209 | + // try locating this template file by looping through the template paths |
|
210 | + foreach ( wpinv_get_theme_template_paths() as $template_path ) { |
|
211 | 211 | |
212 | - if ( file_exists( $template_path . $template_name ) ) { |
|
213 | - $located = $template_path . $template_name; |
|
214 | - break; |
|
215 | - } |
|
216 | - } |
|
212 | + if ( file_exists( $template_path . $template_name ) ) { |
|
213 | + $located = $template_path . $template_name; |
|
214 | + break; |
|
215 | + } |
|
216 | + } |
|
217 | 217 | |
218 | - if ( ! empty( $located ) ) { |
|
219 | - break; |
|
220 | - } |
|
221 | - } |
|
218 | + if ( ! empty( $located ) ) { |
|
219 | + break; |
|
220 | + } |
|
221 | + } |
|
222 | 222 | |
223 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
224 | - load_template( $located, $require_once ); |
|
223 | + if ( ( true == $load ) && ! empty( $located ) ) { |
|
224 | + load_template( $located, $require_once ); |
|
225 | 225 | } |
226 | 226 | |
227 | - return $located; |
|
227 | + return $located; |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | function wpinv_get_theme_template_paths() { |
231 | - $template_dir = wpinv_get_theme_template_dir_name(); |
|
231 | + $template_dir = wpinv_get_theme_template_dir_name(); |
|
232 | 232 | |
233 | - $file_paths = array( |
|
234 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
235 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
236 | - 100 => wpinv_get_templates_dir(), |
|
237 | - ); |
|
233 | + $file_paths = array( |
|
234 | + 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
235 | + 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
236 | + 100 => wpinv_get_templates_dir(), |
|
237 | + ); |
|
238 | 238 | |
239 | - $file_paths = apply_filters( 'wpinv_template_paths', $file_paths ); |
|
239 | + $file_paths = apply_filters( 'wpinv_template_paths', $file_paths ); |
|
240 | 240 | |
241 | - // sort the file paths based on priority |
|
242 | - ksort( $file_paths, SORT_NUMERIC ); |
|
241 | + // sort the file paths based on priority |
|
242 | + ksort( $file_paths, SORT_NUMERIC ); |
|
243 | 243 | |
244 | - return array_map( 'trailingslashit', $file_paths ); |
|
244 | + return array_map( 'trailingslashit', $file_paths ); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | function wpinv_checkout_meta_tags() { |
248 | 248 | |
249 | - $pages = array(); |
|
250 | - $pages[] = wpinv_get_option( 'success_page' ); |
|
251 | - $pages[] = wpinv_get_option( 'failure_page' ); |
|
252 | - $pages[] = wpinv_get_option( 'invoice_history_page' ); |
|
253 | - $pages[] = wpinv_get_option( 'invoice_subscription_page' ); |
|
249 | + $pages = array(); |
|
250 | + $pages[] = wpinv_get_option( 'success_page' ); |
|
251 | + $pages[] = wpinv_get_option( 'failure_page' ); |
|
252 | + $pages[] = wpinv_get_option( 'invoice_history_page' ); |
|
253 | + $pages[] = wpinv_get_option( 'invoice_subscription_page' ); |
|
254 | 254 | |
255 | - if ( ! wpinv_is_checkout() && ! is_page( $pages ) ) { |
|
256 | - return; |
|
257 | - } |
|
255 | + if ( ! wpinv_is_checkout() && ! is_page( $pages ) ) { |
|
256 | + return; |
|
257 | + } |
|
258 | 258 | |
259 | - echo '<meta name="robots" content="noindex,nofollow" />' . "\n"; |
|
259 | + echo '<meta name="robots" content="noindex,nofollow" />' . "\n"; |
|
260 | 260 | } |
261 | 261 | add_action( 'wp_head', 'wpinv_checkout_meta_tags' ); |
262 | 262 | |
263 | 263 | function wpinv_add_body_classes( $class ) { |
264 | - $classes = (array)$class; |
|
264 | + $classes = (array)$class; |
|
265 | 265 | |
266 | - if ( wpinv_is_checkout() ) { |
|
267 | - $classes[] = 'wpinv-checkout'; |
|
268 | - $classes[] = 'wpinv-page'; |
|
269 | - } |
|
266 | + if ( wpinv_is_checkout() ) { |
|
267 | + $classes[] = 'wpinv-checkout'; |
|
268 | + $classes[] = 'wpinv-page'; |
|
269 | + } |
|
270 | 270 | |
271 | - if ( wpinv_is_success_page() ) { |
|
272 | - $classes[] = 'wpinv-success'; |
|
273 | - $classes[] = 'wpinv-page'; |
|
274 | - } |
|
271 | + if ( wpinv_is_success_page() ) { |
|
272 | + $classes[] = 'wpinv-success'; |
|
273 | + $classes[] = 'wpinv-page'; |
|
274 | + } |
|
275 | 275 | |
276 | - if ( wpinv_is_failed_transaction_page() ) { |
|
277 | - $classes[] = 'wpinv-failed-transaction'; |
|
278 | - $classes[] = 'wpinv-page'; |
|
279 | - } |
|
276 | + if ( wpinv_is_failed_transaction_page() ) { |
|
277 | + $classes[] = 'wpinv-failed-transaction'; |
|
278 | + $classes[] = 'wpinv-page'; |
|
279 | + } |
|
280 | 280 | |
281 | - if ( wpinv_is_invoice_history_page() ) { |
|
282 | - $classes[] = 'wpinv-history'; |
|
283 | - $classes[] = 'wpinv-page'; |
|
284 | - } |
|
281 | + if ( wpinv_is_invoice_history_page() ) { |
|
282 | + $classes[] = 'wpinv-history'; |
|
283 | + $classes[] = 'wpinv-page'; |
|
284 | + } |
|
285 | 285 | |
286 | - if ( wpinv_is_subscriptions_history_page() ) { |
|
287 | - $classes[] = 'wpinv-subscription'; |
|
288 | - $classes[] = 'wpinv-page'; |
|
289 | - } |
|
286 | + if ( wpinv_is_subscriptions_history_page() ) { |
|
287 | + $classes[] = 'wpinv-subscription'; |
|
288 | + $classes[] = 'wpinv-page'; |
|
289 | + } |
|
290 | 290 | |
291 | - if ( wpinv_is_test_mode() ) { |
|
292 | - $classes[] = 'wpinv-test-mode'; |
|
293 | - $classes[] = 'wpinv-page'; |
|
294 | - } |
|
291 | + if ( wpinv_is_test_mode() ) { |
|
292 | + $classes[] = 'wpinv-test-mode'; |
|
293 | + $classes[] = 'wpinv-page'; |
|
294 | + } |
|
295 | 295 | |
296 | - return array_unique( $classes ); |
|
296 | + return array_unique( $classes ); |
|
297 | 297 | } |
298 | 298 | add_filter( 'body_class', 'wpinv_add_body_classes' ); |
299 | 299 | |
@@ -458,16 +458,16 @@ discard block |
||
458 | 458 | |
459 | 459 | wpinv_html_select( |
460 | 460 | array( |
461 | - 'name' => $args['name'], |
|
462 | - 'selected' => $args['selected'], |
|
463 | - 'id' => $args['id'], |
|
464 | - 'class' => $args['class'], |
|
465 | - 'options' => $options, |
|
466 | - 'multiple' => $args['multiple'], |
|
467 | - 'placeholder' => $args['placeholder'], |
|
468 | - 'show_option_all' => $args['show_option_all'], |
|
469 | - 'show_option_none' => $args['show_option_none'], |
|
470 | - 'data' => $args['data'], |
|
461 | + 'name' => $args['name'], |
|
462 | + 'selected' => $args['selected'], |
|
463 | + 'id' => $args['id'], |
|
464 | + 'class' => $args['class'], |
|
465 | + 'options' => $options, |
|
466 | + 'multiple' => $args['multiple'], |
|
467 | + 'placeholder' => $args['placeholder'], |
|
468 | + 'show_option_all' => $args['show_option_all'], |
|
469 | + 'show_option_none' => $args['show_option_none'], |
|
470 | + 'data' => $args['data'], |
|
471 | 471 | ) |
472 | 472 | ); |
473 | 473 | |
@@ -767,21 +767,21 @@ discard block |
||
767 | 767 | |
768 | 768 | $formatted_address = str_ireplace( array_keys( $replacements ), $replacements, $format ); |
769 | 769 | |
770 | - // Remove unavailable tags. |
|
770 | + // Remove unavailable tags. |
|
771 | 771 | $formatted_address = preg_replace( '/\{\{\w+\}\}/', '', $formatted_address ); |
772 | 772 | |
773 | 773 | // Clean up white space. |
774 | - $formatted_address = preg_replace( '/ +/', ' ', trim( $formatted_address ) ); |
|
774 | + $formatted_address = preg_replace( '/ +/', ' ', trim( $formatted_address ) ); |
|
775 | 775 | $formatted_address = preg_replace( '/\n\n+/', "\n", $formatted_address ); |
776 | 776 | |
777 | 777 | // Break newlines apart and remove empty lines/trim commas and white space. |
778 | - $formatted_address = array_filter( array_map( 'wpinv_trim_formatted_address_line', explode( "\n", $formatted_address ) ) ); |
|
778 | + $formatted_address = array_filter( array_map( 'wpinv_trim_formatted_address_line', explode( "\n", $formatted_address ) ) ); |
|
779 | 779 | |
780 | 780 | // Add html breaks. |
781 | - $formatted_address = implode( $separator, $formatted_address ); |
|
781 | + $formatted_address = implode( $separator, $formatted_address ); |
|
782 | 782 | |
783 | - // We're done! |
|
784 | - return $formatted_address; |
|
783 | + // We're done! |
|
784 | + return $formatted_address; |
|
785 | 785 | |
786 | 786 | } |
787 | 787 | |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | function getpaid_display_invoice_subscriptions( $invoice ) { |
828 | 828 | |
829 | 829 | // Subscriptions. |
830 | - $subscriptions = getpaid_get_invoice_subscriptions( $invoice ); |
|
830 | + $subscriptions = getpaid_get_invoice_subscriptions( $invoice ); |
|
831 | 831 | |
832 | 832 | if ( empty( $subscriptions ) || ! $invoice->is_recurring() ) { |
833 | 833 | return; |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | function wpinv_empty_cart_message() { |
1042 | - return apply_filters( 'wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __( 'Your cart is empty.', 'invoicing' ) . '</span>' ); |
|
1042 | + return apply_filters( 'wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __( 'Your cart is empty.', 'invoicing' ) . '</span>' ); |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | /** |
@@ -1237,9 +1237,9 @@ discard block |
||
1237 | 1237 | |
1238 | 1238 | if ( 0 == count( $form->get_items() ) ) { |
1239 | 1239 | aui()->alert( |
1240 | - array( |
|
1241 | - 'type' => 'warning', |
|
1242 | - 'content' => __( 'No published items found', 'invoicing' ), |
|
1240 | + array( |
|
1241 | + 'type' => 'warning', |
|
1242 | + 'content' => __( 'No published items found', 'invoicing' ), |
|
1243 | 1243 | ), |
1244 | 1244 | true |
1245 | 1245 | ); |
@@ -1262,10 +1262,10 @@ discard block |
||
1262 | 1262 | $invoice = wpinv_get_invoice( $invoice_id ); |
1263 | 1263 | |
1264 | 1264 | if ( empty( $invoice ) ) { |
1265 | - aui()->alert( |
|
1266 | - array( |
|
1267 | - 'type' => 'warning', |
|
1268 | - 'content' => __( 'Invoice not found', 'invoicing' ), |
|
1265 | + aui()->alert( |
|
1266 | + array( |
|
1267 | + 'type' => 'warning', |
|
1268 | + 'content' => __( 'Invoice not found', 'invoicing' ), |
|
1269 | 1269 | ), |
1270 | 1270 | true |
1271 | 1271 | ); |
@@ -1273,10 +1273,10 @@ discard block |
||
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | if ( $invoice->is_paid() ) { |
1276 | - aui()->alert( |
|
1277 | - array( |
|
1278 | - 'type' => 'warning', |
|
1279 | - 'content' => __( 'Invoice has already been paid', 'invoicing' ), |
|
1276 | + aui()->alert( |
|
1277 | + array( |
|
1278 | + 'type' => 'warning', |
|
1279 | + 'content' => __( 'Invoice has already been paid', 'invoicing' ), |
|
1280 | 1280 | ), |
1281 | 1281 | true |
1282 | 1282 | ); |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | return "<button class='btn btn-primary getpaid-payment-button' type='button' data-form='$form'>$label</button>"; |
1341 | 1341 | } |
1342 | 1342 | |
1343 | - if ( ! empty( $items ) ) { |
|
1343 | + if ( ! empty( $items ) ) { |
|
1344 | 1344 | $items = esc_attr( $items ); |
1345 | 1345 | return "<button class='btn btn-primary getpaid-payment-button' type='button' data-item='$items'>$label</button>"; |
1346 | 1346 | } |
@@ -1526,21 +1526,21 @@ discard block |
||
1526 | 1526 | |
1527 | 1527 | return aui()->select( |
1528 | 1528 | array( |
1529 | - 'options' => $states, |
|
1530 | - 'name' => esc_attr( $field_name ), |
|
1531 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
1532 | - 'value' => sanitize_text_field( $state ), |
|
1533 | - 'placeholder' => $placeholder, |
|
1534 | - 'required' => $required, |
|
1535 | - 'label' => wp_kses_post( $label ), |
|
1536 | - 'label_type' => 'vertical', |
|
1537 | - 'help_text' => $help_text, |
|
1538 | - 'class' => 'getpaid-address-field wpinv_state', |
|
1539 | - 'wrap_class' => "$wrapper_class getpaid-address-field-wrapper__state", |
|
1540 | - 'label_class' => 'getpaid-address-field-label getpaid-address-field-label__state', |
|
1541 | - 'extra_attributes' => array( |
|
1542 | - 'autocomplete' => 'address-level1', |
|
1543 | - ), |
|
1529 | + 'options' => $states, |
|
1530 | + 'name' => esc_attr( $field_name ), |
|
1531 | + 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
1532 | + 'value' => sanitize_text_field( $state ), |
|
1533 | + 'placeholder' => $placeholder, |
|
1534 | + 'required' => $required, |
|
1535 | + 'label' => wp_kses_post( $label ), |
|
1536 | + 'label_type' => 'vertical', |
|
1537 | + 'help_text' => $help_text, |
|
1538 | + 'class' => 'getpaid-address-field wpinv_state', |
|
1539 | + 'wrap_class' => "$wrapper_class getpaid-address-field-wrapper__state", |
|
1540 | + 'label_class' => 'getpaid-address-field-label getpaid-address-field-label__state', |
|
1541 | + 'extra_attributes' => array( |
|
1542 | + 'autocomplete' => 'address-level1', |
|
1543 | + ), |
|
1544 | 1544 | ), |
1545 | 1545 | $echo |
1546 | 1546 | ); |
@@ -126,14 +126,14 @@ |
||
126 | 126 | */ |
127 | 127 | function getpaid_doing_it_wrong( $function, $message, $version ) { |
128 | 128 | |
129 | - $message .= ' Backtrace: ' . wp_debug_backtrace_summary(); |
|
130 | - |
|
131 | - if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) { |
|
132 | - do_action( 'doing_it_wrong_run', $function, $message, $version ); |
|
133 | - error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." ); |
|
134 | - } else { |
|
135 | - _doing_it_wrong( esc_html( $function ), wp_kses_post( $message ), esc_html( $version ) ); |
|
136 | - } |
|
129 | + $message .= ' Backtrace: ' . wp_debug_backtrace_summary(); |
|
130 | + |
|
131 | + if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) { |
|
132 | + do_action( 'doing_it_wrong_run', $function, $message, $version ); |
|
133 | + error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." ); |
|
134 | + } else { |
|
135 | + _doing_it_wrong( esc_html( $function ), wp_kses_post( $message ), esc_html( $version ) ); |
|
136 | + } |
|
137 | 137 | |
138 | 138 | } |
139 | 139 |
@@ -12,49 +12,49 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class GetPaid_Reports { |
14 | 14 | |
15 | - /** |
|
16 | - * Class constructor. |
|
17 | - * |
|
18 | - */ |
|
19 | - public function __construct() { |
|
20 | - add_action( 'admin_menu', array( $this, 'register_reports_page' ), 20 ); |
|
21 | - add_action( 'wpinv_reports_tab_reports', array( $this, 'display_reports_tab' ) ); |
|
22 | - add_action( 'wpinv_reports_tab_export', array( $this, 'display_exports_tab' ) ); |
|
23 | - add_action( 'getpaid_authenticated_admin_action_download_graph', array( $this, 'download_graph' ) ); |
|
24 | - add_action( 'getpaid_authenticated_admin_action_export_invoices', array( $this, 'export_invoices' ) ); |
|
25 | - |
|
26 | - } |
|
27 | - |
|
28 | - /** |
|
29 | - * Registers the reports page. |
|
30 | - * |
|
31 | - */ |
|
32 | - public function register_reports_page() { |
|
33 | - |
|
34 | - add_submenu_page( |
|
15 | + /** |
|
16 | + * Class constructor. |
|
17 | + * |
|
18 | + */ |
|
19 | + public function __construct() { |
|
20 | + add_action( 'admin_menu', array( $this, 'register_reports_page' ), 20 ); |
|
21 | + add_action( 'wpinv_reports_tab_reports', array( $this, 'display_reports_tab' ) ); |
|
22 | + add_action( 'wpinv_reports_tab_export', array( $this, 'display_exports_tab' ) ); |
|
23 | + add_action( 'getpaid_authenticated_admin_action_download_graph', array( $this, 'download_graph' ) ); |
|
24 | + add_action( 'getpaid_authenticated_admin_action_export_invoices', array( $this, 'export_invoices' ) ); |
|
25 | + |
|
26 | + } |
|
27 | + |
|
28 | + /** |
|
29 | + * Registers the reports page. |
|
30 | + * |
|
31 | + */ |
|
32 | + public function register_reports_page() { |
|
33 | + |
|
34 | + add_submenu_page( |
|
35 | 35 | 'wpinv', |
36 | 36 | __( 'Reports', 'invoicing' ), |
37 | 37 | __( 'Reports', 'invoicing' ), |
38 | 38 | wpinv_get_capability(), |
39 | 39 | 'wpinv-reports', |
40 | 40 | array( $this, 'display_reports_page' ) |
41 | - ); |
|
41 | + ); |
|
42 | 42 | |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Displays the reports page. |
|
47 | - * |
|
48 | - */ |
|
49 | - public function display_reports_page() { |
|
45 | + /** |
|
46 | + * Displays the reports page. |
|
47 | + * |
|
48 | + */ |
|
49 | + public function display_reports_page() { |
|
50 | 50 | |
51 | - // Prepare variables. |
|
52 | - $tabs = $this->get_tabs(); |
|
53 | - $current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'reports'; |
|
54 | - $current_tab = array_key_exists( $current_tab, $tabs ) ? $current_tab : 'reports'; |
|
51 | + // Prepare variables. |
|
52 | + $tabs = $this->get_tabs(); |
|
53 | + $current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'reports'; |
|
54 | + $current_tab = array_key_exists( $current_tab, $tabs ) ? $current_tab : 'reports'; |
|
55 | 55 | |
56 | - // Display the current tab. |
|
57 | - ?> |
|
56 | + // Display the current tab. |
|
57 | + ?> |
|
58 | 58 | |
59 | 59 | <div class="wrap"> |
60 | 60 | |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | <nav class="nav-tab-wrapper"> |
64 | 64 | |
65 | 65 | <?php |
66 | - foreach ( $tabs as $key => $label ) { |
|
66 | + foreach ( $tabs as $key => $label ) { |
|
67 | 67 | |
68 | - $key = sanitize_key( $key ); |
|
69 | - $label = esc_html( $label ); |
|
70 | - $class = $key == $current_tab ? 'nav-tab nav-tab-active' : 'nav-tab'; |
|
71 | - $url = esc_url( |
|
68 | + $key = sanitize_key( $key ); |
|
69 | + $label = esc_html( $label ); |
|
70 | + $class = $key == $current_tab ? 'nav-tab nav-tab-active' : 'nav-tab'; |
|
71 | + $url = esc_url( |
|
72 | 72 | add_query_arg( 'tab', $key, admin_url( 'admin.php?page=wpinv-reports' ) ) |
73 | 73 | ); |
74 | 74 | |
75 | - echo wp_kses_post( "\n\t\t\t<a href='$url' class='" . $class . "'>$label</a>" ); |
|
75 | + echo wp_kses_post( "\n\t\t\t<a href='$url' class='" . $class . "'>$label</a>" ); |
|
76 | 76 | |
77 | - } |
|
78 | - ?> |
|
77 | + } |
|
78 | + ?> |
|
79 | 79 | |
80 | 80 | </nav> |
81 | 81 | |
@@ -86,82 +86,82 @@ discard block |
||
86 | 86 | </div> |
87 | 87 | <?php |
88 | 88 | |
89 | - // Wordfence loads an unsupported version of chart js on our page. |
|
90 | - wp_deregister_style( 'chart-js' ); |
|
91 | - wp_deregister_script( 'chart-js' ); |
|
92 | - wp_enqueue_script( 'chart-js', WPINV_PLUGIN_URL . 'assets/js/chart.min.js', array( 'jquery' ), '3.7.1', true ); |
|
89 | + // Wordfence loads an unsupported version of chart js on our page. |
|
90 | + wp_deregister_style( 'chart-js' ); |
|
91 | + wp_deregister_script( 'chart-js' ); |
|
92 | + wp_enqueue_script( 'chart-js', WPINV_PLUGIN_URL . 'assets/js/chart.min.js', array( 'jquery' ), '3.7.1', true ); |
|
93 | 93 | |
94 | - } |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * Retrieves reports page tabs. |
|
98 | - * |
|
99 | - * @return array |
|
100 | - */ |
|
101 | - public function get_tabs() { |
|
96 | + /** |
|
97 | + * Retrieves reports page tabs. |
|
98 | + * |
|
99 | + * @return array |
|
100 | + */ |
|
101 | + public function get_tabs() { |
|
102 | 102 | |
103 | - $tabs = array( |
|
104 | - 'reports' => __( 'Reports', 'invoicing' ), |
|
105 | - 'export' => __( 'Export', 'invoicing' ), |
|
106 | - ); |
|
103 | + $tabs = array( |
|
104 | + 'reports' => __( 'Reports', 'invoicing' ), |
|
105 | + 'export' => __( 'Export', 'invoicing' ), |
|
106 | + ); |
|
107 | 107 | |
108 | - return apply_filters( 'getpaid_report_tabs', $tabs ); |
|
109 | - } |
|
108 | + return apply_filters( 'getpaid_report_tabs', $tabs ); |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * Displays the reports tab. |
|
113 | - * |
|
114 | - */ |
|
115 | - public function display_reports_tab() { |
|
111 | + /** |
|
112 | + * Displays the reports tab. |
|
113 | + * |
|
114 | + */ |
|
115 | + public function display_reports_tab() { |
|
116 | 116 | |
117 | - $reports = new GetPaid_Reports_Report(); |
|
118 | - $reports->display(); |
|
117 | + $reports = new GetPaid_Reports_Report(); |
|
118 | + $reports->display(); |
|
119 | 119 | |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | - /** |
|
123 | - * Displays the exports tab. |
|
124 | - * |
|
125 | - */ |
|
126 | - public function display_exports_tab() { |
|
122 | + /** |
|
123 | + * Displays the exports tab. |
|
124 | + * |
|
125 | + */ |
|
126 | + public function display_exports_tab() { |
|
127 | 127 | |
128 | - $exports = new GetPaid_Reports_Export(); |
|
129 | - $exports->display(); |
|
128 | + $exports = new GetPaid_Reports_Export(); |
|
129 | + $exports->display(); |
|
130 | 130 | |
131 | - } |
|
131 | + } |
|
132 | 132 | |
133 | - /** |
|
134 | - * Donwnloads a graph. |
|
135 | - * |
|
136 | - * @param array $args |
|
137 | - */ |
|
138 | - public function download_graph( $args ) { |
|
133 | + /** |
|
134 | + * Donwnloads a graph. |
|
135 | + * |
|
136 | + * @param array $args |
|
137 | + */ |
|
138 | + public function download_graph( $args ) { |
|
139 | 139 | |
140 | - if ( ! empty( $args['graph'] ) ) { |
|
141 | - $downloader = new GetPaid_Graph_Downloader(); |
|
142 | - $downloader->download( $args['graph'] ); |
|
143 | - } |
|
140 | + if ( ! empty( $args['graph'] ) ) { |
|
141 | + $downloader = new GetPaid_Graph_Downloader(); |
|
142 | + $downloader->download( $args['graph'] ); |
|
143 | + } |
|
144 | 144 | |
145 | - } |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * Exports invoices. |
|
149 | - * |
|
150 | - * @param array $args |
|
151 | - */ |
|
152 | - public function export_invoices( $args ) { |
|
147 | + /** |
|
148 | + * Exports invoices. |
|
149 | + * |
|
150 | + * @param array $args |
|
151 | + */ |
|
152 | + public function export_invoices( $args ) { |
|
153 | 153 | |
154 | - if ( ! empty( $args['post_type'] ) ) { |
|
154 | + if ( ! empty( $args['post_type'] ) ) { |
|
155 | 155 | |
156 | - if ( 'subscriptions' === $args['post_type'] ) { |
|
157 | - $downloader = new GetPaid_Subscription_Exporter(); |
|
158 | - } else { |
|
159 | - $downloader = new GetPaid_Invoice_Exporter(); |
|
160 | - } |
|
156 | + if ( 'subscriptions' === $args['post_type'] ) { |
|
157 | + $downloader = new GetPaid_Subscription_Exporter(); |
|
158 | + } else { |
|
159 | + $downloader = new GetPaid_Invoice_Exporter(); |
|
160 | + } |
|
161 | 161 | |
162 | - $downloader->export( $args['post_type'], $args ); |
|
163 | - } |
|
162 | + $downloader->export( $args['post_type'], $args ); |
|
163 | + } |
|
164 | 164 | |
165 | - } |
|
165 | + } |
|
166 | 166 | |
167 | 167 | } |