@@ -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_VAT { |
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. |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | - * Output the VAT rules settings. |
|
50 | - * |
|
51 | - * @param WPInv_Item $item |
|
52 | - */ |
|
49 | + * Output the VAT rules settings. |
|
50 | + * |
|
51 | + * @param WPInv_Item $item |
|
52 | + */ |
|
53 | 53 | public static function output_vat_rules( $item ) { |
54 | 54 | ?> |
55 | 55 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * Output the VAT class settings. |
|
91 | - * |
|
92 | - * @param WPInv_Item $item |
|
93 | - */ |
|
90 | + * Output the VAT class settings. |
|
91 | + * |
|
92 | + * @param WPInv_Item $item |
|
93 | + */ |
|
94 | 94 | public static function output_vat_classes( $item ) { |
95 | 95 | ?> |
96 | 96 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,26 +21,26 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the item. |
27 | - $item = new WPInv_Item( $post ); |
|
27 | + $item = new WPInv_Item($post); |
|
28 | 28 | |
29 | 29 | echo "<div class='bsui' style='max-width: 600px;padding-top: 10px;'>"; |
30 | 30 | |
31 | - do_action( 'wpinv_item_before_vat_metabox', $item ); |
|
31 | + do_action('wpinv_item_before_vat_metabox', $item); |
|
32 | 32 | |
33 | 33 | // Output the vat rules settings. |
34 | - do_action( 'wpinv_item_vat_metabox_before_vat_rules', $item ); |
|
35 | - self::output_vat_rules( $item ); |
|
36 | - do_action( 'wpinv_item_vat_metabox_vat_rules', $item ); |
|
34 | + do_action('wpinv_item_vat_metabox_before_vat_rules', $item); |
|
35 | + self::output_vat_rules($item); |
|
36 | + do_action('wpinv_item_vat_metabox_vat_rules', $item); |
|
37 | 37 | |
38 | 38 | // Output vat class settings. |
39 | - do_action( 'wpinv_item_vat_metabox_before_vat_rules', $item ); |
|
40 | - self::output_vat_classes( $item ); |
|
41 | - do_action( 'wpinv_item_vat_metabox_vat_class', $item ); |
|
39 | + do_action('wpinv_item_vat_metabox_before_vat_rules', $item); |
|
40 | + self::output_vat_classes($item); |
|
41 | + do_action('wpinv_item_vat_metabox_vat_class', $item); |
|
42 | 42 | |
43 | - do_action( 'wpinv_item_vat_metabox', $item ); |
|
43 | + do_action('wpinv_item_vat_metabox', $item); |
|
44 | 44 | |
45 | 45 | echo '</div>'; |
46 | 46 | } |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @param WPInv_Item $item |
52 | 52 | */ |
53 | - public static function output_vat_rules( $item ) { |
|
53 | + public static function output_vat_rules($item) { |
|
54 | 54 | ?> |
55 | 55 | |
56 | 56 | <div class="wpinv_vat_rules"> |
57 | 57 | |
58 | 58 | <div class="form-group mb-3 row"> |
59 | 59 | <label for="wpinv_vat_rules" class="col-sm-3 col-form-label"> |
60 | - <?php esc_html_e( 'Tax Rule', 'invoicing' ); ?> |
|
60 | + <?php esc_html_e('Tax Rule', 'invoicing'); ?> |
|
61 | 61 | </label> |
62 | 62 | <div class="col-sm-8"> |
63 | 63 | <?php |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | array( |
66 | 66 | 'id' => 'wpinv_vat_rules', |
67 | 67 | 'name' => 'wpinv_vat_rules', |
68 | - 'placeholder' => __( 'Select tax rule', 'invoicing' ), |
|
69 | - 'value' => $item->get_vat_rule( 'edit' ), |
|
68 | + 'placeholder' => __('Select tax rule', 'invoicing'), |
|
69 | + 'value' => $item->get_vat_rule('edit'), |
|
70 | 70 | 'select2' => true, |
71 | 71 | 'data-allow-clear' => 'false', |
72 | 72 | 'no_wrap' => true, |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @param WPInv_Item $item |
91 | 91 | */ |
92 | - public static function output_vat_classes( $item ) { |
|
92 | + public static function output_vat_classes($item) { |
|
93 | 93 | ?> |
94 | 94 | |
95 | 95 | <div class="wpinv_vat_classes"> |
96 | 96 | |
97 | 97 | <div class="form-group mb-3 row"> |
98 | 98 | <label for="wpinv_vat_class" class="col-sm-3 col-form-label"> |
99 | - <?php esc_html_e( 'Tax Class', 'invoicing' ); ?> |
|
99 | + <?php esc_html_e('Tax Class', 'invoicing'); ?> |
|
100 | 100 | </label> |
101 | 101 | <div class="col-sm-8"> |
102 | 102 | <?php |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | array( |
105 | 105 | 'id' => 'wpinv_vat_class', |
106 | 106 | 'name' => 'wpinv_vat_class', |
107 | - 'placeholder' => __( 'Select tax class', 'invoicing' ), |
|
108 | - 'value' => $item->get_vat_class( 'edit' ), |
|
107 | + 'placeholder' => __('Select tax class', 'invoicing'), |
|
108 | + 'value' => $item->get_vat_class('edit'), |
|
109 | 109 | 'select2' => true, |
110 | 110 | 'data-allow-clear' => 'false', |
111 | 111 | 'no_wrap' => true, |
@@ -55,27 +55,27 @@ |
||
55 | 55 | public static function vat_rates_settings() {} |
56 | 56 | |
57 | 57 | /** |
58 | - * |
|
59 | - * @deprecated |
|
60 | - */ |
|
58 | + * |
|
59 | + * @deprecated |
|
60 | + */ |
|
61 | 61 | public static function vat_settings() {} |
62 | 62 | |
63 | 63 | /** |
64 | - * |
|
65 | - * @deprecated |
|
66 | - */ |
|
64 | + * |
|
65 | + * @deprecated |
|
66 | + */ |
|
67 | 67 | public static function maxmind_folder() {} |
68 | 68 | |
69 | 69 | /** |
70 | - * |
|
71 | - * @deprecated |
|
72 | - */ |
|
70 | + * |
|
71 | + * @deprecated |
|
72 | + */ |
|
73 | 73 | public static function geoip2_download_database() {} |
74 | 74 | |
75 | 75 | /** |
76 | - * |
|
77 | - * @deprecated |
|
78 | - */ |
|
76 | + * |
|
77 | + * @deprecated |
|
78 | + */ |
|
79 | 79 | public static function geoip2_download_file() {} |
80 | 80 | |
81 | 81 | /** |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @deprecated |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * @deprecated |
40 | 40 | */ |
41 | - public static function is_eu_state( $country_code ) { |
|
42 | - return getpaid_is_eu_state( $country_code ); |
|
41 | + public static function is_eu_state($country_code) { |
|
42 | + return getpaid_is_eu_state($country_code); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @deprecated |
47 | 47 | */ |
48 | - public static function is_gst_country( $country_code ) { |
|
49 | - return getpaid_is_gst_country( $country_code ); |
|
48 | + public static function is_gst_country($country_code) { |
|
49 | + return getpaid_is_gst_country($country_code); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @version 1.0.19 |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | return array( |
12 | 12 | 'AT', |
@@ -9,31 +9,31 @@ |
||
9 | 9 | defined( 'ABSPATH' ) || exit; |
10 | 10 | |
11 | 11 | return array( |
12 | - 'AT', |
|
13 | - 'BE', |
|
14 | - 'BG', |
|
15 | - 'HR', |
|
16 | - 'CY', |
|
17 | - 'CZ', |
|
18 | - 'DK', |
|
19 | - 'EE', |
|
20 | - 'FI', |
|
21 | - 'FR', |
|
22 | - 'DE', |
|
23 | - 'GR', |
|
24 | - 'HU', |
|
25 | - 'IE', |
|
26 | - 'IT', |
|
27 | - 'LV', |
|
28 | - 'LT', |
|
29 | - 'LU', |
|
30 | - 'MT', |
|
31 | - 'NL', |
|
32 | - 'PL', |
|
33 | - 'PT', |
|
34 | - 'RO', |
|
35 | - 'SK', |
|
36 | - 'SI', |
|
37 | - 'ES', |
|
38 | - 'SE', |
|
12 | + 'AT', |
|
13 | + 'BE', |
|
14 | + 'BG', |
|
15 | + 'HR', |
|
16 | + 'CY', |
|
17 | + 'CZ', |
|
18 | + 'DK', |
|
19 | + 'EE', |
|
20 | + 'FI', |
|
21 | + 'FR', |
|
22 | + 'DE', |
|
23 | + 'GR', |
|
24 | + 'HU', |
|
25 | + 'IE', |
|
26 | + 'IT', |
|
27 | + 'LV', |
|
28 | + 'LT', |
|
29 | + 'LU', |
|
30 | + 'MT', |
|
31 | + 'NL', |
|
32 | + 'PL', |
|
33 | + 'PT', |
|
34 | + 'RO', |
|
35 | + 'SK', |
|
36 | + 'SI', |
|
37 | + 'ES', |
|
38 | + 'SE', |
|
39 | 39 | ); |
@@ -7,24 +7,24 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | - <?php do_action( 'getpaid_before_invoice_details_top', $invoice ); ?> |
|
14 | + <?php do_action('getpaid_before_invoice_details_top', $invoice); ?> |
|
15 | 15 | |
16 | 16 | <div class="getpaid-invoice-details-top mb-5"> |
17 | 17 | <div class="row"> |
18 | 18 | <div class="col-12 col-sm-6 text-sm-left"> |
19 | - <?php do_action( 'getpaid_invoice_details_top_left', $invoice ); ?> |
|
19 | + <?php do_action('getpaid_invoice_details_top_left', $invoice); ?> |
|
20 | 20 | </div> |
21 | 21 | |
22 | 22 | <div class="col-12 col-sm-6 text-sm-right"> |
23 | - <?php do_action( 'getpaid_invoice_details_top_right', $invoice ); ?> |
|
23 | + <?php do_action('getpaid_invoice_details_top_right', $invoice); ?> |
|
24 | 24 | </div> |
25 | 25 | </div> |
26 | 26 | </div> |
27 | 27 | |
28 | - <?php do_action( 'getpaid_after_invoice_details_top', $invoice ); ?> |
|
28 | + <?php do_action('getpaid_after_invoice_details_top', $invoice); ?> |
|
29 | 29 | |
30 | 30 | <?php |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays the invoice title, type etc. |
4 | 4 | * |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
11 | - |
|
12 | -?> |
|
10 | + defined( 'ABSPATH' ) || exit; |
|
13 | 11 | |
12 | + ?> |
|
13 | + |
|
14 | 14 | <?php do_action( 'getpaid_before_invoice_details_top', $invoice ); ?> |
15 | 15 | |
16 | 16 | <div class="getpaid-invoice-details-top mb-5"> |
@@ -26,5 +26,5 @@ discard block |
||
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <?php do_action( 'getpaid_after_invoice_details_top', $invoice ); ?> |
29 | - |
|
30 | -<?php |
|
29 | + |
|
30 | + <?php |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * @since 2.0.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * GetPaid REST top earners controller class. |
@@ -18,50 +18,50 @@ |
||
18 | 18 | */ |
19 | 19 | class GetPaid_REST_Report_Top_Earners_Controller extends GetPaid_REST_Report_Top_Sellers_Controller { |
20 | 20 | |
21 | - /** |
|
22 | - * Route base. |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $rest_base = 'reports/top_earners'; |
|
21 | + /** |
|
22 | + * Route base. |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $rest_base = 'reports/top_earners'; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Get all data needed for this report and store in the class. |
|
30 | - */ |
|
31 | - protected function query_report_data() { |
|
28 | + /** |
|
29 | + * Get all data needed for this report and store in the class. |
|
30 | + */ |
|
31 | + protected function query_report_data() { |
|
32 | 32 | |
33 | - $this->report_data = GetPaid_Reports_Helper::get_invoice_report_data( |
|
34 | - array( |
|
35 | - 'data' => array( |
|
36 | - 'quantity' => array( |
|
37 | - 'type' => 'invoice_item', |
|
38 | - 'function' => 'SUM', |
|
39 | - 'name' => 'invoice_item_qty', |
|
40 | - ), |
|
41 | - 'item_id' => array( |
|
42 | - 'type' => 'invoice_item', |
|
43 | - 'function' => '', |
|
44 | - 'name' => 'invoice_item_id', |
|
45 | - ), |
|
46 | - 'item_name' => array( |
|
47 | - 'type' => 'invoice_item', |
|
48 | - 'function' => '', |
|
49 | - 'name' => 'invoice_item_name', |
|
50 | - ), |
|
51 | - 'price' => array( |
|
52 | - 'type' => 'invoice_item', |
|
53 | - 'function' => 'SUM', |
|
54 | - 'name' => 'invoice_item_price', |
|
55 | - ), |
|
56 | - ), |
|
57 | - 'group_by' => 'invoice_item_id', |
|
58 | - 'order_by' => 'invoice_item_price DESC', |
|
59 | - 'query_type' => 'get_results', |
|
60 | - 'limit' => 10, |
|
61 | - 'filter_range' => $this->report_range, |
|
62 | - ) |
|
63 | - ); |
|
33 | + $this->report_data = GetPaid_Reports_Helper::get_invoice_report_data( |
|
34 | + array( |
|
35 | + 'data' => array( |
|
36 | + 'quantity' => array( |
|
37 | + 'type' => 'invoice_item', |
|
38 | + 'function' => 'SUM', |
|
39 | + 'name' => 'invoice_item_qty', |
|
40 | + ), |
|
41 | + 'item_id' => array( |
|
42 | + 'type' => 'invoice_item', |
|
43 | + 'function' => '', |
|
44 | + 'name' => 'invoice_item_id', |
|
45 | + ), |
|
46 | + 'item_name' => array( |
|
47 | + 'type' => 'invoice_item', |
|
48 | + 'function' => '', |
|
49 | + 'name' => 'invoice_item_name', |
|
50 | + ), |
|
51 | + 'price' => array( |
|
52 | + 'type' => 'invoice_item', |
|
53 | + 'function' => 'SUM', |
|
54 | + 'name' => 'invoice_item_price', |
|
55 | + ), |
|
56 | + ), |
|
57 | + 'group_by' => 'invoice_item_id', |
|
58 | + 'order_by' => 'invoice_item_price DESC', |
|
59 | + 'query_type' => 'get_results', |
|
60 | + 'limit' => 10, |
|
61 | + 'filter_range' => $this->report_range, |
|
62 | + ) |
|
63 | + ); |
|
64 | 64 | |
65 | - } |
|
65 | + } |
|
66 | 66 | |
67 | 67 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @since 1.0.19 |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * The main API class |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->invoice_counts = new GetPaid_REST_Report_Invoice_Counts_Controller(); |
97 | 97 | |
98 | 98 | // Fires after loading the rest api. |
99 | - do_action( 'getpaid_rest_api_loaded', $this ); |
|
99 | + do_action('getpaid_rest_api_loaded', $this); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | } |
@@ -18,102 +18,102 @@ |
||
18 | 18 | */ |
19 | 19 | class GetPaid_REST_Report_Invoice_Counts_Controller extends GetPaid_REST_Reports_Controller { |
20 | 20 | |
21 | - /** |
|
22 | - * Route base. |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $rest_base = 'reports/invoices/counts'; |
|
27 | - |
|
28 | - /** |
|
29 | - * Prepare a report object for serialization. |
|
30 | - * |
|
31 | - * @param stdClass $report Report data. |
|
32 | - * @param WP_REST_Request $request Request object. |
|
33 | - * @return WP_REST_Response $response Response data. |
|
34 | - */ |
|
35 | - public function prepare_item_for_response( $report, $request ) { |
|
36 | - |
|
37 | - $data = (array) $report; |
|
38 | - $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; |
|
39 | - $data = $this->add_additional_fields_to_object( $data, $request ); |
|
40 | - $data = $this->filter_response_by_context( $data, $context ); |
|
41 | - |
|
42 | - // Wrap the data in a response object. |
|
43 | - $response = rest_ensure_response( $data ); |
|
44 | - |
|
45 | - $response->add_links( |
|
46 | - array( |
|
47 | - 'about' => array( |
|
48 | - 'href' => rest_url( sprintf( '%s/reports', $this->namespace ) ), |
|
49 | - ), |
|
50 | - ) |
|
51 | - ); |
|
52 | - |
|
53 | - return apply_filters( 'getpaid_rest_prepare_report_invoices_count', $response, $report, $request ); |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * Get reports list. |
|
58 | - * |
|
59 | - * @since 2.0.0 |
|
60 | - * @return array |
|
61 | - */ |
|
62 | - protected function get_reports() { |
|
63 | - |
|
64 | - $counts = wp_count_posts( 'wpi_invoice' ); |
|
65 | - $data = array(); |
|
66 | - |
|
67 | - foreach ( wpinv_get_invoice_statuses() as $slug => $name ) { |
|
68 | - |
|
69 | - if ( ! isset( $counts->$slug ) ) { |
|
70 | - continue; |
|
71 | - } |
|
72 | - |
|
73 | - $data[] = array( |
|
74 | - 'slug' => $slug, |
|
75 | - 'name' => $name, |
|
76 | - 'count' => (int) $counts->$slug, |
|
77 | - ); |
|
78 | - |
|
79 | - } |
|
80 | - |
|
81 | - return $data; |
|
82 | - |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * Get the Report's schema, conforming to JSON Schema. |
|
87 | - * |
|
88 | - * @return array |
|
89 | - */ |
|
90 | - public function get_item_schema() { |
|
91 | - $schema = array( |
|
92 | - '$schema' => 'http://json-schema.org/draft-04/schema#', |
|
93 | - 'title' => 'report_invoice_counts', |
|
94 | - 'type' => 'object', |
|
95 | - 'properties' => array( |
|
96 | - 'slug' => array( |
|
97 | - 'description' => __( 'An alphanumeric identifier for the resource.', 'invoicing' ), |
|
98 | - 'type' => 'string', |
|
99 | - 'context' => array( 'view' ), |
|
100 | - 'readonly' => true, |
|
101 | - ), |
|
102 | - 'name' => array( |
|
103 | - 'description' => __( 'Invoice status name.', 'invoicing' ), |
|
104 | - 'type' => 'string', |
|
105 | - 'context' => array( 'view' ), |
|
106 | - 'readonly' => true, |
|
107 | - ), |
|
108 | - 'count' => array( |
|
109 | - 'description' => __( 'Number of invoices.', 'invoicing' ), |
|
110 | - 'type' => 'string', |
|
111 | - 'context' => array( 'view' ), |
|
112 | - 'readonly' => true, |
|
113 | - ), |
|
114 | - ), |
|
115 | - ); |
|
116 | - |
|
117 | - return $this->add_additional_fields_schema( $schema ); |
|
118 | - } |
|
21 | + /** |
|
22 | + * Route base. |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $rest_base = 'reports/invoices/counts'; |
|
27 | + |
|
28 | + /** |
|
29 | + * Prepare a report object for serialization. |
|
30 | + * |
|
31 | + * @param stdClass $report Report data. |
|
32 | + * @param WP_REST_Request $request Request object. |
|
33 | + * @return WP_REST_Response $response Response data. |
|
34 | + */ |
|
35 | + public function prepare_item_for_response( $report, $request ) { |
|
36 | + |
|
37 | + $data = (array) $report; |
|
38 | + $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; |
|
39 | + $data = $this->add_additional_fields_to_object( $data, $request ); |
|
40 | + $data = $this->filter_response_by_context( $data, $context ); |
|
41 | + |
|
42 | + // Wrap the data in a response object. |
|
43 | + $response = rest_ensure_response( $data ); |
|
44 | + |
|
45 | + $response->add_links( |
|
46 | + array( |
|
47 | + 'about' => array( |
|
48 | + 'href' => rest_url( sprintf( '%s/reports', $this->namespace ) ), |
|
49 | + ), |
|
50 | + ) |
|
51 | + ); |
|
52 | + |
|
53 | + return apply_filters( 'getpaid_rest_prepare_report_invoices_count', $response, $report, $request ); |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * Get reports list. |
|
58 | + * |
|
59 | + * @since 2.0.0 |
|
60 | + * @return array |
|
61 | + */ |
|
62 | + protected function get_reports() { |
|
63 | + |
|
64 | + $counts = wp_count_posts( 'wpi_invoice' ); |
|
65 | + $data = array(); |
|
66 | + |
|
67 | + foreach ( wpinv_get_invoice_statuses() as $slug => $name ) { |
|
68 | + |
|
69 | + if ( ! isset( $counts->$slug ) ) { |
|
70 | + continue; |
|
71 | + } |
|
72 | + |
|
73 | + $data[] = array( |
|
74 | + 'slug' => $slug, |
|
75 | + 'name' => $name, |
|
76 | + 'count' => (int) $counts->$slug, |
|
77 | + ); |
|
78 | + |
|
79 | + } |
|
80 | + |
|
81 | + return $data; |
|
82 | + |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * Get the Report's schema, conforming to JSON Schema. |
|
87 | + * |
|
88 | + * @return array |
|
89 | + */ |
|
90 | + public function get_item_schema() { |
|
91 | + $schema = array( |
|
92 | + '$schema' => 'http://json-schema.org/draft-04/schema#', |
|
93 | + 'title' => 'report_invoice_counts', |
|
94 | + 'type' => 'object', |
|
95 | + 'properties' => array( |
|
96 | + 'slug' => array( |
|
97 | + 'description' => __( 'An alphanumeric identifier for the resource.', 'invoicing' ), |
|
98 | + 'type' => 'string', |
|
99 | + 'context' => array( 'view' ), |
|
100 | + 'readonly' => true, |
|
101 | + ), |
|
102 | + 'name' => array( |
|
103 | + 'description' => __( 'Invoice status name.', 'invoicing' ), |
|
104 | + 'type' => 'string', |
|
105 | + 'context' => array( 'view' ), |
|
106 | + 'readonly' => true, |
|
107 | + ), |
|
108 | + 'count' => array( |
|
109 | + 'description' => __( 'Number of invoices.', 'invoicing' ), |
|
110 | + 'type' => 'string', |
|
111 | + 'context' => array( 'view' ), |
|
112 | + 'readonly' => true, |
|
113 | + ), |
|
114 | + ), |
|
115 | + ); |
|
116 | + |
|
117 | + return $this->add_additional_fields_schema( $schema ); |
|
118 | + } |
|
119 | 119 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 2.0.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * GetPaid REST invoice counts controller class. |
@@ -32,25 +32,25 @@ discard block |
||
32 | 32 | * @param WP_REST_Request $request Request object. |
33 | 33 | * @return WP_REST_Response $response Response data. |
34 | 34 | */ |
35 | - public function prepare_item_for_response( $report, $request ) { |
|
35 | + public function prepare_item_for_response($report, $request) { |
|
36 | 36 | |
37 | 37 | $data = (array) $report; |
38 | - $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; |
|
39 | - $data = $this->add_additional_fields_to_object( $data, $request ); |
|
40 | - $data = $this->filter_response_by_context( $data, $context ); |
|
38 | + $context = !empty($request['context']) ? $request['context'] : 'view'; |
|
39 | + $data = $this->add_additional_fields_to_object($data, $request); |
|
40 | + $data = $this->filter_response_by_context($data, $context); |
|
41 | 41 | |
42 | 42 | // Wrap the data in a response object. |
43 | - $response = rest_ensure_response( $data ); |
|
43 | + $response = rest_ensure_response($data); |
|
44 | 44 | |
45 | 45 | $response->add_links( |
46 | 46 | array( |
47 | 47 | 'about' => array( |
48 | - 'href' => rest_url( sprintf( '%s/reports', $this->namespace ) ), |
|
48 | + 'href' => rest_url(sprintf('%s/reports', $this->namespace)), |
|
49 | 49 | ), |
50 | 50 | ) |
51 | 51 | ); |
52 | 52 | |
53 | - return apply_filters( 'getpaid_rest_prepare_report_invoices_count', $response, $report, $request ); |
|
53 | + return apply_filters('getpaid_rest_prepare_report_invoices_count', $response, $report, $request); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function get_reports() { |
63 | 63 | |
64 | - $counts = wp_count_posts( 'wpi_invoice' ); |
|
64 | + $counts = wp_count_posts('wpi_invoice'); |
|
65 | 65 | $data = array(); |
66 | 66 | |
67 | - foreach ( wpinv_get_invoice_statuses() as $slug => $name ) { |
|
67 | + foreach (wpinv_get_invoice_statuses() as $slug => $name) { |
|
68 | 68 | |
69 | - if ( ! isset( $counts->$slug ) ) { |
|
69 | + if (!isset($counts->$slug)) { |
|
70 | 70 | continue; |
71 | 71 | } |
72 | 72 | |
@@ -94,26 +94,26 @@ discard block |
||
94 | 94 | 'type' => 'object', |
95 | 95 | 'properties' => array( |
96 | 96 | 'slug' => array( |
97 | - 'description' => __( 'An alphanumeric identifier for the resource.', 'invoicing' ), |
|
97 | + 'description' => __('An alphanumeric identifier for the resource.', 'invoicing'), |
|
98 | 98 | 'type' => 'string', |
99 | - 'context' => array( 'view' ), |
|
99 | + 'context' => array('view'), |
|
100 | 100 | 'readonly' => true, |
101 | 101 | ), |
102 | 102 | 'name' => array( |
103 | - 'description' => __( 'Invoice status name.', 'invoicing' ), |
|
103 | + 'description' => __('Invoice status name.', 'invoicing'), |
|
104 | 104 | 'type' => 'string', |
105 | - 'context' => array( 'view' ), |
|
105 | + 'context' => array('view'), |
|
106 | 106 | 'readonly' => true, |
107 | 107 | ), |
108 | 108 | 'count' => array( |
109 | - 'description' => __( 'Number of invoices.', 'invoicing' ), |
|
109 | + 'description' => __('Number of invoices.', 'invoicing'), |
|
110 | 110 | 'type' => 'string', |
111 | - 'context' => array( 'view' ), |
|
111 | + 'context' => array('view'), |
|
112 | 112 | 'readonly' => true, |
113 | 113 | ), |
114 | 114 | ), |
115 | 115 | ); |
116 | 116 | |
117 | - return $this->add_additional_fields_schema( $schema ); |
|
117 | + return $this->add_additional_fields_schema($schema); |
|
118 | 118 | } |
119 | 119 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @package Invoicing/data |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | return array( |
12 | 12 |
@@ -37,25 +37,25 @@ |
||
37 | 37 | public function get_privacy_message() { |
38 | 38 | |
39 | 39 | $content = '<div class="wp-suggested-text">' . |
40 | - '<h2>' . __( 'Invoices and checkout', 'invoicing' ) . '</h2>' . |
|
41 | - '<p class="privacy-policy-tutorial">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' . |
|
42 | - '<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>' . |
|
43 | - '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' . |
|
44 | - '<ul>' . |
|
45 | - '<li>' . __( '- Send you important account/invoice/service information.', 'invoicing' ) . '</li>' . |
|
46 | - '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' . |
|
47 | - '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' . |
|
48 | - '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
49 | - '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' . |
|
50 | - '<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>' . |
|
51 | - '</ul>' . |
|
52 | - '<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>' . |
|
53 | - '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' . |
|
54 | - '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' . |
|
55 | - '<p class="privacy-policy-tutorial">' . __( '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>' . |
|
56 | - '<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>' . |
|
57 | - '<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>' . |
|
58 | - '</div>'; |
|
40 | + '<h2>' . __( 'Invoices and checkout', 'invoicing' ) . '</h2>' . |
|
41 | + '<p class="privacy-policy-tutorial">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' . |
|
42 | + '<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>' . |
|
43 | + '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' . |
|
44 | + '<ul>' . |
|
45 | + '<li>' . __( '- Send you important account/invoice/service information.', 'invoicing' ) . '</li>' . |
|
46 | + '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' . |
|
47 | + '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' . |
|
48 | + '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
49 | + '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' . |
|
50 | + '<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>' . |
|
51 | + '</ul>' . |
|
52 | + '<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>' . |
|
53 | + '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' . |
|
54 | + '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' . |
|
55 | + '<p class="privacy-policy-tutorial">' . __( '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>' . |
|
56 | + '<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>' . |
|
57 | + '<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>' . |
|
58 | + '</div>'; |
|
59 | 59 | |
60 | 60 | return apply_filters( 'wpinv_privacy_policy_content', $content ); |
61 | 61 | } |
@@ -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. |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $this->init(); |
27 | 27 | |
28 | 28 | // This hook registers Invoicing data exporters. |
29 | - $this->add_exporter( 'wpinv-customer-invoices', __( 'Customer Invoices', 'invoicing' ), array( 'WPInv_Privacy_Exporters', 'customer_invoice_data_exporter' ) ); |
|
29 | + $this->add_exporter('wpinv-customer-invoices', __('Customer Invoices', 'invoicing'), array('WPInv_Privacy_Exporters', 'customer_invoice_data_exporter')); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -37,27 +37,27 @@ discard block |
||
37 | 37 | public function get_privacy_message() { |
38 | 38 | |
39 | 39 | $content = '<div class="wp-suggested-text">' . |
40 | - '<h2>' . __( 'Invoices and checkout', 'invoicing' ) . '</h2>' . |
|
41 | - '<p class="privacy-policy-tutorial">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' . |
|
42 | - '<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>' . |
|
43 | - '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' . |
|
40 | + '<h2>' . __('Invoices and checkout', 'invoicing') . '</h2>' . |
|
41 | + '<p class="privacy-policy-tutorial">' . __('Example privacy texts.', 'invoicing') . '</p>' . |
|
42 | + '<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>' . |
|
43 | + '<p>' . __('Handling this data also allows us to:', 'invoicing') . '</p>' . |
|
44 | 44 | '<ul>' . |
45 | - '<li>' . __( '- Send you important account/invoice/service information.', 'invoicing' ) . '</li>' . |
|
46 | - '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' . |
|
47 | - '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' . |
|
48 | - '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' . |
|
49 | - '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' . |
|
50 | - '<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>' . |
|
45 | + '<li>' . __('- Send you important account/invoice/service information.', 'invoicing') . '</li>' . |
|
46 | + '<li>' . __('- Estimate taxes based on your location.', 'invoicing') . '</li>' . |
|
47 | + '<li>' . __('- Respond to your queries or complaints.', 'invoicing') . '</li>' . |
|
48 | + '<li>' . __('- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing') . '</li>' . |
|
49 | + '<li>' . __('- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing') . '</li>' . |
|
50 | + '<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>' . |
|
51 | 51 | '</ul>' . |
52 | - '<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>' . |
|
53 | - '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' . |
|
54 | - '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' . |
|
55 | - '<p class="privacy-policy-tutorial">' . __( '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>' . |
|
56 | - '<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>' . |
|
57 | - '<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>' . |
|
52 | + '<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>' . |
|
53 | + '<h2>' . __('What we share with others', 'invoicing') . '</h2>' . |
|
54 | + '<p>' . __('We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing') . '</p>' . |
|
55 | + '<p class="privacy-policy-tutorial">' . __('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>' . |
|
56 | + '<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>' . |
|
57 | + '<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>' . |
|
58 | 58 | '</div>'; |
59 | 59 | |
60 | - return apply_filters( 'wpinv_privacy_policy_content', $content ); |
|
60 | + return apply_filters('wpinv_privacy_policy_content', $content); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | } |