@@ -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_Report_Items Class. |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | * Retrieves the earning sql. |
17 | 17 | * |
18 | 18 | */ |
19 | - public function get_sql( $range ) { |
|
19 | + public function get_sql($range) { |
|
20 | 20 | global $wpdb; |
21 | 21 | |
22 | 22 | $table = $wpdb->prefix . 'getpaid_invoices'; |
23 | - $clauses = $this->get_range_sql( $range ); |
|
23 | + $clauses = $this->get_range_sql($range); |
|
24 | 24 | |
25 | 25 | $sql = "SELECT |
26 | 26 | meta.gateway AS gateway, |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | ORDER BY total DESC |
36 | 36 | "; |
37 | 37 | |
38 | - return apply_filters( 'getpaid_gateways_graphs_get_sql', $sql, $range ); |
|
38 | + return apply_filters('getpaid_gateways_graphs_get_sql', $sql, $range); |
|
39 | 39 | |
40 | 40 | } |
41 | 41 | |
@@ -45,30 +45,30 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function prepare_stats() { |
47 | 47 | global $wpdb; |
48 | - $this->stats = $wpdb->get_results( $this->get_sql( $this->get_range() ) ); |
|
49 | - $this->stats = $this->normalize_stats( $this->stats ); |
|
48 | + $this->stats = $wpdb->get_results($this->get_sql($this->get_range())); |
|
49 | + $this->stats = $this->normalize_stats($this->stats); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Normalizes the report stats. |
54 | 54 | * |
55 | 55 | */ |
56 | - public function normalize_stats( $stats ) { |
|
56 | + public function normalize_stats($stats) { |
|
57 | 57 | $normalized = array(); |
58 | 58 | $others = 0; |
59 | 59 | $did = 0; |
60 | 60 | |
61 | - foreach ( $stats as $stat ) { |
|
61 | + foreach ($stats as $stat) { |
|
62 | 62 | |
63 | - if ( $did > 4 ) { |
|
63 | + if ($did > 4) { |
|
64 | 64 | |
65 | - $others += wpinv_round_amount( wpinv_sanitize_amount( $stat->total ) ); |
|
65 | + $others += wpinv_round_amount(wpinv_sanitize_amount($stat->total)); |
|
66 | 66 | |
67 | 67 | } else { |
68 | 68 | |
69 | 69 | $normalized[] = array( |
70 | - 'total' => wpinv_round_amount( wpinv_sanitize_amount( $stat->total ) ), |
|
71 | - 'gateway' => strip_tags( wpinv_get_gateway_admin_label( $stat->gateway ) ), |
|
70 | + 'total' => wpinv_round_amount(wpinv_sanitize_amount($stat->total)), |
|
71 | + 'gateway' => strip_tags(wpinv_get_gateway_admin_label($stat->gateway)), |
|
72 | 72 | ); |
73 | 73 | |
74 | 74 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | $did++; |
77 | 77 | } |
78 | 78 | |
79 | - if ( $others > 0 ) { |
|
79 | + if ($others > 0) { |
|
80 | 80 | |
81 | 81 | $normalized[] = array( |
82 | - 'total' => wpinv_round_amount( wpinv_sanitize_amount( $others ) ), |
|
83 | - 'gateway' => esc_html__( 'Others', 'invoicing' ), |
|
82 | + 'total' => wpinv_round_amount(wpinv_sanitize_amount($others)), |
|
83 | + 'gateway' => esc_html__('Others', 'invoicing'), |
|
84 | 84 | ); |
85 | 85 | |
86 | 86 | } |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function get_data() { |
96 | 96 | |
97 | - $data = wp_list_pluck( $this->stats, 'total' ); |
|
98 | - $colors = array( '#009688','#4caf50','#8bc34a','#00bcd4','#03a9f4','#2196f3' ); |
|
97 | + $data = wp_list_pluck($this->stats, 'total'); |
|
98 | + $colors = array('#009688', '#4caf50', '#8bc34a', '#00bcd4', '#03a9f4', '#2196f3'); |
|
99 | 99 | |
100 | - shuffle( $colors ); |
|
100 | + shuffle($colors); |
|
101 | 101 | |
102 | 102 | return array( |
103 | 103 | 'data' => $data, |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | */ |
113 | 113 | public function get_labels() { |
114 | - return wp_list_pluck( $this->stats, 'gateway' ); |
|
114 | + return wp_list_pluck($this->stats, 'gateway'); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | { |
133 | 133 | type: 'doughnut', |
134 | 134 | data: { |
135 | - 'labels': <?php echo wp_json_encode( $this->get_labels() ); ?>, |
|
136 | - 'datasets': [ <?php echo wp_json_encode( $this->get_data() ); ?> ] |
|
135 | + 'labels': <?php echo wp_json_encode($this->get_labels()); ?>, |
|
136 | + 'datasets': [ <?php echo wp_json_encode($this->get_data()); ?> ] |
|
137 | 137 | }, |
138 | 138 | options: { |
139 | 139 | legend: { |
@@ -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_Report_Discounts Class. |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | * Retrieves the discounts sql. |
17 | 17 | * |
18 | 18 | */ |
19 | - public function get_sql( $range ) { |
|
19 | + public function get_sql($range) { |
|
20 | 20 | global $wpdb; |
21 | 21 | |
22 | 22 | $table = $wpdb->prefix . 'getpaid_invoices'; |
23 | - $clauses = $this->get_range_sql( $range ); |
|
23 | + $clauses = $this->get_range_sql($range); |
|
24 | 24 | |
25 | 25 | $sql = "SELECT |
26 | 26 | meta.discount_code AS discount_code, |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | ORDER BY total DESC |
37 | 37 | "; |
38 | 38 | |
39 | - return apply_filters( 'getpaid_discounts_graphs_get_sql', $sql, $range ); |
|
39 | + return apply_filters('getpaid_discounts_graphs_get_sql', $sql, $range); |
|
40 | 40 | |
41 | 41 | } |
42 | 42 | |
@@ -46,30 +46,30 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function prepare_stats() { |
48 | 48 | global $wpdb; |
49 | - $this->stats = $wpdb->get_results( $this->get_sql( $this->get_range() ) ); |
|
50 | - $this->stats = $this->normalize_stats( $this->stats ); |
|
49 | + $this->stats = $wpdb->get_results($this->get_sql($this->get_range())); |
|
50 | + $this->stats = $this->normalize_stats($this->stats); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Normalizes the report stats. |
55 | 55 | * |
56 | 56 | */ |
57 | - public function normalize_stats( $stats ) { |
|
57 | + public function normalize_stats($stats) { |
|
58 | 58 | $normalized = array(); |
59 | 59 | $others = 0; |
60 | 60 | $did = 0; |
61 | 61 | |
62 | - foreach ( $stats as $stat ) { |
|
62 | + foreach ($stats as $stat) { |
|
63 | 63 | |
64 | - if ( $did > 4 ) { |
|
64 | + if ($did > 4) { |
|
65 | 65 | |
66 | - $others += wpinv_round_amount( wpinv_sanitize_amount( $stat->total ) ); |
|
66 | + $others += wpinv_round_amount(wpinv_sanitize_amount($stat->total)); |
|
67 | 67 | |
68 | 68 | } else { |
69 | 69 | |
70 | 70 | $normalized[] = array( |
71 | - 'total' => wpinv_round_amount( wpinv_sanitize_amount( $stat->total ) ), |
|
72 | - 'discount_code' => strip_tags( $stat->discount_code ), |
|
71 | + 'total' => wpinv_round_amount(wpinv_sanitize_amount($stat->total)), |
|
72 | + 'discount_code' => strip_tags($stat->discount_code), |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | } |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | $did++; |
78 | 78 | } |
79 | 79 | |
80 | - if ( $others > 0 ) { |
|
80 | + if ($others > 0) { |
|
81 | 81 | |
82 | 82 | $normalized[] = array( |
83 | - 'total' => wpinv_round_amount( wpinv_sanitize_amount( $others ) ), |
|
84 | - 'discount_code' => esc_html__( 'Others', 'invoicing' ), |
|
83 | + 'total' => wpinv_round_amount(wpinv_sanitize_amount($others)), |
|
84 | + 'discount_code' => esc_html__('Others', 'invoicing'), |
|
85 | 85 | ); |
86 | 86 | |
87 | 87 | } |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function get_data() { |
97 | 97 | |
98 | - $data = wp_list_pluck( $this->stats, 'total' ); |
|
99 | - $colors = array( '#009688','#4caf50','#8bc34a','#00bcd4','#03a9f4','#2196f3' ); |
|
98 | + $data = wp_list_pluck($this->stats, 'total'); |
|
99 | + $colors = array('#009688', '#4caf50', '#8bc34a', '#00bcd4', '#03a9f4', '#2196f3'); |
|
100 | 100 | |
101 | - shuffle( $colors ); |
|
101 | + shuffle($colors); |
|
102 | 102 | |
103 | 103 | return array( |
104 | 104 | 'data' => $data, |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * |
113 | 113 | */ |
114 | 114 | public function get_labels() { |
115 | - return wp_list_pluck( $this->stats, 'discount_code' ); |
|
115 | + return wp_list_pluck($this->stats, 'discount_code'); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | { |
134 | 134 | type: 'doughnut', |
135 | 135 | data: { |
136 | - 'labels': <?php echo wp_json_encode( $this->get_labels() ); ?>, |
|
137 | - 'datasets': [ <?php echo wp_json_encode( $this->get_data() ); ?> ] |
|
136 | + 'labels': <?php echo wp_json_encode($this->get_labels()); ?>, |
|
137 | + 'datasets': [ <?php echo wp_json_encode($this->get_data()); ?> ] |
|
138 | 138 | }, |
139 | 139 | options: { |
140 | 140 | legend: { |
@@ -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_Report_Items Class. |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | * Retrieves the earning sql. |
17 | 17 | * |
18 | 18 | */ |
19 | - public function get_sql( $range ) { |
|
19 | + public function get_sql($range) { |
|
20 | 20 | global $wpdb; |
21 | 21 | |
22 | 22 | $table = $wpdb->prefix . 'getpaid_invoices'; |
23 | 23 | $table2 = $wpdb->prefix . 'getpaid_invoice_items'; |
24 | - $clauses = $this->get_range_sql( $range ); |
|
24 | + $clauses = $this->get_range_sql($range); |
|
25 | 25 | |
26 | 26 | $sql = "SELECT |
27 | 27 | item.item_name AS item_name, |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ORDER BY total DESC |
39 | 39 | "; |
40 | 40 | |
41 | - return apply_filters( 'getpaid_items_graphs_get_sql', $sql, $range ); |
|
41 | + return apply_filters('getpaid_items_graphs_get_sql', $sql, $range); |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
@@ -48,30 +48,30 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function prepare_stats() { |
50 | 50 | global $wpdb; |
51 | - $this->stats = $wpdb->get_results( $this->get_sql( $this->get_range() ) ); |
|
52 | - $this->stats = $this->normalize_stats( $this->stats ); |
|
51 | + $this->stats = $wpdb->get_results($this->get_sql($this->get_range())); |
|
52 | + $this->stats = $this->normalize_stats($this->stats); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Normalizes the report stats. |
57 | 57 | * |
58 | 58 | */ |
59 | - public function normalize_stats( $stats ) { |
|
59 | + public function normalize_stats($stats) { |
|
60 | 60 | $normalized = array(); |
61 | 61 | $others = 0; |
62 | 62 | $did = 0; |
63 | 63 | |
64 | - foreach ( $stats as $stat ) { |
|
64 | + foreach ($stats as $stat) { |
|
65 | 65 | |
66 | - if ( $did > 4 ) { |
|
66 | + if ($did > 4) { |
|
67 | 67 | |
68 | - $others += wpinv_round_amount( wpinv_sanitize_amount( $stat->total ) ); |
|
68 | + $others += wpinv_round_amount(wpinv_sanitize_amount($stat->total)); |
|
69 | 69 | |
70 | 70 | } else { |
71 | 71 | |
72 | 72 | $normalized[] = array( |
73 | - 'total' => wpinv_round_amount( wpinv_sanitize_amount( $stat->total ) ), |
|
74 | - 'item_name' => strip_tags( $stat->item_name ), |
|
73 | + 'total' => wpinv_round_amount(wpinv_sanitize_amount($stat->total)), |
|
74 | + 'item_name' => strip_tags($stat->item_name), |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | } |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | $did++; |
80 | 80 | } |
81 | 81 | |
82 | - if ( $others > 0 ) { |
|
82 | + if ($others > 0) { |
|
83 | 83 | |
84 | 84 | $normalized[] = array( |
85 | - 'total' => wpinv_round_amount( wpinv_sanitize_amount( $others ) ), |
|
86 | - 'item_name' => esc_html__( 'Others', 'invoicing' ), |
|
85 | + 'total' => wpinv_round_amount(wpinv_sanitize_amount($others)), |
|
86 | + 'item_name' => esc_html__('Others', 'invoicing'), |
|
87 | 87 | ); |
88 | 88 | |
89 | 89 | } |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function get_data() { |
99 | 99 | |
100 | - $data = wp_list_pluck( $this->stats, 'total' ); |
|
101 | - $colors = array( '#009688','#4caf50','#8bc34a','#00bcd4','#03a9f4','#2196f3' ); |
|
100 | + $data = wp_list_pluck($this->stats, 'total'); |
|
101 | + $colors = array('#009688', '#4caf50', '#8bc34a', '#00bcd4', '#03a9f4', '#2196f3'); |
|
102 | 102 | |
103 | - shuffle( $colors ); |
|
103 | + shuffle($colors); |
|
104 | 104 | |
105 | 105 | return array( |
106 | 106 | 'data' => $data, |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | */ |
116 | 116 | public function get_labels() { |
117 | - return wp_list_pluck( $this->stats, 'item_name' ); |
|
117 | + return wp_list_pluck($this->stats, 'item_name'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | { |
136 | 136 | type: 'doughnut', |
137 | 137 | data: { |
138 | - 'labels': <?php echo wp_json_encode( $this->get_labels() ); ?>, |
|
139 | - 'datasets': [ <?php echo wp_json_encode( $this->get_data() ); ?> ] |
|
138 | + 'labels': <?php echo wp_json_encode($this->get_labels()); ?>, |
|
139 | + 'datasets': [ <?php echo wp_json_encode($this->get_data()); ?> ] |
|
140 | 140 | }, |
141 | 141 | options: { |
142 | 142 | legend: { |
@@ -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_Graph_Downloader Class. |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return GetPaid_Reports_Report_Items|GetPaid_Reports_Report_Gateways|GetPaid_Reports_Report_Discounts |
32 | 32 | */ |
33 | - public function prepare_handler( $graph ) { |
|
33 | + public function prepare_handler($graph) { |
|
34 | 34 | |
35 | - if ( empty( $this->handler->views[ $graph ] ) ) { |
|
36 | - wp_die( __( 'Invalid Graph', 'invoicing' ), 400 ); |
|
35 | + if (empty($this->handler->views[$graph])) { |
|
36 | + wp_die(__('Invalid Graph', 'invoicing'), 400); |
|
37 | 37 | } |
38 | 38 | |
39 | - return new $this->handler->views[ $graph ]['class'](); |
|
39 | + return new $this->handler->views[$graph]['class'](); |
|
40 | 40 | |
41 | 41 | } |
42 | 42 | |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function prepare_output() { |
49 | 49 | |
50 | - $output = fopen( 'php://output', 'w' ); |
|
50 | + $output = fopen('php://output', 'w'); |
|
51 | 51 | |
52 | - if ( false === $output ) { |
|
53 | - wp_die( __( 'Unsupported server', 'invoicing' ), 500 ); |
|
52 | + if (false === $output) { |
|
53 | + wp_die(__('Unsupported server', 'invoicing'), 500); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | return $output; |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return string |
63 | 63 | */ |
64 | - public function prepare_file_type( $graph ) { |
|
64 | + public function prepare_file_type($graph) { |
|
65 | 65 | |
66 | - $file_type = empty( $_REQUEST['file_type'] ) ? 'csv' : sanitize_text_field( $_REQUEST['file_type'] ); |
|
67 | - $file_name = wpinv_sanitize_key( "getpaid-$graph-" . current_time( 'Y-m-d' ) ); |
|
66 | + $file_type = empty($_REQUEST['file_type']) ? 'csv' : sanitize_text_field($_REQUEST['file_type']); |
|
67 | + $file_name = wpinv_sanitize_key("getpaid-$graph-" . current_time('Y-m-d')); |
|
68 | 68 | |
69 | - header( "Content-Type:application/$file_type" ); |
|
70 | - header( "Content-Disposition:attachment;filename=$file_name.$file_type" ); |
|
69 | + header("Content-Type:application/$file_type"); |
|
70 | + header("Content-Disposition:attachment;filename=$file_name.$file_type"); |
|
71 | 71 | |
72 | 72 | return $file_type; |
73 | 73 | } |
@@ -76,24 +76,24 @@ discard block |
||
76 | 76 | * Handles the actual download. |
77 | 77 | * |
78 | 78 | */ |
79 | - public function download( $graph ) { |
|
79 | + public function download($graph) { |
|
80 | 80 | global $wpdb; |
81 | 81 | |
82 | - $handler = $this->prepare_handler( $graph ); |
|
82 | + $handler = $this->prepare_handler($graph); |
|
83 | 83 | $stream = $this->prepare_output(); |
84 | - $stats = $wpdb->get_results( $handler->get_sql( $handler->get_range() ) ); |
|
85 | - $headers = array( $handler->field, 'total', 'total_raw' ); |
|
86 | - $file_type = $this->prepare_file_type( $graph ); |
|
87 | - |
|
88 | - if ( 'csv' == $file_type ) { |
|
89 | - $this->download_csv( $stats, $stream, $headers ); |
|
90 | - } else if( 'xml' == $file_type ) { |
|
91 | - $this->download_xml( $stats, $stream, $headers ); |
|
84 | + $stats = $wpdb->get_results($handler->get_sql($handler->get_range())); |
|
85 | + $headers = array($handler->field, 'total', 'total_raw'); |
|
86 | + $file_type = $this->prepare_file_type($graph); |
|
87 | + |
|
88 | + if ('csv' == $file_type) { |
|
89 | + $this->download_csv($stats, $stream, $headers); |
|
90 | + } else if ('xml' == $file_type) { |
|
91 | + $this->download_xml($stats, $stream, $headers); |
|
92 | 92 | } else { |
93 | - $this->download_json( $stats, $stream, $headers ); |
|
93 | + $this->download_json($stats, $stream, $headers); |
|
94 | 94 | } |
95 | 95 | |
96 | - fclose( $stream ); |
|
96 | + fclose($stream); |
|
97 | 97 | exit; |
98 | 98 | } |
99 | 99 | |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | * @param array $headers The fields to stream. |
106 | 106 | * @since 1.0.19 |
107 | 107 | */ |
108 | - public function download_csv( $stats, $stream, $headers ) { |
|
108 | + public function download_csv($stats, $stream, $headers) { |
|
109 | 109 | |
110 | 110 | // Output the csv column headers. |
111 | - fputcsv( $stream, $headers ); |
|
111 | + fputcsv($stream, $headers); |
|
112 | 112 | |
113 | 113 | // Loop through |
114 | - foreach ( $stats as $stat ) { |
|
115 | - $row = array_values( $this->prepare_row( $stat, $headers ) ); |
|
116 | - $row = array_map( 'maybe_serialize', $row ); |
|
117 | - fputcsv( $stream, $row ); |
|
114 | + foreach ($stats as $stat) { |
|
115 | + $row = array_values($this->prepare_row($stat, $headers)); |
|
116 | + $row = array_map('maybe_serialize', $row); |
|
117 | + fputcsv($stream, $row); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | } |
@@ -127,16 +127,16 @@ discard block |
||
127 | 127 | * @param array $headers The fields to stream. |
128 | 128 | * @since 1.0.19 |
129 | 129 | */ |
130 | - public function download_json( $stats, $stream, $headers ) { |
|
130 | + public function download_json($stats, $stream, $headers) { |
|
131 | 131 | |
132 | 132 | $prepared = array(); |
133 | 133 | |
134 | 134 | // Loop through |
135 | - foreach ( $stats as $stat ) { |
|
136 | - $prepared[] = $this->prepare_row( $stat, $headers ); |
|
135 | + foreach ($stats as $stat) { |
|
136 | + $prepared[] = $this->prepare_row($stat, $headers); |
|
137 | 137 | } |
138 | 138 | |
139 | - fwrite( $stream, wp_json_encode( $prepared ) ); |
|
139 | + fwrite($stream, wp_json_encode($prepared)); |
|
140 | 140 | |
141 | 141 | } |
142 | 142 | |
@@ -148,19 +148,19 @@ discard block |
||
148 | 148 | * @param array $headers The fields to stream. |
149 | 149 | * @since 1.0.19 |
150 | 150 | */ |
151 | - public function download_xml( $stats, $stream, $headers ) { |
|
151 | + public function download_xml($stats, $stream, $headers) { |
|
152 | 152 | |
153 | 153 | $prepared = array(); |
154 | 154 | |
155 | 155 | // Loop through |
156 | - foreach ( $stats as $stat ) { |
|
157 | - $prepared[] = $this->prepare_row( $stat, $headers ); |
|
156 | + foreach ($stats as $stat) { |
|
157 | + $prepared[] = $this->prepare_row($stat, $headers); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $xml = new SimpleXMLElement('<?xml version="1.0"?><data></data>'); |
161 | - $this->convert_array_xml( $prepared, $xml ); |
|
161 | + $this->convert_array_xml($prepared, $xml); |
|
162 | 162 | |
163 | - fwrite( $stream, $xml->asXML() ); |
|
163 | + fwrite($stream, $xml->asXML()); |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | |
@@ -170,24 +170,24 @@ discard block |
||
170 | 170 | * @access public |
171 | 171 | * @since 1.0.19 |
172 | 172 | */ |
173 | - public function convert_array_xml( $data, $xml ) { |
|
173 | + public function convert_array_xml($data, $xml) { |
|
174 | 174 | |
175 | 175 | // Loop through |
176 | - foreach ( $data as $key => $value ) { |
|
176 | + foreach ($data as $key => $value) { |
|
177 | 177 | |
178 | - $key = preg_replace( "/[^A-Za-z0-9_\-]/", '', $key ); |
|
178 | + $key = preg_replace("/[^A-Za-z0-9_\-]/", '', $key); |
|
179 | 179 | |
180 | - if ( is_array( $value ) ) { |
|
180 | + if (is_array($value)) { |
|
181 | 181 | |
182 | - if ( is_numeric( $key ) ){ |
|
183 | - $key = 'item'.$key; //dealing with <0/>..<n/> issues |
|
182 | + if (is_numeric($key)) { |
|
183 | + $key = 'item' . $key; //dealing with <0/>..<n/> issues |
|
184 | 184 | } |
185 | 185 | |
186 | - $subnode = $xml->addChild( $key ); |
|
187 | - $this->convert_array_xml( $value, $subnode ); |
|
186 | + $subnode = $xml->addChild($key); |
|
187 | + $this->convert_array_xml($value, $subnode); |
|
188 | 188 | |
189 | 189 | } else { |
190 | - $xml->addChild( $key, htmlspecialchars( $value ) ); |
|
190 | + $xml->addChild($key, htmlspecialchars($value)); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | } |
@@ -202,24 +202,24 @@ discard block |
||
202 | 202 | * @since 1.0.19 |
203 | 203 | * @return array |
204 | 204 | */ |
205 | - public function prepare_row( $row, $fields ) { |
|
205 | + public function prepare_row($row, $fields) { |
|
206 | 206 | |
207 | 207 | $prepared = array(); |
208 | 208 | $row = (array) $row; |
209 | 209 | |
210 | - foreach ( $fields as $field ) { |
|
210 | + foreach ($fields as $field) { |
|
211 | 211 | |
212 | - if ( $field === 'total' ) { |
|
213 | - $prepared[ $field ] = html_entity_decode( strip_tags( wpinv_price( $row['total'] ) ), ENT_QUOTES ); |
|
212 | + if ($field === 'total') { |
|
213 | + $prepared[$field] = html_entity_decode(strip_tags(wpinv_price($row['total'])), ENT_QUOTES); |
|
214 | 214 | continue; |
215 | 215 | } |
216 | 216 | |
217 | - if ( $field === 'total_raw' ) { |
|
218 | - $prepared[ $field ] = wpinv_round_amount( wpinv_sanitize_amount( $row['total'] ) ); |
|
217 | + if ($field === 'total_raw') { |
|
218 | + $prepared[$field] = wpinv_round_amount(wpinv_sanitize_amount($row['total'])); |
|
219 | 219 | continue; |
220 | 220 | } |
221 | 221 | |
222 | - $prepared[ $field ] = strip_tags( $row[ $field ] ); |
|
222 | + $prepared[$field] = strip_tags($row[$field]); |
|
223 | 223 | |
224 | 224 | } |
225 | 225 |
@@ -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 | echo "</div>"; |
26 | 26 | |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * Retrieves the download url. |
31 | 31 | * |
32 | 32 | */ |
33 | - public function get_download_url( $post_type ) { |
|
33 | + public function get_download_url($post_type) { |
|
34 | 34 | |
35 | 35 | return wp_nonce_url( |
36 | 36 | add_query_arg( |
37 | 37 | array( |
38 | 38 | 'getpaid-admin-action' => 'export_invoices', |
39 | - 'post_type' => urlencode( $post_type ), |
|
39 | + 'post_type' => urlencode($post_type), |
|
40 | 40 | ) |
41 | 41 | ), |
42 | 42 | 'getpaid-nonce', |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * Displays a single post type export card. |
50 | 50 | * |
51 | 51 | */ |
52 | - public function display_post_type_export( $post_type ) { |
|
52 | + public function display_post_type_export($post_type) { |
|
53 | 53 | |
54 | 54 | ?> |
55 | 55 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | <strong> |
61 | 61 | <?php |
62 | 62 | printf( |
63 | - __( 'Export %s', 'invoicing' ), |
|
64 | - sanitize_text_field( getpaid_get_post_type_label( $post_type ) ) |
|
63 | + __('Export %s', 'invoicing'), |
|
64 | + sanitize_text_field(getpaid_get_post_type_label($post_type)) |
|
65 | 65 | ); |
66 | 66 | ?> |
67 | 67 | </strong> |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | |
70 | 70 | <div class="card-body"> |
71 | 71 | |
72 | - <form method="post" action="<?php echo esc_url( $this->get_download_url( $post_type ) ); ?>"> |
|
72 | + <form method="post" action="<?php echo esc_url($this->get_download_url($post_type)); ?>"> |
|
73 | 73 | |
74 | 74 | <?php |
75 | - $this->display_markup( $this->generate_from_date( $post_type ) ); |
|
76 | - $this->display_markup( $this->generate_to_date( $post_type ) ); |
|
77 | - $this->display_markup( $this->generate_post_status_select( $post_type ) ); |
|
78 | - $this->display_markup( $this->generate_file_type_select( $post_type ) ); |
|
79 | - submit_button( __( 'Download', 'invoicing' ) ); |
|
75 | + $this->display_markup($this->generate_from_date($post_type)); |
|
76 | + $this->display_markup($this->generate_to_date($post_type)); |
|
77 | + $this->display_markup($this->generate_post_status_select($post_type)); |
|
78 | + $this->display_markup($this->generate_file_type_select($post_type)); |
|
79 | + submit_button(__('Download', 'invoicing')); |
|
80 | 80 | ?> |
81 | 81 | |
82 | 82 | </form> |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | * Generates the from date input field. |
95 | 95 | * |
96 | 96 | */ |
97 | - public function generate_from_date( $post_type ) { |
|
97 | + public function generate_from_date($post_type) { |
|
98 | 98 | |
99 | 99 | return aui()->input( |
100 | 100 | array( |
101 | 101 | 'name' => 'from_date', |
102 | - 'id' => esc_attr( "$post_type-from_date" ), |
|
102 | + 'id' => esc_attr("$post_type-from_date"), |
|
103 | 103 | 'placeholder'=> 'yy-mm-dd', |
104 | - 'label' => __( 'From Date', 'invoicing' ), |
|
104 | + 'label' => __('From Date', 'invoicing'), |
|
105 | 105 | 'label_type' => 'vertical', |
106 | 106 | 'label_class' => 'd-block', |
107 | 107 | 'type' => 'datepicker', |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | * Generates the to date input field. |
115 | 115 | * |
116 | 116 | */ |
117 | - public function generate_to_date( $post_type ) { |
|
117 | + public function generate_to_date($post_type) { |
|
118 | 118 | |
119 | 119 | return aui()->input( |
120 | 120 | array( |
121 | 121 | 'name' => 'to_date', |
122 | - 'id' => esc_attr( "$post_type-to_date" ), |
|
122 | + 'id' => esc_attr("$post_type-to_date"), |
|
123 | 123 | 'placeholder'=> 'yy-mm-dd', |
124 | - 'label' => __( 'To Date', 'invoicing' ), |
|
124 | + 'label' => __('To Date', 'invoicing'), |
|
125 | 125 | 'label_type' => 'vertical', |
126 | 126 | 'label_class' => 'd-block', |
127 | 127 | 'type' => 'datepicker', |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | * Generates the to post status select field. |
135 | 135 | * |
136 | 136 | */ |
137 | - public function generate_post_status_select( $post_type ) { |
|
137 | + public function generate_post_status_select($post_type) { |
|
138 | 138 | |
139 | 139 | return aui()->select( |
140 | 140 | array( |
141 | 141 | 'name' => 'status', |
142 | - 'id' => esc_attr( "$post_type-status" ), |
|
143 | - 'placeholder' => __( 'All Statuses', 'invoicing' ), |
|
144 | - 'label' => __( 'Status', 'invoicing' ), |
|
142 | + 'id' => esc_attr("$post_type-status"), |
|
143 | + 'placeholder' => __('All Statuses', 'invoicing'), |
|
144 | + 'label' => __('Status', 'invoicing'), |
|
145 | 145 | 'label_type' => 'vertical', |
146 | 146 | 'label_class' => 'd-block', |
147 | - 'options' => wpinv_get_invoice_statuses( true, false, $post_type ), |
|
147 | + 'options' => wpinv_get_invoice_statuses(true, false, $post_type), |
|
148 | 148 | ) |
149 | 149 | ); |
150 | 150 | |
@@ -154,20 +154,20 @@ discard block |
||
154 | 154 | * Generates the to file type select field. |
155 | 155 | * |
156 | 156 | */ |
157 | - public function generate_file_type_select( $post_type ) { |
|
157 | + public function generate_file_type_select($post_type) { |
|
158 | 158 | |
159 | 159 | return aui()->select( |
160 | 160 | array( |
161 | 161 | 'name' => 'file_type', |
162 | - 'id' => esc_attr( "$post_type-file_type" ), |
|
163 | - 'placeholder' => __( 'Select File Type', 'invoicing' ), |
|
164 | - 'label' => __( 'Export File', 'invoicing' ), |
|
162 | + 'id' => esc_attr("$post_type-file_type"), |
|
163 | + 'placeholder' => __('Select File Type', 'invoicing'), |
|
164 | + 'label' => __('Export File', 'invoicing'), |
|
165 | 165 | 'label_type' => 'vertical', |
166 | 166 | 'label_class' => 'd-block', |
167 | 167 | 'options' => array( |
168 | - 'csv' => __( 'CSV', 'invoicing' ), |
|
169 | - 'xml' => __( 'XML', 'invoicing' ), |
|
170 | - 'json' => __( 'JSON', 'invoicing' ), |
|
168 | + 'csv' => __('CSV', 'invoicing'), |
|
169 | + 'xml' => __('XML', 'invoicing'), |
|
170 | + 'json' => __('JSON', 'invoicing'), |
|
171 | 171 | ), |
172 | 172 | ) |
173 | 173 | ); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * Displays a field's markup. |
179 | 179 | * |
180 | 180 | */ |
181 | - public function display_markup( $markup ) { |
|
181 | + public function display_markup($markup) { |
|
182 | 182 | |
183 | 183 | echo str_replace( |
184 | 184 | array( |
@@ -7,20 +7,20 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$class = empty( $class ) ? 'btn-primary' : sanitize_html_class( $class ); |
|
13 | -$label = empty( $label ) ? esc_attr__( 'Pay %price% »', 'invoicing' ) : esc_attr( $label ); |
|
14 | -$free = empty( $free ) ? esc_attr__( 'Continue »', 'invoicing' ) : esc_attr( $free ); |
|
12 | +$class = empty($class) ? 'btn-primary' : sanitize_html_class($class); |
|
13 | +$label = empty($label) ? esc_attr__('Pay %price% »', 'invoicing') : esc_attr($label); |
|
14 | +$free = empty($free) ? esc_attr__('Continue »', 'invoicing') : esc_attr($free); |
|
15 | 15 | |
16 | -do_action( 'getpaid_before_payment_form_pay_button', $form ); |
|
16 | +do_action('getpaid_before_payment_form_pay_button', $form); |
|
17 | 17 | |
18 | 18 | echo aui()->input( |
19 | 19 | array( |
20 | - 'name' => esc_attr( $id ), |
|
21 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
20 | + 'name' => esc_attr($id), |
|
21 | + 'id' => esc_attr($id) . uniqid('_'), |
|
22 | 22 | 'value' => $label, |
23 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
23 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
24 | 24 | 'type' => 'submit', |
25 | 25 | 'class' => 'getpaid-payment-form-submit btn btn-block submit-button ' . $class, |
26 | 26 | 'extra_attributes' => array( |
@@ -30,4 +30,4 @@ discard block |
||
30 | 30 | ) |
31 | 31 | ); |
32 | 32 | |
33 | -do_action( 'getpaid_after_payment_form_pay_button', $form ); |
|
34 | 33 | \ No newline at end of file |
34 | +do_action('getpaid_after_payment_form_pay_button', $form); |
|
35 | 35 | \ No newline at end of file |
@@ -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_Invoice_Exporter Class. |
@@ -19,33 +19,33 @@ discard block |
||
19 | 19 | * @param array $args Args to search for. |
20 | 20 | * @return array |
21 | 21 | */ |
22 | - public function get_invoice_query_args( $post_type, $args ) { |
|
22 | + public function get_invoice_query_args($post_type, $args) { |
|
23 | 23 | |
24 | 24 | $query_args = array( |
25 | 25 | 'post_type' => $post_type, |
26 | - 'post_status' => array_keys( wpinv_get_invoice_statuses( true, false, $post_type ) ), |
|
26 | + 'post_status' => array_keys(wpinv_get_invoice_statuses(true, false, $post_type)), |
|
27 | 27 | 'posts_per_page' => -1, |
28 | 28 | 'no_found_rows' => true, |
29 | 29 | 'update_post_term_cache' => false, |
30 | 30 | 'fields' => 'ids', |
31 | 31 | ); |
32 | 32 | |
33 | - if ( ! empty( $args['status'] ) && in_array( $args['status'], $query_args['post_status'], true ) ) { |
|
34 | - $query_args['post_status'] = wpinv_clean( wpinv_parse_list( $args['status'] ) ); |
|
33 | + if (!empty($args['status']) && in_array($args['status'], $query_args['post_status'], true)) { |
|
34 | + $query_args['post_status'] = wpinv_clean(wpinv_parse_list($args['status'])); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $date_query = array(); |
38 | - if ( ! empty( $args['to_date'] ) ) { |
|
39 | - $date_query['before'] = wpinv_clean( $args['to_date'] ); |
|
38 | + if (!empty($args['to_date'])) { |
|
39 | + $date_query['before'] = wpinv_clean($args['to_date']); |
|
40 | 40 | } |
41 | 41 | |
42 | - if ( ! empty( $args['from_date'] ) ) { |
|
43 | - $date_query['after'] = wpinv_clean( $args['from_date'] ); |
|
42 | + if (!empty($args['from_date'])) { |
|
43 | + $date_query['after'] = wpinv_clean($args['from_date']); |
|
44 | 44 | } |
45 | 45 | |
46 | - if ( ! empty( $date_query ) ) { |
|
46 | + if (!empty($date_query)) { |
|
47 | 47 | $date_query['inclusive'] = true; |
48 | - $query_args['date_query'] = array( $date_query ); |
|
48 | + $query_args['date_query'] = array($date_query); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $query_args; |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | * @param array $query_args WP_Query args. |
58 | 58 | * @return WPInv_Invoice[] |
59 | 59 | */ |
60 | - public function get_invoices( $query_args ) { |
|
60 | + public function get_invoices($query_args) { |
|
61 | 61 | |
62 | 62 | // Get invoices. |
63 | - $invoices = new WP_Query( $query_args ); |
|
63 | + $invoices = new WP_Query($query_args); |
|
64 | 64 | |
65 | 65 | // Prepare the results. |
66 | - return array_map( 'wpinv_get_invoice', $invoices->posts ); |
|
66 | + return array_map('wpinv_get_invoice', $invoices->posts); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | * Handles the actual download. |
72 | 72 | * |
73 | 73 | */ |
74 | - public function export( $post_type, $args ) { |
|
74 | + public function export($post_type, $args) { |
|
75 | 75 | |
76 | - $invoices = $this->get_invoices( $this->get_invoice_query_args( $post_type, $args ) ); |
|
76 | + $invoices = $this->get_invoices($this->get_invoice_query_args($post_type, $args)); |
|
77 | 77 | $stream = $this->prepare_output(); |
78 | - $headers = $this->get_export_fields( $post_type ); |
|
79 | - $file_type = $this->prepare_file_type( strtolower( getpaid_get_post_type_label( $post_type ) ) ); |
|
78 | + $headers = $this->get_export_fields($post_type); |
|
79 | + $file_type = $this->prepare_file_type(strtolower(getpaid_get_post_type_label($post_type))); |
|
80 | 80 | |
81 | - if ( 'csv' == $file_type ) { |
|
82 | - $this->download_csv( $invoices, $stream, $headers ); |
|
83 | - } else if( 'xml' == $file_type ) { |
|
84 | - $this->download_xml( $invoices, $stream, $headers ); |
|
81 | + if ('csv' == $file_type) { |
|
82 | + $this->download_csv($invoices, $stream, $headers); |
|
83 | + } else if ('xml' == $file_type) { |
|
84 | + $this->download_xml($invoices, $stream, $headers); |
|
85 | 85 | } else { |
86 | - $this->download_json( $invoices, $stream, $headers ); |
|
86 | + $this->download_json($invoices, $stream, $headers); |
|
87 | 87 | } |
88 | 88 | |
89 | - fclose( $stream ); |
|
89 | + fclose($stream); |
|
90 | 90 | exit; |
91 | 91 | } |
92 | 92 | |
@@ -98,25 +98,25 @@ discard block |
||
98 | 98 | * @since 1.0.19 |
99 | 99 | * @return array |
100 | 100 | */ |
101 | - public function prepare_row( $invoice, $fields ) { |
|
101 | + public function prepare_row($invoice, $fields) { |
|
102 | 102 | |
103 | 103 | $prepared = array(); |
104 | - $amount_fields = $this->get_amount_fields( $invoice->get_post_type() ); |
|
104 | + $amount_fields = $this->get_amount_fields($invoice->get_post_type()); |
|
105 | 105 | |
106 | - foreach ( $fields as $field ) { |
|
106 | + foreach ($fields as $field) { |
|
107 | 107 | |
108 | 108 | $value = ''; |
109 | 109 | $method = "get_$field"; |
110 | 110 | |
111 | - if ( method_exists( $invoice, $method ) ) { |
|
112 | - $value = $invoice->$method(); |
|
111 | + if (method_exists($invoice, $method)) { |
|
112 | + $value = $invoice->$method(); |
|
113 | 113 | } |
114 | 114 | |
115 | - if ( in_array( $field, $amount_fields ) ) { |
|
116 | - $value = wpinv_round_amount( wpinv_sanitize_amount( $value ) ); |
|
115 | + if (in_array($field, $amount_fields)) { |
|
116 | + $value = wpinv_round_amount(wpinv_sanitize_amount($value)); |
|
117 | 117 | } |
118 | 118 | |
119 | - $prepared[ $field ] = wpinv_clean( $value ); |
|
119 | + $prepared[$field] = wpinv_clean($value); |
|
120 | 120 | |
121 | 121 | } |
122 | 122 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @since 1.0.19 |
131 | 131 | * @return array |
132 | 132 | */ |
133 | - public function get_export_fields( $post_type ) { |
|
133 | + public function get_export_fields($post_type) { |
|
134 | 134 | |
135 | 135 | $fields = array( |
136 | 136 | 'id', |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | 'created_via' |
181 | 181 | ); |
182 | 182 | |
183 | - return apply_filters( 'getpaid_invoice_exporter_get_fields', $fields, $post_type ); |
|
183 | + return apply_filters('getpaid_invoice_exporter_get_fields', $fields, $post_type); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @since 1.0.19 |
191 | 191 | * @return array |
192 | 192 | */ |
193 | - public function get_amount_fields( $post_type ) { |
|
193 | + public function get_amount_fields($post_type) { |
|
194 | 194 | |
195 | 195 | $fields = array( |
196 | 196 | 'subtotal', |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | 'total_fees' |
200 | 200 | ); |
201 | 201 | |
202 | - return apply_filters( 'getpaid_invoice_exporter_get_amount_fields', $fields, $post_type ); |
|
202 | + return apply_filters('getpaid_invoice_exporter_get_amount_fields', $fields, $post_type); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | $tax_rates = GetPaid_Tax::get_all_tax_rates(); |
10 | 10 | $dummy_rate = array( |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | 'global' => true, |
14 | 14 | 'rate' => wpinv_get_default_tax_rate(), |
15 | 15 | 'reduced_rate' => 5, |
16 | - 'name' => __( 'VAT', 'invoicing' ), |
|
16 | + 'name' => __('VAT', 'invoicing'), |
|
17 | 17 | ); |
18 | 18 | |
19 | 19 | $reset_url = esc_url( |
20 | 20 | wp_nonce_url( |
21 | - add_query_arg( 'getpaid-admin-action', 'reset_tax_rates' ), |
|
21 | + add_query_arg('getpaid-admin-action', 'reset_tax_rates'), |
|
22 | 22 | 'getpaid-nonce', |
23 | 23 | 'getpaid-nonce' |
24 | 24 | ) |
@@ -27,34 +27,34 @@ discard block |
||
27 | 27 | ?> |
28 | 28 | <div class="table-responsive"> |
29 | 29 | <table id="wpinv_tax_rates" class="widefat fixed table"> |
30 | - <caption><?php echo esc_html_e( 'Enter tax rates for specific regions.', 'invoicing' ); ?></caption> |
|
30 | + <caption><?php echo esc_html_e('Enter tax rates for specific regions.', 'invoicing'); ?></caption> |
|
31 | 31 | |
32 | 32 | <thead> |
33 | 33 | <tr class="table-light"> |
34 | 34 | |
35 | 35 | <th scope="col" class="border-bottom border-top"> |
36 | - <?php _e( 'Country', 'invoicing' ); ?> |
|
37 | - <?php echo getpaid_get_help_tip( __( 'Optionally limit this tax rate to a specific country.', 'invoicing' ), 'position-static' ); ?> |
|
36 | + <?php _e('Country', 'invoicing'); ?> |
|
37 | + <?php echo getpaid_get_help_tip(__('Optionally limit this tax rate to a specific country.', 'invoicing'), 'position-static'); ?> |
|
38 | 38 | </th> |
39 | 39 | |
40 | 40 | <th scope="col" class="border-bottom border-top"> |
41 | - <?php _e( 'State', 'invoicing' ); ?> |
|
42 | - <?php echo getpaid_get_help_tip( __( 'Separate state codes using a comma or leave blank to apply country wide.', 'invoicing' ), 'position-static' ); ?> |
|
41 | + <?php _e('State', 'invoicing'); ?> |
|
42 | + <?php echo getpaid_get_help_tip(__('Separate state codes using a comma or leave blank to apply country wide.', 'invoicing'), 'position-static'); ?> |
|
43 | 43 | </th> |
44 | 44 | |
45 | 45 | <th scope="col" class="border-bottom border-top"> |
46 | - <?php _e( 'Standard Rate %', 'invoicing' ); ?> |
|
47 | - <?php echo getpaid_get_help_tip( __( 'The tax rate (percentage) to charge on items that use the "Standard rate" tax class.', 'invoicing' ), 'position-static' ); ?> |
|
46 | + <?php _e('Standard Rate %', 'invoicing'); ?> |
|
47 | + <?php echo getpaid_get_help_tip(__('The tax rate (percentage) to charge on items that use the "Standard rate" tax class.', 'invoicing'), 'position-static'); ?> |
|
48 | 48 | </th> |
49 | 49 | |
50 | 50 | <th scope="col" class="border-bottom border-top"> |
51 | - <?php _e( 'Reduced Rate %', 'invoicing' ); ?> |
|
52 | - <?php echo getpaid_get_help_tip( __( 'The tax rate (percentage) to charge on items that use the "Reduced rate" tax class.', 'invoicing' ), 'position-static' ); ?> |
|
51 | + <?php _e('Reduced Rate %', 'invoicing'); ?> |
|
52 | + <?php echo getpaid_get_help_tip(__('The tax rate (percentage) to charge on items that use the "Reduced rate" tax class.', 'invoicing'), 'position-static'); ?> |
|
53 | 53 | </th> |
54 | 54 | |
55 | 55 | <th scope="col" class="border-bottom border-top"> |
56 | - <?php _e( 'Tax Name', 'invoicing' ); ?> |
|
57 | - <?php echo getpaid_get_help_tip( __( 'The name of this tax, e.g VAT.', 'invoicing' ), 'position-static' ); ?> |
|
56 | + <?php _e('Tax Name', 'invoicing'); ?> |
|
57 | + <?php echo getpaid_get_help_tip(__('The name of this tax, e.g VAT.', 'invoicing'), 'position-static'); ?> |
|
58 | 58 | </th> |
59 | 59 | |
60 | 60 | <th scope="col" class="border-bottom border-top" style="width:32px"> </th> |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | </thead> |
64 | 64 | |
65 | 65 | <tbody> |
66 | - <?php array_walk( $tax_rates, 'wpinv_tax_rate_callback' ); ?> |
|
66 | + <?php array_walk($tax_rates, 'wpinv_tax_rate_callback'); ?> |
|
67 | 67 | </tbody> |
68 | 68 | |
69 | 69 | <tfoot> |
70 | 70 | <tr class="table-light"> |
71 | 71 | <td colspan="6" class="border-top"> |
72 | 72 | |
73 | - <button type="button" class="button button-secondary wpinv_add_tax_rate" aria-label="<?php esc_attr_e( 'Add Tax Rate', 'invoicing' ); ?>"> |
|
74 | - <span><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span> |
|
73 | + <button type="button" class="button button-secondary wpinv_add_tax_rate" aria-label="<?php esc_attr_e('Add Tax Rate', 'invoicing'); ?>"> |
|
74 | + <span><?php _e('Add Tax Rate', 'invoicing'); ?></span> |
|
75 | 75 | </button> |
76 | 76 | |
77 | - <a href="<?php echo $reset_url; ?>" class="button button-secondary wpinv_reset_tax_rates" aria-label="<?php esc_attr_e( 'Reset Tax Rates', 'invoicing' ); ?>"> |
|
78 | - <span><?php _e( 'Reset Tax Rates', 'invoicing' ); ?></span> |
|
77 | + <a href="<?php echo $reset_url; ?>" class="button button-secondary wpinv_reset_tax_rates" aria-label="<?php esc_attr_e('Reset Tax Rates', 'invoicing'); ?>"> |
|
78 | + <span><?php _e('Reset Tax Rates', 'invoicing'); ?></span> |
|
79 | 79 | </a> |
80 | 80 | </td> |
81 | 81 | </tr> |
@@ -84,6 +84,6 @@ discard block |
||
84 | 84 | </div> |
85 | 85 | |
86 | 86 | <script type="text/html" id="tmpl-wpinv-tax-rate-row"> |
87 | - <?php echo wpinv_tax_rate_callback( $dummy_rate, 0, false ); ?> |
|
87 | + <?php echo wpinv_tax_rate_callback($dummy_rate, 0, false); ?> |
|
88 | 88 | </script> |
89 | 89 |
@@ -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 | * The Subscriptions DB Class |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | 'transaction_id' => '', |
73 | 73 | 'parent_payment_id' => 0, |
74 | 74 | 'product_id' => 0, |
75 | - 'created' => date( 'Y-m-d H:i:s' ), |
|
76 | - 'expiration' => date( 'Y-m-d H:i:s' ), |
|
75 | + 'created' => date('Y-m-d H:i:s'), |
|
76 | + 'expiration' => date('Y-m-d H:i:s'), |
|
77 | 77 | 'trial_period' => '', |
78 | 78 | 'status' => '', |
79 | 79 | 'profile_id' => '', |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * @access public |
87 | 87 | * @since 1.0.0 |
88 | 88 | */ |
89 | - public function get_subscriptions( $args = array() ) { |
|
90 | - return getpaid_get_subscriptions( $args ); |
|
89 | + public function get_subscriptions($args = array()) { |
|
90 | + return getpaid_get_subscriptions($args); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | * @access public |
97 | 97 | * @since 1.0.0 |
98 | 98 | */ |
99 | - public function count( $args = array() ) { |
|
100 | - return getpaid_get_subscriptions( $args, 'count' ); |
|
99 | + public function count($args = array()) { |
|
100 | + return getpaid_get_subscriptions($args, 'count'); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function create_table() { |
110 | 110 | |
111 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
111 | + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
112 | 112 | |
113 | 113 | $sql = "CREATE TABLE " . $this->table_name . " ( |
114 | 114 | id bigint(20) NOT NULL AUTO_INCREMENT, |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | KEY customer_and_status ( customer_id, status) |
134 | 134 | ) CHARACTER SET utf8 COLLATE utf8_general_ci;"; |
135 | 135 | |
136 | - dbDelta( $sql ); |
|
136 | + dbDelta($sql); |
|
137 | 137 | |
138 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
138 | + update_option($this->table_name . '_db_version', $this->version); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | } |
142 | 142 | \ No newline at end of file |