@@ -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 | /** |
@@ -12,210 +12,210 @@ |
||
12 | 12 | */ |
13 | 13 | class GetPaid_Payment_Form_Submission_Taxes { |
14 | 14 | |
15 | - /** |
|
16 | - * Submission taxes. |
|
17 | - * @var array |
|
18 | - */ |
|
19 | - public $taxes = array(); |
|
15 | + /** |
|
16 | + * Submission taxes. |
|
17 | + * @var array |
|
18 | + */ |
|
19 | + public $taxes = array(); |
|
20 | + |
|
21 | + /** |
|
22 | + * Class constructor |
|
23 | + * |
|
24 | + * @param GetPaid_Payment_Form_Submission $submission |
|
25 | + */ |
|
26 | + public function __construct( $submission ) { |
|
27 | + |
|
28 | + // Validate VAT number. |
|
29 | + $this->validate_vat( $submission ); |
|
30 | + |
|
31 | + foreach ( $submission->get_items() as $item ) { |
|
32 | + $this->process_item_tax( $item, $submission ); |
|
33 | + } |
|
34 | + |
|
35 | + // Process any existing invoice taxes. |
|
36 | + if ( $submission->has_invoice() ) { |
|
37 | + $this->taxes = array_replace( $submission->get_invoice()->get_taxes(), $this->taxes ); |
|
38 | + } |
|
39 | + |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * Maybe process tax. |
|
44 | + * |
|
45 | + * @since 1.0.19 |
|
46 | + * @param GetPaid_Form_Item $item |
|
47 | + * @param GetPaid_Payment_Form_Submission $submission |
|
48 | + */ |
|
49 | + public function process_item_tax( $item, $submission ) { |
|
50 | + |
|
51 | + $rates = getpaid_get_item_tax_rates( $item, $submission->country, $submission->state ); |
|
52 | + $rates = getpaid_filter_item_tax_rates( $item, $rates ); |
|
53 | + $taxes = getpaid_calculate_item_taxes( $item->get_sub_total(), $rates ); |
|
54 | + $r_taxes = getpaid_calculate_item_taxes( $item->get_recurring_sub_total(), $rates ); |
|
55 | + |
|
56 | + foreach ( $taxes as $name => $amount ) { |
|
57 | + $recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0; |
|
58 | + $tax = getpaid_prepare_item_tax( $item, $name, $amount, $recurring ); |
|
59 | + |
|
60 | + if ( ! isset( $this->taxes[ $name ] ) ) { |
|
61 | + $this->taxes[ $name ] = $tax; |
|
62 | + continue; |
|
63 | + } |
|
64 | + |
|
65 | + $this->taxes[ $name ]['initial_tax'] += $tax['initial_tax']; |
|
66 | + $this->taxes[ $name ]['recurring_tax'] += $tax['recurring_tax']; |
|
67 | + |
|
68 | + } |
|
69 | + |
|
70 | + } |
|
20 | 71 | |
21 | 72 | /** |
22 | - * Class constructor |
|
23 | - * |
|
24 | - * @param GetPaid_Payment_Form_Submission $submission |
|
25 | - */ |
|
26 | - public function __construct( $submission ) { |
|
27 | - |
|
28 | - // Validate VAT number. |
|
29 | - $this->validate_vat( $submission ); |
|
30 | - |
|
31 | - foreach ( $submission->get_items() as $item ) { |
|
32 | - $this->process_item_tax( $item, $submission ); |
|
33 | - } |
|
34 | - |
|
35 | - // Process any existing invoice taxes. |
|
36 | - if ( $submission->has_invoice() ) { |
|
37 | - $this->taxes = array_replace( $submission->get_invoice()->get_taxes(), $this->taxes ); |
|
38 | - } |
|
39 | - |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * Maybe process tax. |
|
44 | - * |
|
45 | - * @since 1.0.19 |
|
46 | - * @param GetPaid_Form_Item $item |
|
47 | - * @param GetPaid_Payment_Form_Submission $submission |
|
48 | - */ |
|
49 | - public function process_item_tax( $item, $submission ) { |
|
50 | - |
|
51 | - $rates = getpaid_get_item_tax_rates( $item, $submission->country, $submission->state ); |
|
52 | - $rates = getpaid_filter_item_tax_rates( $item, $rates ); |
|
53 | - $taxes = getpaid_calculate_item_taxes( $item->get_sub_total(), $rates ); |
|
54 | - $r_taxes = getpaid_calculate_item_taxes( $item->get_recurring_sub_total(), $rates ); |
|
55 | - |
|
56 | - foreach ( $taxes as $name => $amount ) { |
|
57 | - $recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0; |
|
58 | - $tax = getpaid_prepare_item_tax( $item, $name, $amount, $recurring ); |
|
59 | - |
|
60 | - if ( ! isset( $this->taxes[ $name ] ) ) { |
|
61 | - $this->taxes[ $name ] = $tax; |
|
62 | - continue; |
|
63 | - } |
|
64 | - |
|
65 | - $this->taxes[ $name ]['initial_tax'] += $tax['initial_tax']; |
|
66 | - $this->taxes[ $name ]['recurring_tax'] += $tax['recurring_tax']; |
|
67 | - |
|
68 | - } |
|
69 | - |
|
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * Checks if the submission has a digital item. |
|
74 | - * |
|
75 | - * @param GetPaid_Payment_Form_Submission $submission |
|
76 | - * @since 1.0.19 |
|
77 | - * @return bool |
|
78 | - */ |
|
79 | - public function has_digital_item( $submission ) { |
|
80 | - |
|
81 | - foreach ( $submission->get_items() as $item ) { |
|
82 | - |
|
83 | - if ( 'digital' == $item->get_vat_rule() ) { |
|
84 | - return true; |
|
85 | - } |
|
86 | - |
|
87 | - } |
|
88 | - |
|
89 | - return false; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * Checks if this is an eu store. |
|
94 | - * |
|
95 | - * @since 1.0.19 |
|
96 | - * @return bool |
|
97 | - */ |
|
98 | - public function is_eu_store() { |
|
99 | - return $this->is_eu_country( wpinv_get_default_country() ); |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * Checks if this is an eu country. |
|
104 | - * |
|
105 | - * @param string $country |
|
106 | - * @since 1.0.19 |
|
107 | - * @return bool |
|
108 | - */ |
|
109 | - public function is_eu_country( $country ) { |
|
110 | - return getpaid_is_eu_state( $country ) || getpaid_is_gst_country( $country ); |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * Checks if this is an eu purchase. |
|
115 | - * |
|
116 | - * @param string $customer_country |
|
117 | - * @since 1.0.19 |
|
118 | - * @return bool |
|
119 | - */ |
|
120 | - public function is_eu_transaction( $customer_country ) { |
|
121 | - return $this->is_eu_country( $customer_country ) && $this->is_eu_store(); |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * Retrieves the vat number. |
|
126 | - * |
|
127 | - * @param GetPaid_Payment_Form_Submission $submission |
|
128 | - * @since 1.0.19 |
|
129 | - * @return string |
|
130 | - */ |
|
131 | - public function get_vat_number( $submission ) { |
|
132 | - |
|
133 | - // Retrieve from the posted number. |
|
134 | - $vat_number = $submission->get_field( 'wpinv_vat_number', 'billing' ); |
|
135 | - if ( ! empty( $vat_number ) ) { |
|
136 | - return wpinv_clean( $vat_number ); |
|
137 | - } |
|
138 | - |
|
139 | - // Retrieve from the invoice. |
|
140 | - return $submission->has_invoice() ? $submission->get_invoice()->get_vat_number() : ''; |
|
141 | - } |
|
142 | - |
|
143 | - /** |
|
144 | - * Retrieves the company. |
|
145 | - * |
|
146 | - * @param GetPaid_Payment_Form_Submission $submission |
|
147 | - * @since 1.0.19 |
|
148 | - * @return string |
|
149 | - */ |
|
150 | - public function get_company( $submission ) { |
|
151 | - |
|
152 | - // Retrieve from the posted data. |
|
153 | - $company = $submission->get_field( 'wpinv_company', 'billing' ); |
|
154 | - if ( ! empty( $company ) ) { |
|
155 | - return wpinv_clean( $company ); |
|
156 | - } |
|
157 | - |
|
158 | - // Retrieve from the invoice. |
|
159 | - return $submission->has_invoice() ? $submission->get_invoice()->get_company() : ''; |
|
160 | - } |
|
161 | - |
|
162 | - /** |
|
163 | - * Checks if we require a VAT number. |
|
164 | - * |
|
165 | - * @param bool $ip_in_eu Whether the customer IP is from the EU |
|
166 | - * @param bool $country_in_eu Whether the customer country is from the EU |
|
167 | - * @since 1.0.19 |
|
168 | - * @return string |
|
169 | - */ |
|
170 | - public function requires_vat( $ip_in_eu, $country_in_eu ) { |
|
171 | - |
|
172 | - $prevent_b2c = wpinv_get_option( 'vat_prevent_b2c_purchase' ); |
|
173 | - $prevent_b2c = ! empty( $prevent_b2c ); |
|
174 | - $is_eu = $ip_in_eu || $country_in_eu; |
|
175 | - |
|
176 | - return $prevent_b2c && $is_eu; |
|
177 | - } |
|
178 | - |
|
179 | - /** |
|
180 | - * Validate VAT data. |
|
181 | - * |
|
182 | - * @param GetPaid_Payment_Form_Submission $submission |
|
183 | - * @since 1.0.19 |
|
184 | - */ |
|
185 | - public function validate_vat( $submission ) { |
|
186 | - |
|
187 | - $in_eu = $this->is_eu_transaction( $submission->country ); |
|
188 | - |
|
189 | - // Abort if we are not validating vat numbers. |
|
190 | - if ( ! $in_eu ) { |
|
73 | + * Checks if the submission has a digital item. |
|
74 | + * |
|
75 | + * @param GetPaid_Payment_Form_Submission $submission |
|
76 | + * @since 1.0.19 |
|
77 | + * @return bool |
|
78 | + */ |
|
79 | + public function has_digital_item( $submission ) { |
|
80 | + |
|
81 | + foreach ( $submission->get_items() as $item ) { |
|
82 | + |
|
83 | + if ( 'digital' == $item->get_vat_rule() ) { |
|
84 | + return true; |
|
85 | + } |
|
86 | + |
|
87 | + } |
|
88 | + |
|
89 | + return false; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * Checks if this is an eu store. |
|
94 | + * |
|
95 | + * @since 1.0.19 |
|
96 | + * @return bool |
|
97 | + */ |
|
98 | + public function is_eu_store() { |
|
99 | + return $this->is_eu_country( wpinv_get_default_country() ); |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * Checks if this is an eu country. |
|
104 | + * |
|
105 | + * @param string $country |
|
106 | + * @since 1.0.19 |
|
107 | + * @return bool |
|
108 | + */ |
|
109 | + public function is_eu_country( $country ) { |
|
110 | + return getpaid_is_eu_state( $country ) || getpaid_is_gst_country( $country ); |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * Checks if this is an eu purchase. |
|
115 | + * |
|
116 | + * @param string $customer_country |
|
117 | + * @since 1.0.19 |
|
118 | + * @return bool |
|
119 | + */ |
|
120 | + public function is_eu_transaction( $customer_country ) { |
|
121 | + return $this->is_eu_country( $customer_country ) && $this->is_eu_store(); |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * Retrieves the vat number. |
|
126 | + * |
|
127 | + * @param GetPaid_Payment_Form_Submission $submission |
|
128 | + * @since 1.0.19 |
|
129 | + * @return string |
|
130 | + */ |
|
131 | + public function get_vat_number( $submission ) { |
|
132 | + |
|
133 | + // Retrieve from the posted number. |
|
134 | + $vat_number = $submission->get_field( 'wpinv_vat_number', 'billing' ); |
|
135 | + if ( ! empty( $vat_number ) ) { |
|
136 | + return wpinv_clean( $vat_number ); |
|
137 | + } |
|
138 | + |
|
139 | + // Retrieve from the invoice. |
|
140 | + return $submission->has_invoice() ? $submission->get_invoice()->get_vat_number() : ''; |
|
141 | + } |
|
142 | + |
|
143 | + /** |
|
144 | + * Retrieves the company. |
|
145 | + * |
|
146 | + * @param GetPaid_Payment_Form_Submission $submission |
|
147 | + * @since 1.0.19 |
|
148 | + * @return string |
|
149 | + */ |
|
150 | + public function get_company( $submission ) { |
|
151 | + |
|
152 | + // Retrieve from the posted data. |
|
153 | + $company = $submission->get_field( 'wpinv_company', 'billing' ); |
|
154 | + if ( ! empty( $company ) ) { |
|
155 | + return wpinv_clean( $company ); |
|
156 | + } |
|
157 | + |
|
158 | + // Retrieve from the invoice. |
|
159 | + return $submission->has_invoice() ? $submission->get_invoice()->get_company() : ''; |
|
160 | + } |
|
161 | + |
|
162 | + /** |
|
163 | + * Checks if we require a VAT number. |
|
164 | + * |
|
165 | + * @param bool $ip_in_eu Whether the customer IP is from the EU |
|
166 | + * @param bool $country_in_eu Whether the customer country is from the EU |
|
167 | + * @since 1.0.19 |
|
168 | + * @return string |
|
169 | + */ |
|
170 | + public function requires_vat( $ip_in_eu, $country_in_eu ) { |
|
171 | + |
|
172 | + $prevent_b2c = wpinv_get_option( 'vat_prevent_b2c_purchase' ); |
|
173 | + $prevent_b2c = ! empty( $prevent_b2c ); |
|
174 | + $is_eu = $ip_in_eu || $country_in_eu; |
|
175 | + |
|
176 | + return $prevent_b2c && $is_eu; |
|
177 | + } |
|
178 | + |
|
179 | + /** |
|
180 | + * Validate VAT data. |
|
181 | + * |
|
182 | + * @param GetPaid_Payment_Form_Submission $submission |
|
183 | + * @since 1.0.19 |
|
184 | + */ |
|
185 | + public function validate_vat( $submission ) { |
|
186 | + |
|
187 | + $in_eu = $this->is_eu_transaction( $submission->country ); |
|
188 | + |
|
189 | + // Abort if we are not validating vat numbers. |
|
190 | + if ( ! $in_eu ) { |
|
191 | 191 | return; |
192 | - } |
|
192 | + } |
|
193 | 193 | |
194 | - // Prepare variables. |
|
195 | - $vat_number = $this->get_vat_number( $submission ); |
|
196 | - $ip_country = getpaid_get_ip_country(); |
|
194 | + // Prepare variables. |
|
195 | + $vat_number = $this->get_vat_number( $submission ); |
|
196 | + $ip_country = getpaid_get_ip_country(); |
|
197 | 197 | $is_eu = $this->is_eu_country( $submission->country ); |
198 | 198 | $is_ip_eu = $this->is_eu_country( $ip_country ); |
199 | 199 | |
200 | - // If we're preventing business to consumer purchases, |
|
201 | - if ( $this->requires_vat( $is_ip_eu, $is_eu ) && empty( $vat_number ) ) { |
|
200 | + // If we're preventing business to consumer purchases, |
|
201 | + if ( $this->requires_vat( $is_ip_eu, $is_eu ) && empty( $vat_number ) ) { |
|
202 | 202 | |
203 | - // Ensure that a vat number has been specified. |
|
204 | - throw new Exception( |
|
205 | - __( 'Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing' ) |
|
206 | - ); |
|
203 | + // Ensure that a vat number has been specified. |
|
204 | + throw new Exception( |
|
205 | + __( 'Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing' ) |
|
206 | + ); |
|
207 | 207 | |
208 | - } |
|
208 | + } |
|
209 | 209 | |
210 | - // Abort if we are not validating vat (vat number should exist, user should be in eu and business too). |
|
211 | - if ( ! $in_eu ) { |
|
210 | + // Abort if we are not validating vat (vat number should exist, user should be in eu and business too). |
|
211 | + if ( ! $in_eu ) { |
|
212 | 212 | return; |
213 | - } |
|
213 | + } |
|
214 | 214 | |
215 | - if ( ! wpinv_validate_vat_number( $vat_number, $submission->country ) ) { |
|
216 | - throw new Exception( __( 'Your VAT number is invalid', 'invoicing' ) ); |
|
217 | - } |
|
215 | + if ( ! wpinv_validate_vat_number( $vat_number, $submission->country ) ) { |
|
216 | + throw new Exception( __( 'Your VAT number is invalid', 'invoicing' ) ); |
|
217 | + } |
|
218 | 218 | |
219 | - } |
|
219 | + } |
|
220 | 220 | |
221 | 221 | } |
@@ -9,32 +9,32 @@ |
||
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 | - 'GB', |
|
24 | - 'GR', |
|
25 | - 'HU', |
|
26 | - 'IE', |
|
27 | - 'IT', |
|
28 | - 'LV', |
|
29 | - 'LT', |
|
30 | - 'LU', |
|
31 | - 'MT', |
|
32 | - 'NL', |
|
33 | - 'PL', |
|
34 | - 'PT', |
|
35 | - 'RO', |
|
36 | - 'SK', |
|
37 | - 'SI', |
|
38 | - 'ES', |
|
39 | - 'SE' |
|
12 | + 'AT', |
|
13 | + 'BE', |
|
14 | + 'BG', |
|
15 | + 'HR', |
|
16 | + 'CY', |
|
17 | + 'CZ', |
|
18 | + 'DK', |
|
19 | + 'EE', |
|
20 | + 'FI', |
|
21 | + 'FR', |
|
22 | + 'DE', |
|
23 | + 'GB', |
|
24 | + 'GR', |
|
25 | + 'HU', |
|
26 | + 'IE', |
|
27 | + 'IT', |
|
28 | + 'LV', |
|
29 | + 'LT', |
|
30 | + 'LU', |
|
31 | + 'MT', |
|
32 | + 'NL', |
|
33 | + 'PL', |
|
34 | + 'PT', |
|
35 | + 'RO', |
|
36 | + 'SK', |
|
37 | + 'SI', |
|
38 | + 'ES', |
|
39 | + 'SE' |
|
40 | 40 | ); |
@@ -13,233 +13,233 @@ |
||
13 | 13 | |
14 | 14 | return array( |
15 | 15 | |
16 | - 'id' => array( |
|
17 | - 'description' => __( 'Unique identifier for the item.', 'invoicing' ), |
|
18 | - 'type' => 'integer', |
|
19 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
20 | - 'readonly' => true, |
|
21 | - ), |
|
22 | - |
|
23 | - 'parent_id' => array( |
|
24 | - 'description' => __( 'Parent item ID.', 'invoicing' ), |
|
25 | - 'type' => 'integer', |
|
26 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
27 | - 'default' => 0, |
|
28 | - ), |
|
29 | - |
|
30 | - 'status' => array( |
|
31 | - 'description' => __( 'A named status for the item.', 'invoicing' ), |
|
32 | - 'type' => 'string', |
|
33 | - 'enum' => array( 'draft', 'pending', 'publish' ), |
|
34 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
35 | - 'default' => 'draft', |
|
36 | - ), |
|
37 | - |
|
38 | - 'version' => array( |
|
39 | - 'description' => __( 'Plugin version when the item was created.', 'invoicing' ), |
|
40 | - 'type' => 'string', |
|
41 | - 'context' => array( 'view', 'edit' ), |
|
42 | - 'readonly' => true, |
|
43 | - ), |
|
44 | - |
|
45 | - 'date_created' => array( |
|
46 | - 'description' => __( "The date the item was created, in the site's timezone.", 'invoicing' ), |
|
47 | - 'type' => 'string', |
|
48 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
49 | - ), |
|
50 | - |
|
51 | - 'date_created_gmt' => array( |
|
52 | - 'description' => __( 'The GMT date the item was created.', 'invoicing' ), |
|
53 | - 'type' => 'string', |
|
54 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
55 | - 'readonly' => true, |
|
56 | - ), |
|
57 | - |
|
58 | - 'date_modified' => array( |
|
59 | - 'description' => __( "The date the item was last modified, in the site's timezone.", 'invoicing' ), |
|
60 | - 'type' => 'string', |
|
61 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
62 | - 'readonly' => true, |
|
63 | - ), |
|
64 | - |
|
65 | - 'date_modified_gmt' => array( |
|
66 | - 'description' => __( 'The GMT date the item was last modified.', 'invoicing' ), |
|
67 | - 'type' => 'string', |
|
68 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
69 | - 'readonly' => true, |
|
70 | - ), |
|
71 | - |
|
72 | - 'name' => array( |
|
73 | - 'description' => __( "The item's name.", 'invoicing' ), |
|
74 | - 'type' => 'string', |
|
75 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
76 | - 'required' => true, |
|
77 | - ), |
|
78 | - |
|
79 | - 'description' => array( |
|
80 | - 'description' => __( "The item's description.", 'invoicing' ), |
|
81 | - 'type' => 'string', |
|
82 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
83 | - ), |
|
84 | - |
|
85 | - 'owner' => array( |
|
86 | - 'description' => __( 'The owner of the item (user id).', 'invoicing' ), |
|
87 | - 'type' => 'integer', |
|
88 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
89 | - ), |
|
90 | - |
|
91 | - 'price' => array( |
|
92 | - 'description' => __( 'The price of the item.', 'invoicing' ), |
|
93 | - 'type' => 'number', |
|
94 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
95 | - 'required' => true, |
|
96 | - ), |
|
97 | - |
|
98 | - 'the_price' => array( |
|
99 | - 'description' => __( 'The formatted price of the item.', 'invoicing' ), |
|
100 | - 'type' => 'string', |
|
101 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
102 | - 'readonly' => true, |
|
103 | - ), |
|
104 | - |
|
105 | - 'type' => array( |
|
106 | - 'description' => __( 'The item type.', 'invoicing' ), |
|
107 | - 'type' => 'string', |
|
108 | - 'enum' => wpinv_item_types(), |
|
109 | - 'default' => 'custom', |
|
110 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
111 | - ), |
|
112 | - |
|
113 | - 'vat_rule' => array( |
|
114 | - 'description' => __( 'VAT rule applied to the item.', 'invoicing' ), |
|
115 | - 'type' => 'string', |
|
116 | - 'enum' => array_keys( getpaid_get_tax_rules() ), |
|
117 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
118 | - ), |
|
119 | - |
|
120 | - 'vat_class' => array( |
|
121 | - 'description' => __( 'VAT class for the item.', 'invoicing' ), |
|
122 | - 'type' => 'string', |
|
123 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
124 | - 'enum' => array_keys( getpaid_get_tax_classes() ), |
|
125 | - ), |
|
126 | - |
|
127 | - 'custom_id' => array( |
|
128 | - 'description' => __( 'Custom id for the item.', 'invoicing' ), |
|
129 | - 'type' => 'string', |
|
130 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
131 | - ), |
|
16 | + 'id' => array( |
|
17 | + 'description' => __( 'Unique identifier for the item.', 'invoicing' ), |
|
18 | + 'type' => 'integer', |
|
19 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
20 | + 'readonly' => true, |
|
21 | + ), |
|
22 | + |
|
23 | + 'parent_id' => array( |
|
24 | + 'description' => __( 'Parent item ID.', 'invoicing' ), |
|
25 | + 'type' => 'integer', |
|
26 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
27 | + 'default' => 0, |
|
28 | + ), |
|
29 | + |
|
30 | + 'status' => array( |
|
31 | + 'description' => __( 'A named status for the item.', 'invoicing' ), |
|
32 | + 'type' => 'string', |
|
33 | + 'enum' => array( 'draft', 'pending', 'publish' ), |
|
34 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
35 | + 'default' => 'draft', |
|
36 | + ), |
|
37 | + |
|
38 | + 'version' => array( |
|
39 | + 'description' => __( 'Plugin version when the item was created.', 'invoicing' ), |
|
40 | + 'type' => 'string', |
|
41 | + 'context' => array( 'view', 'edit' ), |
|
42 | + 'readonly' => true, |
|
43 | + ), |
|
44 | + |
|
45 | + 'date_created' => array( |
|
46 | + 'description' => __( "The date the item was created, in the site's timezone.", 'invoicing' ), |
|
47 | + 'type' => 'string', |
|
48 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
49 | + ), |
|
50 | + |
|
51 | + 'date_created_gmt' => array( |
|
52 | + 'description' => __( 'The GMT date the item was created.', 'invoicing' ), |
|
53 | + 'type' => 'string', |
|
54 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
55 | + 'readonly' => true, |
|
56 | + ), |
|
57 | + |
|
58 | + 'date_modified' => array( |
|
59 | + 'description' => __( "The date the item was last modified, in the site's timezone.", 'invoicing' ), |
|
60 | + 'type' => 'string', |
|
61 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
62 | + 'readonly' => true, |
|
63 | + ), |
|
64 | + |
|
65 | + 'date_modified_gmt' => array( |
|
66 | + 'description' => __( 'The GMT date the item was last modified.', 'invoicing' ), |
|
67 | + 'type' => 'string', |
|
68 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
69 | + 'readonly' => true, |
|
70 | + ), |
|
71 | + |
|
72 | + 'name' => array( |
|
73 | + 'description' => __( "The item's name.", 'invoicing' ), |
|
74 | + 'type' => 'string', |
|
75 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
76 | + 'required' => true, |
|
77 | + ), |
|
78 | + |
|
79 | + 'description' => array( |
|
80 | + 'description' => __( "The item's description.", 'invoicing' ), |
|
81 | + 'type' => 'string', |
|
82 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
83 | + ), |
|
84 | + |
|
85 | + 'owner' => array( |
|
86 | + 'description' => __( 'The owner of the item (user id).', 'invoicing' ), |
|
87 | + 'type' => 'integer', |
|
88 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
89 | + ), |
|
90 | + |
|
91 | + 'price' => array( |
|
92 | + 'description' => __( 'The price of the item.', 'invoicing' ), |
|
93 | + 'type' => 'number', |
|
94 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
95 | + 'required' => true, |
|
96 | + ), |
|
97 | + |
|
98 | + 'the_price' => array( |
|
99 | + 'description' => __( 'The formatted price of the item.', 'invoicing' ), |
|
100 | + 'type' => 'string', |
|
101 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
102 | + 'readonly' => true, |
|
103 | + ), |
|
104 | + |
|
105 | + 'type' => array( |
|
106 | + 'description' => __( 'The item type.', 'invoicing' ), |
|
107 | + 'type' => 'string', |
|
108 | + 'enum' => wpinv_item_types(), |
|
109 | + 'default' => 'custom', |
|
110 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
111 | + ), |
|
112 | + |
|
113 | + 'vat_rule' => array( |
|
114 | + 'description' => __( 'VAT rule applied to the item.', 'invoicing' ), |
|
115 | + 'type' => 'string', |
|
116 | + 'enum' => array_keys( getpaid_get_tax_rules() ), |
|
117 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
118 | + ), |
|
119 | + |
|
120 | + 'vat_class' => array( |
|
121 | + 'description' => __( 'VAT class for the item.', 'invoicing' ), |
|
122 | + 'type' => 'string', |
|
123 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
124 | + 'enum' => array_keys( getpaid_get_tax_classes() ), |
|
125 | + ), |
|
126 | + |
|
127 | + 'custom_id' => array( |
|
128 | + 'description' => __( 'Custom id for the item.', 'invoicing' ), |
|
129 | + 'type' => 'string', |
|
130 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
131 | + ), |
|
132 | 132 | |
133 | - 'custom_name' => array( |
|
134 | - 'description' => __( 'Custom name for the item.', 'invoicing' ), |
|
135 | - 'type' => 'string', |
|
136 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
137 | - ), |
|
138 | - |
|
139 | - 'custom_singular_name' => array( |
|
140 | - 'description' => __( 'Custom singular name for the item.', 'invoicing' ), |
|
141 | - 'type' => 'string', |
|
142 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
143 | - ), |
|
144 | - |
|
145 | - 'is_dynamic_pricing' => array( |
|
146 | - 'description' => __( 'Whether or not customers can enter their own prices when checking out.', 'invoicing' ), |
|
147 | - 'type' => 'integer', |
|
148 | - 'enum' => array( 0, 1 ), |
|
149 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
150 | - ), |
|
151 | - |
|
152 | - 'minimum_price' => array( |
|
153 | - 'description' => __( 'For dynamic prices, this is the minimum price that a user can set.', 'invoicing' ), |
|
154 | - 'type' => 'number', |
|
155 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
156 | - ), |
|
157 | - |
|
158 | - 'is_recurring' => array( |
|
159 | - 'description' => __( 'Whether or not this is a subscription item.', 'invoicing' ), |
|
160 | - 'type' => 'integer', |
|
161 | - 'enum' => array( 0, 1 ), |
|
162 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
163 | - ), |
|
164 | - |
|
165 | - 'initial_price' => array( |
|
166 | - 'description' => __( 'The initial price of the item.', 'invoicing' ), |
|
167 | - 'type' => 'number', |
|
168 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
169 | - 'readonly' => true, |
|
170 | - ), |
|
171 | - |
|
172 | - 'the_initial_price' => array( |
|
173 | - 'description' => __( 'The formatted initial price of the item.', 'invoicing' ), |
|
174 | - 'type' => 'string', |
|
175 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
176 | - 'readonly' => true, |
|
177 | - ), |
|
178 | - |
|
179 | - 'recurring_price' => array( |
|
180 | - 'description' => __( 'The recurring price of the item.', 'invoicing' ), |
|
181 | - 'type' => 'number', |
|
182 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
183 | - 'readonly' => true, |
|
184 | - ), |
|
185 | - |
|
186 | - 'the_recurring_price' => array( |
|
187 | - 'description' => __( 'The formatted recurring price of the item.', 'invoicing' ), |
|
188 | - 'type' => 'string', |
|
189 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
190 | - 'readonly' => true, |
|
191 | - ), |
|
192 | - |
|
193 | - 'recurring_period' => array( |
|
194 | - 'description' => __( 'The recurring period for a recurring item.', 'invoicing' ), |
|
195 | - 'type' => 'string', |
|
196 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
197 | - 'enum' => array( 'D', 'W', 'M', 'Y' ), |
|
198 | - ), |
|
199 | - |
|
200 | - 'recurring_interval' => array( |
|
201 | - 'description' => __( 'The recurring interval for a subscription item.', 'invoicing' ), |
|
202 | - 'type' => 'integer', |
|
203 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
204 | - ), |
|
205 | - |
|
206 | - 'recurring_limit' => array( |
|
207 | - 'description' => __( 'The maximum number of renewals for a subscription item.', 'invoicing' ), |
|
208 | - 'type' => 'integer', |
|
209 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
210 | - ), |
|
211 | - |
|
212 | - 'is_free_trial' => array( |
|
213 | - 'description' => __( 'Whether the item has a free trial period.', 'invoicing' ), |
|
214 | - 'type' => 'integer', |
|
215 | - 'enum' => array( 0, 1 ), |
|
216 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
217 | - ), |
|
218 | - |
|
219 | - 'trial_period' => array( |
|
220 | - 'description' => __( 'The trial period.', 'invoicing' ), |
|
221 | - 'type' => 'string', |
|
222 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
223 | - 'enum' => array( 'D', 'W', 'M', 'Y' ), |
|
224 | - ), |
|
225 | - |
|
226 | - 'trial_interval' => array( |
|
227 | - 'description' => __( 'The trial interval.', 'invoicing' ), |
|
228 | - 'type' => 'integer', |
|
229 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
230 | - ), |
|
231 | - |
|
232 | - 'first_renewal_date' => array( |
|
233 | - 'description' => __( 'The first renewal date in case the item was to be bought today.', 'invoicing' ), |
|
234 | - 'type' => 'string', |
|
235 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
236 | - 'readonly' => true, |
|
237 | - ), |
|
238 | - |
|
239 | - 'edit_url' => array( |
|
240 | - 'description' => __( 'The URL to edit an item.', 'invoicing' ), |
|
241 | - 'type' => 'string', |
|
242 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
243 | - 'readonly' => true, |
|
244 | - ), |
|
133 | + 'custom_name' => array( |
|
134 | + 'description' => __( 'Custom name for the item.', 'invoicing' ), |
|
135 | + 'type' => 'string', |
|
136 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
137 | + ), |
|
138 | + |
|
139 | + 'custom_singular_name' => array( |
|
140 | + 'description' => __( 'Custom singular name for the item.', 'invoicing' ), |
|
141 | + 'type' => 'string', |
|
142 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
143 | + ), |
|
144 | + |
|
145 | + 'is_dynamic_pricing' => array( |
|
146 | + 'description' => __( 'Whether or not customers can enter their own prices when checking out.', 'invoicing' ), |
|
147 | + 'type' => 'integer', |
|
148 | + 'enum' => array( 0, 1 ), |
|
149 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
150 | + ), |
|
151 | + |
|
152 | + 'minimum_price' => array( |
|
153 | + 'description' => __( 'For dynamic prices, this is the minimum price that a user can set.', 'invoicing' ), |
|
154 | + 'type' => 'number', |
|
155 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
156 | + ), |
|
157 | + |
|
158 | + 'is_recurring' => array( |
|
159 | + 'description' => __( 'Whether or not this is a subscription item.', 'invoicing' ), |
|
160 | + 'type' => 'integer', |
|
161 | + 'enum' => array( 0, 1 ), |
|
162 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
163 | + ), |
|
164 | + |
|
165 | + 'initial_price' => array( |
|
166 | + 'description' => __( 'The initial price of the item.', 'invoicing' ), |
|
167 | + 'type' => 'number', |
|
168 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
169 | + 'readonly' => true, |
|
170 | + ), |
|
171 | + |
|
172 | + 'the_initial_price' => array( |
|
173 | + 'description' => __( 'The formatted initial price of the item.', 'invoicing' ), |
|
174 | + 'type' => 'string', |
|
175 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
176 | + 'readonly' => true, |
|
177 | + ), |
|
178 | + |
|
179 | + 'recurring_price' => array( |
|
180 | + 'description' => __( 'The recurring price of the item.', 'invoicing' ), |
|
181 | + 'type' => 'number', |
|
182 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
183 | + 'readonly' => true, |
|
184 | + ), |
|
185 | + |
|
186 | + 'the_recurring_price' => array( |
|
187 | + 'description' => __( 'The formatted recurring price of the item.', 'invoicing' ), |
|
188 | + 'type' => 'string', |
|
189 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
190 | + 'readonly' => true, |
|
191 | + ), |
|
192 | + |
|
193 | + 'recurring_period' => array( |
|
194 | + 'description' => __( 'The recurring period for a recurring item.', 'invoicing' ), |
|
195 | + 'type' => 'string', |
|
196 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
197 | + 'enum' => array( 'D', 'W', 'M', 'Y' ), |
|
198 | + ), |
|
199 | + |
|
200 | + 'recurring_interval' => array( |
|
201 | + 'description' => __( 'The recurring interval for a subscription item.', 'invoicing' ), |
|
202 | + 'type' => 'integer', |
|
203 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
204 | + ), |
|
205 | + |
|
206 | + 'recurring_limit' => array( |
|
207 | + 'description' => __( 'The maximum number of renewals for a subscription item.', 'invoicing' ), |
|
208 | + 'type' => 'integer', |
|
209 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
210 | + ), |
|
211 | + |
|
212 | + 'is_free_trial' => array( |
|
213 | + 'description' => __( 'Whether the item has a free trial period.', 'invoicing' ), |
|
214 | + 'type' => 'integer', |
|
215 | + 'enum' => array( 0, 1 ), |
|
216 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
217 | + ), |
|
218 | + |
|
219 | + 'trial_period' => array( |
|
220 | + 'description' => __( 'The trial period.', 'invoicing' ), |
|
221 | + 'type' => 'string', |
|
222 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
223 | + 'enum' => array( 'D', 'W', 'M', 'Y' ), |
|
224 | + ), |
|
225 | + |
|
226 | + 'trial_interval' => array( |
|
227 | + 'description' => __( 'The trial interval.', 'invoicing' ), |
|
228 | + 'type' => 'integer', |
|
229 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
230 | + ), |
|
231 | + |
|
232 | + 'first_renewal_date' => array( |
|
233 | + 'description' => __( 'The first renewal date in case the item was to be bought today.', 'invoicing' ), |
|
234 | + 'type' => 'string', |
|
235 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
236 | + 'readonly' => true, |
|
237 | + ), |
|
238 | + |
|
239 | + 'edit_url' => array( |
|
240 | + 'description' => __( 'The URL to edit an item.', 'invoicing' ), |
|
241 | + 'type' => 'string', |
|
242 | + 'context' => array( 'view', 'edit', 'embed' ), |
|
243 | + 'readonly' => true, |
|
244 | + ), |
|
245 | 245 | ); |
@@ -13,30 +13,30 @@ discard block |
||
13 | 13 | class GetPaid_Manual_Gateway extends GetPaid_Payment_Gateway { |
14 | 14 | |
15 | 15 | /** |
16 | - * Payment method id. |
|
17 | - * |
|
18 | - * @var string |
|
19 | - */ |
|
16 | + * Payment method id. |
|
17 | + * |
|
18 | + * @var string |
|
19 | + */ |
|
20 | 20 | public $id = 'manual'; |
21 | 21 | |
22 | 22 | /** |
23 | - * An array of features that this gateway supports. |
|
24 | - * |
|
25 | - * @var array |
|
26 | - */ |
|
23 | + * An array of features that this gateway supports. |
|
24 | + * |
|
25 | + * @var array |
|
26 | + */ |
|
27 | 27 | protected $supports = array( 'subscription', 'addons' ); |
28 | 28 | |
29 | 29 | /** |
30 | - * Payment method order. |
|
31 | - * |
|
32 | - * @var int |
|
33 | - */ |
|
34 | - public $order = 11; |
|
30 | + * Payment method order. |
|
31 | + * |
|
32 | + * @var int |
|
33 | + */ |
|
34 | + public $order = 11; |
|
35 | 35 | |
36 | 36 | /** |
37 | - * Class constructor. |
|
38 | - */ |
|
39 | - public function __construct() { |
|
37 | + * Class constructor. |
|
38 | + */ |
|
39 | + public function __construct() { |
|
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | 42 | $this->title = __( 'Manual Payment', 'invoicing' ); |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | - * Process Payment. |
|
50 | - * |
|
51 | - * |
|
52 | - * @param WPInv_Invoice $invoice Invoice. |
|
53 | - * @param array $submission_data Posted checkout fields. |
|
54 | - * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
|
55 | - * @return array |
|
56 | - */ |
|
57 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
49 | + * Process Payment. |
|
50 | + * |
|
51 | + * |
|
52 | + * @param WPInv_Invoice $invoice Invoice. |
|
53 | + * @param array $submission_data Posted checkout fields. |
|
54 | + * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
|
55 | + * @return array |
|
56 | + */ |
|
57 | + public function process_payment( $invoice, $submission_data, $submission ) { |
|
58 | 58 | |
59 | 59 | // Mark it as paid. |
60 | 60 | $invoice->mark_paid(); |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * (Maybe) renews a manual subscription profile. |
|
72 | - * |
|
73 | - * |
|
74 | - * @param bool $should_expire |
|
71 | + * (Maybe) renews a manual subscription profile. |
|
72 | + * |
|
73 | + * |
|
74 | + * @param bool $should_expire |
|
75 | 75 | * @param WPInv_Subscription $subscription |
76 | - */ |
|
77 | - public function maybe_renew_subscription( $should_expire, $subscription ) { |
|
76 | + */ |
|
77 | + public function maybe_renew_subscription( $should_expire, $subscription ) { |
|
78 | 78 | |
79 | 79 | // Ensure its our subscription && it's active. |
80 | 80 | if ( 'manual' != $subscription->get_gateway() || ! $subscription->has_status( 'active trialling' ) ) { |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | - * Processes invoice addons. |
|
106 | - * |
|
107 | - * @param WPInv_Invoice $invoice |
|
108 | - * @param GetPaid_Form_Item[] $items |
|
109 | - * @return WPInv_Invoice |
|
110 | - */ |
|
111 | - public function process_addons( $invoice, $items ) { |
|
105 | + * Processes invoice addons. |
|
106 | + * |
|
107 | + * @param WPInv_Invoice $invoice |
|
108 | + * @param GetPaid_Form_Item[] $items |
|
109 | + * @return WPInv_Invoice |
|
110 | + */ |
|
111 | + public function process_addons( $invoice, $items ) { |
|
112 | 112 | |
113 | 113 | foreach ( $items as $item ) { |
114 | 114 | $invoice->add_item( $item ); |
@@ -13,633 +13,633 @@ discard block |
||
13 | 13 | class GetPaid_Post_Types_Admin { |
14 | 14 | |
15 | 15 | /** |
16 | - * Hook in methods. |
|
17 | - */ |
|
18 | - public static function init() { |
|
19 | - |
|
20 | - // Init metaboxes. |
|
21 | - GetPaid_Metaboxes::init(); |
|
22 | - |
|
23 | - // Filter the post updated messages. |
|
24 | - add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' ); |
|
25 | - |
|
26 | - // Filter post actions. |
|
27 | - add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 ); |
|
28 | - add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 ); |
|
29 | - |
|
30 | - // Invoice table columns. |
|
31 | - add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 ); |
|
32 | - add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 ); |
|
33 | - |
|
34 | - // Items table columns. |
|
35 | - add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 ); |
|
36 | - add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 ); |
|
37 | - add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 ); |
|
38 | - add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 ); |
|
39 | - add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 ); |
|
40 | - add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 ); |
|
41 | - |
|
42 | - // Payment forms columns. |
|
43 | - add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 ); |
|
44 | - add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 ); |
|
45 | - add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 ); |
|
46 | - |
|
47 | - // Discount table columns. |
|
48 | - add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 ); |
|
49 | - add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 ); |
|
50 | - |
|
51 | - // Deleting posts. |
|
52 | - add_action( 'delete_post', array( __CLASS__, 'delete_post' ) ); |
|
53 | - add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 ); |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * Post updated messages. |
|
58 | - */ |
|
59 | - public static function post_updated_messages( $messages ) { |
|
60 | - global $post; |
|
61 | - |
|
62 | - $messages['wpi_discount'] = array( |
|
63 | - 0 => '', |
|
64 | - 1 => __( 'Discount updated.', 'invoicing' ), |
|
65 | - 2 => __( 'Custom field updated.', 'invoicing' ), |
|
66 | - 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
67 | - 4 => __( 'Discount updated.', 'invoicing' ), |
|
68 | - 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
69 | - 6 => __( 'Discount updated.', 'invoicing' ), |
|
70 | - 7 => __( 'Discount saved.', 'invoicing' ), |
|
71 | - 8 => __( 'Discount submitted.', 'invoicing' ), |
|
72 | - 9 => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
73 | - 10 => __( 'Discount draft updated.', 'invoicing' ), |
|
74 | - ); |
|
75 | - |
|
76 | - $messages['wpi_payment_form'] = array( |
|
77 | - 0 => '', |
|
78 | - 1 => __( 'Payment Form updated.', 'invoicing' ), |
|
79 | - 2 => __( 'Custom field updated.', 'invoicing' ), |
|
80 | - 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
81 | - 4 => __( 'Payment Form updated.', 'invoicing' ), |
|
82 | - 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
83 | - 6 => __( 'Payment Form updated.', 'invoicing' ), |
|
84 | - 7 => __( 'Payment Form saved.', 'invoicing' ), |
|
85 | - 8 => __( 'Payment Form submitted.', 'invoicing' ), |
|
86 | - 9 => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
87 | - 10 => __( 'Payment Form draft updated.', 'invoicing' ), |
|
88 | - ); |
|
89 | - |
|
90 | - return $messages; |
|
91 | - |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * Post row actions. |
|
96 | - */ |
|
97 | - public static function post_row_actions( $actions, $post ) { |
|
98 | - |
|
99 | - $post = get_post( $post ); |
|
100 | - |
|
101 | - // We do not want to edit the default payment form. |
|
102 | - if ( 'wpi_payment_form' == $post->post_type && $post->ID == wpinv_get_default_payment_form() ) { |
|
103 | - unset( $actions['trash'] ); |
|
104 | - unset( $actions['inline hide-if-no-js'] ); |
|
105 | - } |
|
106 | - |
|
107 | - return $actions; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
16 | + * Hook in methods. |
|
17 | + */ |
|
18 | + public static function init() { |
|
19 | + |
|
20 | + // Init metaboxes. |
|
21 | + GetPaid_Metaboxes::init(); |
|
22 | + |
|
23 | + // Filter the post updated messages. |
|
24 | + add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' ); |
|
25 | + |
|
26 | + // Filter post actions. |
|
27 | + add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 ); |
|
28 | + add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 ); |
|
29 | + |
|
30 | + // Invoice table columns. |
|
31 | + add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 ); |
|
32 | + add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 ); |
|
33 | + |
|
34 | + // Items table columns. |
|
35 | + add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 ); |
|
36 | + add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 ); |
|
37 | + add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 ); |
|
38 | + add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 ); |
|
39 | + add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 ); |
|
40 | + add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 ); |
|
41 | + |
|
42 | + // Payment forms columns. |
|
43 | + add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 ); |
|
44 | + add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 ); |
|
45 | + add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 ); |
|
46 | + |
|
47 | + // Discount table columns. |
|
48 | + add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 ); |
|
49 | + add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 ); |
|
50 | + |
|
51 | + // Deleting posts. |
|
52 | + add_action( 'delete_post', array( __CLASS__, 'delete_post' ) ); |
|
53 | + add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 ); |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * Post updated messages. |
|
58 | + */ |
|
59 | + public static function post_updated_messages( $messages ) { |
|
60 | + global $post; |
|
61 | + |
|
62 | + $messages['wpi_discount'] = array( |
|
63 | + 0 => '', |
|
64 | + 1 => __( 'Discount updated.', 'invoicing' ), |
|
65 | + 2 => __( 'Custom field updated.', 'invoicing' ), |
|
66 | + 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
67 | + 4 => __( 'Discount updated.', 'invoicing' ), |
|
68 | + 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
69 | + 6 => __( 'Discount updated.', 'invoicing' ), |
|
70 | + 7 => __( 'Discount saved.', 'invoicing' ), |
|
71 | + 8 => __( 'Discount submitted.', 'invoicing' ), |
|
72 | + 9 => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
73 | + 10 => __( 'Discount draft updated.', 'invoicing' ), |
|
74 | + ); |
|
75 | + |
|
76 | + $messages['wpi_payment_form'] = array( |
|
77 | + 0 => '', |
|
78 | + 1 => __( 'Payment Form updated.', 'invoicing' ), |
|
79 | + 2 => __( 'Custom field updated.', 'invoicing' ), |
|
80 | + 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
81 | + 4 => __( 'Payment Form updated.', 'invoicing' ), |
|
82 | + 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
83 | + 6 => __( 'Payment Form updated.', 'invoicing' ), |
|
84 | + 7 => __( 'Payment Form saved.', 'invoicing' ), |
|
85 | + 8 => __( 'Payment Form submitted.', 'invoicing' ), |
|
86 | + 9 => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
87 | + 10 => __( 'Payment Form draft updated.', 'invoicing' ), |
|
88 | + ); |
|
89 | + |
|
90 | + return $messages; |
|
91 | + |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * Post row actions. |
|
96 | + */ |
|
97 | + public static function post_row_actions( $actions, $post ) { |
|
98 | + |
|
99 | + $post = get_post( $post ); |
|
100 | + |
|
101 | + // We do not want to edit the default payment form. |
|
102 | + if ( 'wpi_payment_form' == $post->post_type && $post->ID == wpinv_get_default_payment_form() ) { |
|
103 | + unset( $actions['trash'] ); |
|
104 | + unset( $actions['inline hide-if-no-js'] ); |
|
105 | + } |
|
106 | + |
|
107 | + return $actions; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | 111 | * Remove bulk edit option from admin side quote listing |
112 | 112 | * |
113 | 113 | * @since 1.0.0 |
114 | 114 | * @param array $actions post actions |
115 | - * @param WP_Post $post |
|
115 | + * @param WP_Post $post |
|
116 | 116 | * @return array $actions actions without edit option |
117 | 117 | */ |
118 | 118 | public static function filter_invoice_row_actions( $actions, $post ) { |
119 | 119 | |
120 | 120 | if ( getpaid_is_invoice_post_type( $post->post_type ) ) { |
121 | 121 | |
122 | - $actions = array(); |
|
123 | - $invoice = new WPInv_Invoice( $post ); |
|
124 | - |
|
125 | - $actions['edit'] = sprintf( |
|
126 | - '<a href="%1$s">%2$s</a>', |
|
127 | - esc_url( get_edit_post_link( $invoice->get_id() ) ), |
|
128 | - esc_html( __( 'Edit', 'invoicing' ) ) |
|
129 | - ); |
|
130 | - |
|
131 | - if ( ! $invoice->is_draft() ) { |
|
132 | - |
|
133 | - $actions['view'] = sprintf( |
|
134 | - '<a href="%1$s">%2$s</a>', |
|
135 | - esc_url( $invoice->get_view_url() ), |
|
136 | - sprintf( |
|
137 | - esc_html( __( 'View %s', 'invoicing' ) ), |
|
138 | - getpaid_get_post_type_label( $invoice->get_post_type(), false ) |
|
139 | - ) |
|
140 | - ); |
|
141 | - |
|
142 | - $actions['send'] = sprintf( |
|
143 | - '<a href="%1$s">%2$s</a>', |
|
144 | - esc_url( |
|
145 | - wp_nonce_url( |
|
146 | - add_query_arg( |
|
147 | - array( |
|
148 | - 'getpaid-admin-action' => 'send_invoice', |
|
149 | - 'invoice_id' => $invoice->get_id() |
|
150 | - ) |
|
151 | - ), |
|
152 | - 'getpaid-nonce', |
|
153 | - 'getpaid-nonce' |
|
154 | - ) |
|
155 | - ), |
|
156 | - esc_html( __( 'Send to Customer', 'invoicing' ) ) |
|
157 | - ); |
|
158 | - |
|
159 | - } |
|
122 | + $actions = array(); |
|
123 | + $invoice = new WPInv_Invoice( $post ); |
|
124 | + |
|
125 | + $actions['edit'] = sprintf( |
|
126 | + '<a href="%1$s">%2$s</a>', |
|
127 | + esc_url( get_edit_post_link( $invoice->get_id() ) ), |
|
128 | + esc_html( __( 'Edit', 'invoicing' ) ) |
|
129 | + ); |
|
130 | + |
|
131 | + if ( ! $invoice->is_draft() ) { |
|
132 | + |
|
133 | + $actions['view'] = sprintf( |
|
134 | + '<a href="%1$s">%2$s</a>', |
|
135 | + esc_url( $invoice->get_view_url() ), |
|
136 | + sprintf( |
|
137 | + esc_html( __( 'View %s', 'invoicing' ) ), |
|
138 | + getpaid_get_post_type_label( $invoice->get_post_type(), false ) |
|
139 | + ) |
|
140 | + ); |
|
141 | + |
|
142 | + $actions['send'] = sprintf( |
|
143 | + '<a href="%1$s">%2$s</a>', |
|
144 | + esc_url( |
|
145 | + wp_nonce_url( |
|
146 | + add_query_arg( |
|
147 | + array( |
|
148 | + 'getpaid-admin-action' => 'send_invoice', |
|
149 | + 'invoice_id' => $invoice->get_id() |
|
150 | + ) |
|
151 | + ), |
|
152 | + 'getpaid-nonce', |
|
153 | + 'getpaid-nonce' |
|
154 | + ) |
|
155 | + ), |
|
156 | + esc_html( __( 'Send to Customer', 'invoicing' ) ) |
|
157 | + ); |
|
158 | + |
|
159 | + } |
|
160 | 160 | |
161 | 161 | } |
162 | 162 | |
163 | 163 | return $actions; |
164 | - } |
|
164 | + } |
|
165 | 165 | |
166 | - /** |
|
167 | - * Returns an array of invoice table columns. |
|
168 | - */ |
|
169 | - public static function invoice_columns( $columns ) { |
|
166 | + /** |
|
167 | + * Returns an array of invoice table columns. |
|
168 | + */ |
|
169 | + public static function invoice_columns( $columns ) { |
|
170 | 170 | |
171 | - $columns = array( |
|
172 | - 'cb' => $columns['cb'], |
|
173 | - 'number' => __( 'Invoice', 'invoicing' ), |
|
174 | - 'customer' => __( 'Customer', 'invoicing' ), |
|
175 | - 'invoice_date' => __( 'Date', 'invoicing' ), |
|
176 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
177 | - 'recurring' => __( 'Recurring', 'invoicing' ), |
|
178 | - 'status' => __( 'Status', 'invoicing' ), |
|
179 | - ); |
|
171 | + $columns = array( |
|
172 | + 'cb' => $columns['cb'], |
|
173 | + 'number' => __( 'Invoice', 'invoicing' ), |
|
174 | + 'customer' => __( 'Customer', 'invoicing' ), |
|
175 | + 'invoice_date' => __( 'Date', 'invoicing' ), |
|
176 | + 'amount' => __( 'Amount', 'invoicing' ), |
|
177 | + 'recurring' => __( 'Recurring', 'invoicing' ), |
|
178 | + 'status' => __( 'Status', 'invoicing' ), |
|
179 | + ); |
|
180 | 180 | |
181 | - return apply_filters( 'wpi_invoice_table_columns', $columns ); |
|
182 | - } |
|
181 | + return apply_filters( 'wpi_invoice_table_columns', $columns ); |
|
182 | + } |
|
183 | 183 | |
184 | - /** |
|
185 | - * Displays invoice table columns. |
|
186 | - */ |
|
187 | - public static function display_invoice_columns( $column_name, $post_id ) { |
|
184 | + /** |
|
185 | + * Displays invoice table columns. |
|
186 | + */ |
|
187 | + public static function display_invoice_columns( $column_name, $post_id ) { |
|
188 | 188 | |
189 | - $invoice = new WPInv_Invoice( $post_id ); |
|
189 | + $invoice = new WPInv_Invoice( $post_id ); |
|
190 | 190 | |
191 | - switch ( $column_name ) { |
|
191 | + switch ( $column_name ) { |
|
192 | 192 | |
193 | - case 'invoice_date' : |
|
194 | - $date_time = esc_attr( $invoice->get_created_date() ); |
|
195 | - $date = getpaid_format_date_value( $date_time ); |
|
196 | - echo "<span title='$date_time'>$date</span>"; |
|
197 | - break; |
|
193 | + case 'invoice_date' : |
|
194 | + $date_time = esc_attr( $invoice->get_created_date() ); |
|
195 | + $date = getpaid_format_date_value( $date_time ); |
|
196 | + echo "<span title='$date_time'>$date</span>"; |
|
197 | + break; |
|
198 | 198 | |
199 | - case 'amount' : |
|
199 | + case 'amount' : |
|
200 | 200 | |
201 | - $amount = $invoice->get_total(); |
|
202 | - $formated_amount = wpinv_price( wpinv_format_amount( $amount ), $invoice->get_currency() ); |
|
201 | + $amount = $invoice->get_total(); |
|
202 | + $formated_amount = wpinv_price( wpinv_format_amount( $amount ), $invoice->get_currency() ); |
|
203 | 203 | |
204 | - if ( $invoice->is_refunded() ) { |
|
205 | - $refunded_amount = wpinv_price( wpinv_format_amount( 0 ), $invoice->get_currency() ); |
|
206 | - echo "<del>$formated_amount</del> <ins>$refunded_amount</ins>"; |
|
207 | - } else { |
|
204 | + if ( $invoice->is_refunded() ) { |
|
205 | + $refunded_amount = wpinv_price( wpinv_format_amount( 0 ), $invoice->get_currency() ); |
|
206 | + echo "<del>$formated_amount</del> <ins>$refunded_amount</ins>"; |
|
207 | + } else { |
|
208 | 208 | |
209 | - $discount = $invoice->get_total_discount(); |
|
209 | + $discount = $invoice->get_total_discount(); |
|
210 | 210 | |
211 | - if ( ! empty( $discount ) ) { |
|
212 | - $new_amount = wpinv_price( wpinv_format_amount( $amount + $discount ), $invoice->get_currency() ); |
|
213 | - echo "<del>$new_amount</del> <ins>$formated_amount</ins>"; |
|
214 | - } else { |
|
215 | - echo $formated_amount; |
|
216 | - } |
|
211 | + if ( ! empty( $discount ) ) { |
|
212 | + $new_amount = wpinv_price( wpinv_format_amount( $amount + $discount ), $invoice->get_currency() ); |
|
213 | + echo "<del>$new_amount</del> <ins>$formated_amount</ins>"; |
|
214 | + } else { |
|
215 | + echo $formated_amount; |
|
216 | + } |
|
217 | 217 | |
218 | - } |
|
218 | + } |
|
219 | 219 | |
220 | - break; |
|
220 | + break; |
|
221 | 221 | |
222 | - case 'status' : |
|
223 | - $status = sanitize_text_field( $invoice->get_status() ); |
|
224 | - $status_label = sanitize_text_field( $invoice->get_status_nicename() ); |
|
222 | + case 'status' : |
|
223 | + $status = sanitize_text_field( $invoice->get_status() ); |
|
224 | + $status_label = sanitize_text_field( $invoice->get_status_nicename() ); |
|
225 | 225 | |
226 | - // If it is paid, show the gateway title. |
|
227 | - if ( $invoice->is_paid() ) { |
|
228 | - $gateway = sanitize_text_field( $invoice->get_gateway_title() ); |
|
229 | - $gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), $gateway ); |
|
226 | + // If it is paid, show the gateway title. |
|
227 | + if ( $invoice->is_paid() ) { |
|
228 | + $gateway = sanitize_text_field( $invoice->get_gateway_title() ); |
|
229 | + $gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), $gateway ); |
|
230 | 230 | |
231 | - echo "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>"; |
|
232 | - } else { |
|
233 | - echo "<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>"; |
|
234 | - } |
|
231 | + echo "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>"; |
|
232 | + } else { |
|
233 | + echo "<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>"; |
|
234 | + } |
|
235 | 235 | |
236 | - // If it is not paid, display the overdue and view status. |
|
237 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
236 | + // If it is not paid, display the overdue and view status. |
|
237 | + if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
238 | 238 | |
239 | - // Invoice view status. |
|
240 | - if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) { |
|
241 | - echo ' <i class="fa fa-eye wpi-help-tip" title="'. esc_attr__( 'Viewed by Customer', 'invoicing' ).'"></i>'; |
|
242 | - } else { |
|
243 | - echo ' <i class="fa fa-eye-slash wpi-help-tip" title="'. esc_attr__( 'Not Viewed by Customer', 'invoicing' ).'"></i>'; |
|
244 | - } |
|
239 | + // Invoice view status. |
|
240 | + if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) { |
|
241 | + echo ' <i class="fa fa-eye wpi-help-tip" title="'. esc_attr__( 'Viewed by Customer', 'invoicing' ).'"></i>'; |
|
242 | + } else { |
|
243 | + echo ' <i class="fa fa-eye-slash wpi-help-tip" title="'. esc_attr__( 'Not Viewed by Customer', 'invoicing' ).'"></i>'; |
|
244 | + } |
|
245 | 245 | |
246 | - // Display the overview status. |
|
247 | - if ( wpinv_get_option( 'overdue_active' ) ) { |
|
248 | - $due_date = $invoice->get_due_date(); |
|
249 | - $fomatted = getpaid_format_date( $due_date ); |
|
246 | + // Display the overview status. |
|
247 | + if ( wpinv_get_option( 'overdue_active' ) ) { |
|
248 | + $due_date = $invoice->get_due_date(); |
|
249 | + $fomatted = getpaid_format_date( $due_date ); |
|
250 | 250 | |
251 | - if ( ! empty( $fomatted ) ) { |
|
252 | - $date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted ); |
|
253 | - echo "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>"; |
|
254 | - } |
|
255 | - } |
|
251 | + if ( ! empty( $fomatted ) ) { |
|
252 | + $date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted ); |
|
253 | + echo "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>"; |
|
254 | + } |
|
255 | + } |
|
256 | 256 | |
257 | - } |
|
257 | + } |
|
258 | 258 | |
259 | - break; |
|
259 | + break; |
|
260 | 260 | |
261 | - case 'recurring': |
|
261 | + case 'recurring': |
|
262 | 262 | |
263 | - if ( $invoice->is_recurring() ) { |
|
264 | - echo '<i class="fa fa-check" style="color:#43850a;"></i>'; |
|
265 | - } else { |
|
266 | - echo '<i class="fa fa-times" style="color:#616161;"></i>'; |
|
267 | - } |
|
268 | - break; |
|
263 | + if ( $invoice->is_recurring() ) { |
|
264 | + echo '<i class="fa fa-check" style="color:#43850a;"></i>'; |
|
265 | + } else { |
|
266 | + echo '<i class="fa fa-times" style="color:#616161;"></i>'; |
|
267 | + } |
|
268 | + break; |
|
269 | 269 | |
270 | - case 'number' : |
|
270 | + case 'number' : |
|
271 | 271 | |
272 | - $edit_link = esc_url( get_edit_post_link( $invoice->get_id() ) ); |
|
273 | - $invoice_number = sanitize_text_field( $invoice->get_number() ); |
|
274 | - $invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' ); |
|
272 | + $edit_link = esc_url( get_edit_post_link( $invoice->get_id() ) ); |
|
273 | + $invoice_number = sanitize_text_field( $invoice->get_number() ); |
|
274 | + $invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' ); |
|
275 | 275 | |
276 | - echo "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>"; |
|
276 | + echo "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>"; |
|
277 | 277 | |
278 | - break; |
|
278 | + break; |
|
279 | 279 | |
280 | - case 'customer' : |
|
280 | + case 'customer' : |
|
281 | 281 | |
282 | - $customer_name = $invoice->get_user_full_name(); |
|
282 | + $customer_name = $invoice->get_user_full_name(); |
|
283 | 283 | |
284 | - if ( empty( $customer_name ) ) { |
|
285 | - $customer_name = $invoice->get_email(); |
|
286 | - } |
|
284 | + if ( empty( $customer_name ) ) { |
|
285 | + $customer_name = $invoice->get_email(); |
|
286 | + } |
|
287 | 287 | |
288 | - if ( ! empty( $customer_name ) ) { |
|
289 | - $customer_details = esc_attr__( 'View Customer Details', 'invoicing' ); |
|
290 | - $view_link = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) ); |
|
291 | - echo "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>"; |
|
292 | - } else { |
|
293 | - echo '<div>—</div>'; |
|
294 | - } |
|
288 | + if ( ! empty( $customer_name ) ) { |
|
289 | + $customer_details = esc_attr__( 'View Customer Details', 'invoicing' ); |
|
290 | + $view_link = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) ); |
|
291 | + echo "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>"; |
|
292 | + } else { |
|
293 | + echo '<div>—</div>'; |
|
294 | + } |
|
295 | 295 | |
296 | - break; |
|
296 | + break; |
|
297 | 297 | |
298 | - } |
|
298 | + } |
|
299 | 299 | |
300 | - } |
|
300 | + } |
|
301 | 301 | |
302 | - /** |
|
303 | - * Returns an array of payment forms table columns. |
|
304 | - */ |
|
305 | - public static function payment_form_columns( $columns ) { |
|
302 | + /** |
|
303 | + * Returns an array of payment forms table columns. |
|
304 | + */ |
|
305 | + public static function payment_form_columns( $columns ) { |
|
306 | 306 | |
307 | - $columns = array( |
|
308 | - 'cb' => $columns['cb'], |
|
309 | - 'title' => __( 'Name', 'invoicing' ), |
|
310 | - 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
311 | - 'earnings' => __( 'Revenue', 'invoicing' ), |
|
312 | - 'refunds' => __( 'Refunded', 'invoicing' ), |
|
313 | - 'items' => __( 'Items', 'invoicing' ), |
|
314 | - 'date' => __( 'Date', 'invoicing' ), |
|
315 | - ); |
|
307 | + $columns = array( |
|
308 | + 'cb' => $columns['cb'], |
|
309 | + 'title' => __( 'Name', 'invoicing' ), |
|
310 | + 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
311 | + 'earnings' => __( 'Revenue', 'invoicing' ), |
|
312 | + 'refunds' => __( 'Refunded', 'invoicing' ), |
|
313 | + 'items' => __( 'Items', 'invoicing' ), |
|
314 | + 'date' => __( 'Date', 'invoicing' ), |
|
315 | + ); |
|
316 | 316 | |
317 | - return apply_filters( 'wpi_payment_form_table_columns', $columns ); |
|
317 | + return apply_filters( 'wpi_payment_form_table_columns', $columns ); |
|
318 | 318 | |
319 | - } |
|
319 | + } |
|
320 | 320 | |
321 | - /** |
|
322 | - * Displays payment form table columns. |
|
323 | - */ |
|
324 | - public static function display_payment_form_columns( $column_name, $post_id ) { |
|
321 | + /** |
|
322 | + * Displays payment form table columns. |
|
323 | + */ |
|
324 | + public static function display_payment_form_columns( $column_name, $post_id ) { |
|
325 | 325 | |
326 | - // Retrieve the payment form. |
|
327 | - $form = new GetPaid_Payment_Form( $post_id ); |
|
326 | + // Retrieve the payment form. |
|
327 | + $form = new GetPaid_Payment_Form( $post_id ); |
|
328 | 328 | |
329 | - switch ( $column_name ) { |
|
329 | + switch ( $column_name ) { |
|
330 | 330 | |
331 | - case 'earnings' : |
|
332 | - echo wpinv_price( wpinv_format_amount( $form->get_earned() ) ); |
|
333 | - break; |
|
331 | + case 'earnings' : |
|
332 | + echo wpinv_price( wpinv_format_amount( $form->get_earned() ) ); |
|
333 | + break; |
|
334 | 334 | |
335 | - case 'refunds' : |
|
336 | - echo wpinv_price( wpinv_format_amount( $form->get_refunded() ) ); |
|
337 | - break; |
|
335 | + case 'refunds' : |
|
336 | + echo wpinv_price( wpinv_format_amount( $form->get_refunded() ) ); |
|
337 | + break; |
|
338 | 338 | |
339 | - case 'refunds' : |
|
340 | - echo wpinv_price( wpinv_format_amount( $form->get_refunded() ) ); |
|
341 | - break; |
|
339 | + case 'refunds' : |
|
340 | + echo wpinv_price( wpinv_format_amount( $form->get_refunded() ) ); |
|
341 | + break; |
|
342 | 342 | |
343 | - case 'shortcode' : |
|
343 | + case 'shortcode' : |
|
344 | 344 | |
345 | - if ( $form->is_default() ) { |
|
346 | - echo '—'; |
|
347 | - } else { |
|
348 | - echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>'; |
|
349 | - } |
|
345 | + if ( $form->is_default() ) { |
|
346 | + echo '—'; |
|
347 | + } else { |
|
348 | + echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>'; |
|
349 | + } |
|
350 | 350 | |
351 | - break; |
|
351 | + break; |
|
352 | 352 | |
353 | - case 'items' : |
|
353 | + case 'items' : |
|
354 | 354 | |
355 | - $items = $form->get_items(); |
|
355 | + $items = $form->get_items(); |
|
356 | 356 | |
357 | - if ( $form->is_default() || empty( $items ) ) { |
|
358 | - echo '—'; |
|
359 | - return; |
|
360 | - } |
|
357 | + if ( $form->is_default() || empty( $items ) ) { |
|
358 | + echo '—'; |
|
359 | + return; |
|
360 | + } |
|
361 | 361 | |
362 | - $_items = array(); |
|
362 | + $_items = array(); |
|
363 | 363 | |
364 | - foreach ( $items as $item ) { |
|
365 | - $url = $item->get_edit_url(); |
|
364 | + foreach ( $items as $item ) { |
|
365 | + $url = $item->get_edit_url(); |
|
366 | 366 | |
367 | - if ( empty( $url ) ) { |
|
368 | - $_items[] = sanitize_text_field( $item->get_name() ); |
|
369 | - } else { |
|
370 | - $_items[] = sprintf( |
|
371 | - '<a href="%s">%s</a>', |
|
372 | - esc_url( $url ), |
|
373 | - sanitize_text_field( $item->get_name() ) |
|
374 | - ); |
|
375 | - } |
|
367 | + if ( empty( $url ) ) { |
|
368 | + $_items[] = sanitize_text_field( $item->get_name() ); |
|
369 | + } else { |
|
370 | + $_items[] = sprintf( |
|
371 | + '<a href="%s">%s</a>', |
|
372 | + esc_url( $url ), |
|
373 | + sanitize_text_field( $item->get_name() ) |
|
374 | + ); |
|
375 | + } |
|
376 | 376 | |
377 | - } |
|
377 | + } |
|
378 | 378 | |
379 | - echo implode( '<br>', $_items ); |
|
379 | + echo implode( '<br>', $_items ); |
|
380 | 380 | |
381 | - break; |
|
381 | + break; |
|
382 | 382 | |
383 | - } |
|
383 | + } |
|
384 | 384 | |
385 | - } |
|
385 | + } |
|
386 | 386 | |
387 | - /** |
|
388 | - * Filters post states. |
|
389 | - */ |
|
390 | - public static function filter_payment_form_state( $post_states, $post ) { |
|
387 | + /** |
|
388 | + * Filters post states. |
|
389 | + */ |
|
390 | + public static function filter_payment_form_state( $post_states, $post ) { |
|
391 | 391 | |
392 | - if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) { |
|
393 | - $post_states[ 'default_form' ] = __( 'Default Payment Form', 'invoicing' ); |
|
394 | - } |
|
392 | + if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) { |
|
393 | + $post_states[ 'default_form' ] = __( 'Default Payment Form', 'invoicing' ); |
|
394 | + } |
|
395 | 395 | |
396 | - return $post_states; |
|
397 | - |
|
398 | - } |
|
399 | - |
|
400 | - /** |
|
401 | - * Returns an array of coupon table columns. |
|
402 | - */ |
|
403 | - public static function discount_columns( $columns ) { |
|
404 | - |
|
405 | - $columns = array( |
|
406 | - 'cb' => $columns['cb'], |
|
407 | - 'title' => __( 'Name', 'invoicing' ), |
|
408 | - 'code' => __( 'Code', 'invoicing' ), |
|
409 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
410 | - 'usage' => __( 'Usage / Limit', 'invoicing' ), |
|
411 | - 'start_date' => __( 'Start Date', 'invoicing' ), |
|
412 | - 'expiry_date' => __( 'Expiry Date', 'invoicing' ), |
|
413 | - ); |
|
414 | - |
|
415 | - return apply_filters( 'wpi_discount_table_columns', $columns ); |
|
416 | - } |
|
417 | - |
|
418 | - /** |
|
419 | - * Filters post states. |
|
420 | - */ |
|
421 | - public static function filter_discount_state( $post_states, $post ) { |
|
422 | - |
|
423 | - if ( 'wpi_discount' == $post->post_type ) { |
|
424 | - |
|
425 | - $discount = new WPInv_Discount( $post ); |
|
426 | - |
|
427 | - $status = $discount->is_expired() ? 'expired' : $discount->get_status(); |
|
428 | - |
|
429 | - if ( $status != 'publish' ) { |
|
430 | - return array( |
|
431 | - 'discount_status' => wpinv_discount_status( $status ), |
|
432 | - ); |
|
433 | - } |
|
434 | - |
|
435 | - return array(); |
|
436 | - |
|
437 | - } |
|
438 | - |
|
439 | - return $post_states; |
|
440 | - |
|
441 | - } |
|
442 | - |
|
443 | - /** |
|
444 | - * Returns an array of items table columns. |
|
445 | - */ |
|
446 | - public static function item_columns( $columns ) { |
|
447 | - |
|
448 | - $columns = array( |
|
449 | - 'cb' => $columns['cb'], |
|
450 | - 'title' => __( 'Name', 'invoicing' ), |
|
451 | - 'price' => __( 'Price', 'invoicing' ), |
|
452 | - 'vat_rule' => __( 'VAT rule', 'invoicing' ), |
|
453 | - 'vat_class' => __( 'VAT class', 'invoicing' ), |
|
454 | - 'type' => __( 'Type', 'invoicing' ), |
|
455 | - 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
456 | - ); |
|
457 | - |
|
458 | - if ( ! wpinv_use_taxes() ) { |
|
459 | - unset( $columns['vat_rule'] ); |
|
460 | - unset( $columns['vat_class'] ); |
|
461 | - } |
|
462 | - |
|
463 | - return apply_filters( 'wpi_item_table_columns', $columns ); |
|
464 | - } |
|
465 | - |
|
466 | - /** |
|
467 | - * Returns an array of sortable items table columns. |
|
468 | - */ |
|
469 | - public static function sortable_item_columns( $columns ) { |
|
470 | - |
|
471 | - return array_merge( |
|
472 | - $columns, |
|
473 | - array( |
|
474 | - 'price' => 'price', |
|
475 | - 'vat_rule' => 'vat_rule', |
|
476 | - 'vat_class' => 'vat_class', |
|
477 | - 'type' => 'type', |
|
478 | - ) |
|
479 | - ); |
|
480 | - |
|
481 | - } |
|
482 | - |
|
483 | - /** |
|
484 | - * Displays items table columns. |
|
485 | - */ |
|
486 | - public static function display_item_columns( $column_name, $post_id ) { |
|
396 | + return $post_states; |
|
397 | + |
|
398 | + } |
|
399 | + |
|
400 | + /** |
|
401 | + * Returns an array of coupon table columns. |
|
402 | + */ |
|
403 | + public static function discount_columns( $columns ) { |
|
404 | + |
|
405 | + $columns = array( |
|
406 | + 'cb' => $columns['cb'], |
|
407 | + 'title' => __( 'Name', 'invoicing' ), |
|
408 | + 'code' => __( 'Code', 'invoicing' ), |
|
409 | + 'amount' => __( 'Amount', 'invoicing' ), |
|
410 | + 'usage' => __( 'Usage / Limit', 'invoicing' ), |
|
411 | + 'start_date' => __( 'Start Date', 'invoicing' ), |
|
412 | + 'expiry_date' => __( 'Expiry Date', 'invoicing' ), |
|
413 | + ); |
|
414 | + |
|
415 | + return apply_filters( 'wpi_discount_table_columns', $columns ); |
|
416 | + } |
|
417 | + |
|
418 | + /** |
|
419 | + * Filters post states. |
|
420 | + */ |
|
421 | + public static function filter_discount_state( $post_states, $post ) { |
|
422 | + |
|
423 | + if ( 'wpi_discount' == $post->post_type ) { |
|
424 | + |
|
425 | + $discount = new WPInv_Discount( $post ); |
|
426 | + |
|
427 | + $status = $discount->is_expired() ? 'expired' : $discount->get_status(); |
|
428 | + |
|
429 | + if ( $status != 'publish' ) { |
|
430 | + return array( |
|
431 | + 'discount_status' => wpinv_discount_status( $status ), |
|
432 | + ); |
|
433 | + } |
|
434 | + |
|
435 | + return array(); |
|
436 | + |
|
437 | + } |
|
438 | + |
|
439 | + return $post_states; |
|
440 | + |
|
441 | + } |
|
442 | + |
|
443 | + /** |
|
444 | + * Returns an array of items table columns. |
|
445 | + */ |
|
446 | + public static function item_columns( $columns ) { |
|
447 | + |
|
448 | + $columns = array( |
|
449 | + 'cb' => $columns['cb'], |
|
450 | + 'title' => __( 'Name', 'invoicing' ), |
|
451 | + 'price' => __( 'Price', 'invoicing' ), |
|
452 | + 'vat_rule' => __( 'VAT rule', 'invoicing' ), |
|
453 | + 'vat_class' => __( 'VAT class', 'invoicing' ), |
|
454 | + 'type' => __( 'Type', 'invoicing' ), |
|
455 | + 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
456 | + ); |
|
457 | + |
|
458 | + if ( ! wpinv_use_taxes() ) { |
|
459 | + unset( $columns['vat_rule'] ); |
|
460 | + unset( $columns['vat_class'] ); |
|
461 | + } |
|
462 | + |
|
463 | + return apply_filters( 'wpi_item_table_columns', $columns ); |
|
464 | + } |
|
465 | + |
|
466 | + /** |
|
467 | + * Returns an array of sortable items table columns. |
|
468 | + */ |
|
469 | + public static function sortable_item_columns( $columns ) { |
|
470 | + |
|
471 | + return array_merge( |
|
472 | + $columns, |
|
473 | + array( |
|
474 | + 'price' => 'price', |
|
475 | + 'vat_rule' => 'vat_rule', |
|
476 | + 'vat_class' => 'vat_class', |
|
477 | + 'type' => 'type', |
|
478 | + ) |
|
479 | + ); |
|
480 | + |
|
481 | + } |
|
482 | + |
|
483 | + /** |
|
484 | + * Displays items table columns. |
|
485 | + */ |
|
486 | + public static function display_item_columns( $column_name, $post_id ) { |
|
487 | 487 | |
488 | - $item = new WPInv_Item( $post_id ); |
|
488 | + $item = new WPInv_Item( $post_id ); |
|
489 | 489 | |
490 | - switch ( $column_name ) { |
|
490 | + switch ( $column_name ) { |
|
491 | 491 | |
492 | - case 'price' : |
|
492 | + case 'price' : |
|
493 | 493 | |
494 | - if ( ! $item->is_recurring() ) { |
|
495 | - echo $item->get_the_price(); |
|
496 | - break; |
|
497 | - } |
|
494 | + if ( ! $item->is_recurring() ) { |
|
495 | + echo $item->get_the_price(); |
|
496 | + break; |
|
497 | + } |
|
498 | 498 | |
499 | - $price = wp_sprintf( |
|
500 | - __( '%s / %s', 'invoicing' ), |
|
501 | - $item->get_the_price(), |
|
502 | - getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' ) |
|
503 | - ); |
|
499 | + $price = wp_sprintf( |
|
500 | + __( '%s / %s', 'invoicing' ), |
|
501 | + $item->get_the_price(), |
|
502 | + getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' ) |
|
503 | + ); |
|
504 | 504 | |
505 | - if ( $item->get_the_price() == $item->get_the_initial_price() ) { |
|
506 | - echo $price; |
|
507 | - break; |
|
508 | - } |
|
505 | + if ( $item->get_the_price() == $item->get_the_initial_price() ) { |
|
506 | + echo $price; |
|
507 | + break; |
|
508 | + } |
|
509 | 509 | |
510 | - echo $item->get_the_initial_price(); |
|
510 | + echo $item->get_the_initial_price(); |
|
511 | 511 | |
512 | - echo '<span class="meta">' . wp_sprintf( __( 'then %s', 'invoicing' ), $price ) .'</span>'; |
|
513 | - break; |
|
512 | + echo '<span class="meta">' . wp_sprintf( __( 'then %s', 'invoicing' ), $price ) .'</span>'; |
|
513 | + break; |
|
514 | 514 | |
515 | - case 'vat_rule' : |
|
516 | - echo getpaid_get_tax_rule_label( $item->get_vat_rule() ); |
|
517 | - break; |
|
515 | + case 'vat_rule' : |
|
516 | + echo getpaid_get_tax_rule_label( $item->get_vat_rule() ); |
|
517 | + break; |
|
518 | 518 | |
519 | - case 'vat_class' : |
|
520 | - echo getpaid_get_tax_class_label( $item->get_vat_class() ); |
|
521 | - break; |
|
519 | + case 'vat_class' : |
|
520 | + echo getpaid_get_tax_class_label( $item->get_vat_class() ); |
|
521 | + break; |
|
522 | 522 | |
523 | - case 'shortcode' : |
|
524 | - echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>'; |
|
525 | - break; |
|
523 | + case 'shortcode' : |
|
524 | + echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>'; |
|
525 | + break; |
|
526 | 526 | |
527 | - case 'type' : |
|
528 | - echo wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>'; |
|
529 | - break; |
|
527 | + case 'type' : |
|
528 | + echo wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>'; |
|
529 | + break; |
|
530 | 530 | |
531 | - } |
|
531 | + } |
|
532 | 532 | |
533 | - } |
|
533 | + } |
|
534 | 534 | |
535 | - /** |
|
536 | - * Lets users filter items using taxes. |
|
537 | - */ |
|
538 | - public static function add_item_filters( $post_type ) { |
|
535 | + /** |
|
536 | + * Lets users filter items using taxes. |
|
537 | + */ |
|
538 | + public static function add_item_filters( $post_type ) { |
|
539 | 539 | |
540 | - // Abort if we're not dealing with items. |
|
541 | - if ( $post_type != 'wpi_item' ) { |
|
542 | - return; |
|
543 | - } |
|
540 | + // Abort if we're not dealing with items. |
|
541 | + if ( $post_type != 'wpi_item' ) { |
|
542 | + return; |
|
543 | + } |
|
544 | 544 | |
545 | - // Filter by vat rules. |
|
546 | - if ( wpinv_use_taxes() ) { |
|
545 | + // Filter by vat rules. |
|
546 | + if ( wpinv_use_taxes() ) { |
|
547 | 547 | |
548 | - // Sanitize selected vat rule. |
|
549 | - $vat_rule = ''; |
|
550 | - $vat_rules = getpaid_get_tax_rules(); |
|
551 | - if ( isset( $_GET['vat_rule'] ) ) { |
|
552 | - $vat_rule = $_GET['vat_rule']; |
|
553 | - } |
|
554 | - |
|
555 | - // Filter by VAT rule. |
|
556 | - echo wpinv_html_select( |
|
557 | - array( |
|
558 | - 'options' => array_merge( |
|
559 | - array( |
|
560 | - '' => __( 'All VAT rules', 'invoicing' ) |
|
561 | - ), |
|
562 | - $vat_rules |
|
563 | - ), |
|
564 | - 'name' => 'vat_rule', |
|
565 | - 'id' => 'vat_rule', |
|
566 | - 'selected' => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '', |
|
567 | - 'show_option_all' => false, |
|
568 | - 'show_option_none' => false, |
|
569 | - ) |
|
570 | - ); |
|
571 | - |
|
572 | - // Filter by VAT class. |
|
548 | + // Sanitize selected vat rule. |
|
549 | + $vat_rule = ''; |
|
550 | + $vat_rules = getpaid_get_tax_rules(); |
|
551 | + if ( isset( $_GET['vat_rule'] ) ) { |
|
552 | + $vat_rule = $_GET['vat_rule']; |
|
553 | + } |
|
554 | + |
|
555 | + // Filter by VAT rule. |
|
556 | + echo wpinv_html_select( |
|
557 | + array( |
|
558 | + 'options' => array_merge( |
|
559 | + array( |
|
560 | + '' => __( 'All VAT rules', 'invoicing' ) |
|
561 | + ), |
|
562 | + $vat_rules |
|
563 | + ), |
|
564 | + 'name' => 'vat_rule', |
|
565 | + 'id' => 'vat_rule', |
|
566 | + 'selected' => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '', |
|
567 | + 'show_option_all' => false, |
|
568 | + 'show_option_none' => false, |
|
569 | + ) |
|
570 | + ); |
|
571 | + |
|
572 | + // Filter by VAT class. |
|
573 | 573 | |
574 | - // Sanitize selected vat rule. |
|
575 | - $vat_class = ''; |
|
576 | - $vat_classes = getpaid_get_tax_classes(); |
|
577 | - if ( isset( $_GET['vat_class'] ) ) { |
|
578 | - $vat_class = $_GET['vat_class']; |
|
579 | - } |
|
580 | - |
|
581 | - echo wpinv_html_select( |
|
582 | - array( |
|
583 | - 'options' => array_merge( |
|
584 | - array( |
|
585 | - '' => __( 'All VAT classes', 'invoicing' ) |
|
586 | - ), |
|
587 | - $vat_classes |
|
588 | - ), |
|
589 | - 'name' => 'vat_class', |
|
590 | - 'id' => 'vat_class', |
|
591 | - 'selected' => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '', |
|
592 | - 'show_option_all' => false, |
|
593 | - 'show_option_none' => false, |
|
594 | - ) |
|
595 | - ); |
|
596 | - |
|
597 | - } |
|
598 | - |
|
599 | - // Filter by item type. |
|
600 | - $type = ''; |
|
601 | - if ( isset( $_GET['type'] ) ) { |
|
602 | - $type = $_GET['type']; |
|
603 | - } |
|
604 | - |
|
605 | - echo wpinv_html_select( |
|
606 | - array( |
|
607 | - 'options' => array_merge( |
|
608 | - array( |
|
609 | - '' => __( 'All item types', 'invoicing' ) |
|
610 | - ), |
|
611 | - wpinv_get_item_types() |
|
612 | - ), |
|
613 | - 'name' => 'type', |
|
614 | - 'id' => 'type', |
|
615 | - 'selected' => in_array( $type, wpinv_item_types() ) ? $type : '', |
|
616 | - 'show_option_all' => false, |
|
617 | - 'show_option_none' => false, |
|
618 | - ) |
|
619 | - ); |
|
620 | - |
|
621 | - } |
|
622 | - |
|
623 | - /** |
|
624 | - * Filters the item query. |
|
625 | - */ |
|
626 | - public static function filter_item_query( $query ) { |
|
627 | - |
|
628 | - // modify the query only if it admin and main query. |
|
629 | - if ( ! ( is_admin() && $query->is_main_query() ) ){ |
|
630 | - return $query; |
|
631 | - } |
|
632 | - |
|
633 | - // we want to modify the query for our items. |
|
634 | - if ( 'wpi_item' != $query->query['post_type'] ){ |
|
635 | - return $query; |
|
636 | - } |
|
637 | - |
|
638 | - if ( empty( $query->query_vars['meta_query'] ) ) { |
|
639 | - $query->query_vars['meta_query'] = array(); |
|
640 | - } |
|
641 | - |
|
642 | - // Filter vat rule type |
|
574 | + // Sanitize selected vat rule. |
|
575 | + $vat_class = ''; |
|
576 | + $vat_classes = getpaid_get_tax_classes(); |
|
577 | + if ( isset( $_GET['vat_class'] ) ) { |
|
578 | + $vat_class = $_GET['vat_class']; |
|
579 | + } |
|
580 | + |
|
581 | + echo wpinv_html_select( |
|
582 | + array( |
|
583 | + 'options' => array_merge( |
|
584 | + array( |
|
585 | + '' => __( 'All VAT classes', 'invoicing' ) |
|
586 | + ), |
|
587 | + $vat_classes |
|
588 | + ), |
|
589 | + 'name' => 'vat_class', |
|
590 | + 'id' => 'vat_class', |
|
591 | + 'selected' => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '', |
|
592 | + 'show_option_all' => false, |
|
593 | + 'show_option_none' => false, |
|
594 | + ) |
|
595 | + ); |
|
596 | + |
|
597 | + } |
|
598 | + |
|
599 | + // Filter by item type. |
|
600 | + $type = ''; |
|
601 | + if ( isset( $_GET['type'] ) ) { |
|
602 | + $type = $_GET['type']; |
|
603 | + } |
|
604 | + |
|
605 | + echo wpinv_html_select( |
|
606 | + array( |
|
607 | + 'options' => array_merge( |
|
608 | + array( |
|
609 | + '' => __( 'All item types', 'invoicing' ) |
|
610 | + ), |
|
611 | + wpinv_get_item_types() |
|
612 | + ), |
|
613 | + 'name' => 'type', |
|
614 | + 'id' => 'type', |
|
615 | + 'selected' => in_array( $type, wpinv_item_types() ) ? $type : '', |
|
616 | + 'show_option_all' => false, |
|
617 | + 'show_option_none' => false, |
|
618 | + ) |
|
619 | + ); |
|
620 | + |
|
621 | + } |
|
622 | + |
|
623 | + /** |
|
624 | + * Filters the item query. |
|
625 | + */ |
|
626 | + public static function filter_item_query( $query ) { |
|
627 | + |
|
628 | + // modify the query only if it admin and main query. |
|
629 | + if ( ! ( is_admin() && $query->is_main_query() ) ){ |
|
630 | + return $query; |
|
631 | + } |
|
632 | + |
|
633 | + // we want to modify the query for our items. |
|
634 | + if ( 'wpi_item' != $query->query['post_type'] ){ |
|
635 | + return $query; |
|
636 | + } |
|
637 | + |
|
638 | + if ( empty( $query->query_vars['meta_query'] ) ) { |
|
639 | + $query->query_vars['meta_query'] = array(); |
|
640 | + } |
|
641 | + |
|
642 | + // Filter vat rule type |
|
643 | 643 | if ( ! empty( $_GET['vat_rule'] ) ) { |
644 | 644 | $query->query_vars['meta_query'][] = array( |
645 | 645 | 'key' => '_wpinv_vat_rule', |
@@ -664,94 +664,94 @@ discard block |
||
664 | 664 | 'value' => sanitize_text_field( $_GET['type'] ), |
665 | 665 | 'compare' => '=' |
666 | 666 | ); |
667 | - } |
|
668 | - |
|
669 | - } |
|
670 | - |
|
671 | - /** |
|
672 | - * Reorders items. |
|
673 | - */ |
|
674 | - public static function reorder_items( $vars ) { |
|
675 | - global $typenow; |
|
676 | - |
|
677 | - if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) { |
|
678 | - return $vars; |
|
679 | - } |
|
680 | - |
|
681 | - // By item type. |
|
682 | - if ( 'type' == $vars['orderby'] ) { |
|
683 | - return array_merge( |
|
684 | - $vars, |
|
685 | - array( |
|
686 | - 'meta_key' => '_wpinv_type', |
|
687 | - 'orderby' => 'meta_value' |
|
688 | - ) |
|
689 | - ); |
|
690 | - } |
|
691 | - |
|
692 | - // By vat class. |
|
693 | - if ( 'vat_class' == $vars['orderby'] ) { |
|
694 | - return array_merge( |
|
695 | - $vars, |
|
696 | - array( |
|
697 | - 'meta_key' => '_wpinv_vat_class', |
|
698 | - 'orderby' => 'meta_value' |
|
699 | - ) |
|
700 | - ); |
|
701 | - } |
|
702 | - |
|
703 | - // By vat rule. |
|
704 | - if ( 'vat_rule' == $vars['orderby'] ) { |
|
705 | - return array_merge( |
|
706 | - $vars, |
|
707 | - array( |
|
708 | - 'meta_key' => '_wpinv_vat_rule', |
|
709 | - 'orderby' => 'meta_value' |
|
710 | - ) |
|
711 | - ); |
|
712 | - } |
|
713 | - |
|
714 | - // By price. |
|
715 | - if ( 'price' == $vars['orderby'] ) { |
|
716 | - return array_merge( |
|
717 | - $vars, |
|
718 | - array( |
|
719 | - 'meta_key' => '_wpinv_price', |
|
720 | - 'orderby' => 'meta_value_num' |
|
721 | - ) |
|
722 | - ); |
|
723 | - } |
|
724 | - |
|
725 | - return $vars; |
|
726 | - |
|
727 | - } |
|
728 | - |
|
729 | - /** |
|
730 | - * Fired when deleting a post. |
|
731 | - */ |
|
732 | - public static function delete_post( $post_id ) { |
|
733 | - |
|
734 | - switch ( get_post_type( $post_id ) ) { |
|
735 | - |
|
736 | - case 'wpi_item' : |
|
737 | - do_action( "getpaid_before_delete_item", new WPInv_Item( $post_id ) ); |
|
738 | - break; |
|
739 | - |
|
740 | - case 'wpi_payment_form' : |
|
741 | - do_action( "getpaid_before_delete_payment_form", new GetPaid_Payment_Form( $post_id ) ); |
|
742 | - break; |
|
743 | - |
|
744 | - case 'wpi_discount' : |
|
745 | - do_action( "getpaid_before_delete_discount", new WPInv_Discount( $post_id ) ); |
|
746 | - break; |
|
747 | - |
|
748 | - case 'wpi_invoice' : |
|
749 | - $invoice = new WPInv_Invoice( $post_id ); |
|
750 | - do_action( "getpaid_before_delete_invoice", $invoice ); |
|
751 | - $invoice->get_data_store()->delete_items( $invoice ); |
|
752 | - $invoice->get_data_store()->delete_special_fields( $invoice ); |
|
753 | - break; |
|
754 | - } |
|
755 | - } |
|
667 | + } |
|
668 | + |
|
669 | + } |
|
670 | + |
|
671 | + /** |
|
672 | + * Reorders items. |
|
673 | + */ |
|
674 | + public static function reorder_items( $vars ) { |
|
675 | + global $typenow; |
|
676 | + |
|
677 | + if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) { |
|
678 | + return $vars; |
|
679 | + } |
|
680 | + |
|
681 | + // By item type. |
|
682 | + if ( 'type' == $vars['orderby'] ) { |
|
683 | + return array_merge( |
|
684 | + $vars, |
|
685 | + array( |
|
686 | + 'meta_key' => '_wpinv_type', |
|
687 | + 'orderby' => 'meta_value' |
|
688 | + ) |
|
689 | + ); |
|
690 | + } |
|
691 | + |
|
692 | + // By vat class. |
|
693 | + if ( 'vat_class' == $vars['orderby'] ) { |
|
694 | + return array_merge( |
|
695 | + $vars, |
|
696 | + array( |
|
697 | + 'meta_key' => '_wpinv_vat_class', |
|
698 | + 'orderby' => 'meta_value' |
|
699 | + ) |
|
700 | + ); |
|
701 | + } |
|
702 | + |
|
703 | + // By vat rule. |
|
704 | + if ( 'vat_rule' == $vars['orderby'] ) { |
|
705 | + return array_merge( |
|
706 | + $vars, |
|
707 | + array( |
|
708 | + 'meta_key' => '_wpinv_vat_rule', |
|
709 | + 'orderby' => 'meta_value' |
|
710 | + ) |
|
711 | + ); |
|
712 | + } |
|
713 | + |
|
714 | + // By price. |
|
715 | + if ( 'price' == $vars['orderby'] ) { |
|
716 | + return array_merge( |
|
717 | + $vars, |
|
718 | + array( |
|
719 | + 'meta_key' => '_wpinv_price', |
|
720 | + 'orderby' => 'meta_value_num' |
|
721 | + ) |
|
722 | + ); |
|
723 | + } |
|
724 | + |
|
725 | + return $vars; |
|
726 | + |
|
727 | + } |
|
728 | + |
|
729 | + /** |
|
730 | + * Fired when deleting a post. |
|
731 | + */ |
|
732 | + public static function delete_post( $post_id ) { |
|
733 | + |
|
734 | + switch ( get_post_type( $post_id ) ) { |
|
735 | + |
|
736 | + case 'wpi_item' : |
|
737 | + do_action( "getpaid_before_delete_item", new WPInv_Item( $post_id ) ); |
|
738 | + break; |
|
739 | + |
|
740 | + case 'wpi_payment_form' : |
|
741 | + do_action( "getpaid_before_delete_payment_form", new GetPaid_Payment_Form( $post_id ) ); |
|
742 | + break; |
|
743 | + |
|
744 | + case 'wpi_discount' : |
|
745 | + do_action( "getpaid_before_delete_discount", new WPInv_Discount( $post_id ) ); |
|
746 | + break; |
|
747 | + |
|
748 | + case 'wpi_invoice' : |
|
749 | + $invoice = new WPInv_Invoice( $post_id ); |
|
750 | + do_action( "getpaid_before_delete_invoice", $invoice ); |
|
751 | + $invoice->get_data_store()->delete_items( $invoice ); |
|
752 | + $invoice->get_data_store()->delete_special_fields( $invoice ); |
|
753 | + break; |
|
754 | + } |
|
755 | + } |
|
756 | 756 | |
757 | 757 | } |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | class InstalledVersions |
13 | 13 | { |
14 | 14 | private static $installed = array ( |
15 | - 'root' => |
|
16 | - array ( |
|
15 | + 'root' => |
|
16 | + array ( |
|
17 | 17 | 'pretty_version' => 'dev-master', |
18 | 18 | 'version' => 'dev-master', |
19 | 19 | 'aliases' => |
@@ -21,87 +21,87 @@ discard block |
||
21 | 21 | ), |
22 | 22 | 'reference' => 'e7ff90e7321765e53e3b594204dc0a79ac15f567', |
23 | 23 | 'name' => 'ayecode/invoicing', |
24 | - ), |
|
25 | - 'versions' => |
|
26 | - array ( |
|
24 | + ), |
|
25 | + 'versions' => |
|
26 | + array ( |
|
27 | 27 | 'ayecode/ayecode-connect-helper' => |
28 | 28 | array ( |
29 | - 'pretty_version' => '1.0.3', |
|
30 | - 'version' => '1.0.3.0', |
|
31 | - 'aliases' => |
|
32 | - array ( |
|
33 | - ), |
|
34 | - 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
|
29 | + 'pretty_version' => '1.0.3', |
|
30 | + 'version' => '1.0.3.0', |
|
31 | + 'aliases' => |
|
32 | + array ( |
|
33 | + ), |
|
34 | + 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
|
35 | 35 | ), |
36 | 36 | 'ayecode/invoicing' => |
37 | 37 | array ( |
38 | - 'pretty_version' => 'dev-master', |
|
39 | - 'version' => 'dev-master', |
|
40 | - 'aliases' => |
|
41 | - array ( |
|
42 | - ), |
|
43 | - 'reference' => 'e7ff90e7321765e53e3b594204dc0a79ac15f567', |
|
38 | + 'pretty_version' => 'dev-master', |
|
39 | + 'version' => 'dev-master', |
|
40 | + 'aliases' => |
|
41 | + array ( |
|
42 | + ), |
|
43 | + 'reference' => 'e7ff90e7321765e53e3b594204dc0a79ac15f567', |
|
44 | 44 | ), |
45 | 45 | 'ayecode/wp-ayecode-ui' => |
46 | 46 | array ( |
47 | - 'pretty_version' => '0.1.36', |
|
48 | - 'version' => '0.1.36.0', |
|
49 | - 'aliases' => |
|
50 | - array ( |
|
51 | - ), |
|
52 | - 'reference' => '384b684e795db63caa50f1312b6c5cb5250c004b', |
|
47 | + 'pretty_version' => '0.1.36', |
|
48 | + 'version' => '0.1.36.0', |
|
49 | + 'aliases' => |
|
50 | + array ( |
|
51 | + ), |
|
52 | + 'reference' => '384b684e795db63caa50f1312b6c5cb5250c004b', |
|
53 | 53 | ), |
54 | 54 | 'ayecode/wp-font-awesome-settings' => |
55 | 55 | array ( |
56 | - 'pretty_version' => '1.0.12', |
|
57 | - 'version' => '1.0.12.0', |
|
58 | - 'aliases' => |
|
59 | - array ( |
|
60 | - ), |
|
61 | - 'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288', |
|
56 | + 'pretty_version' => '1.0.12', |
|
57 | + 'version' => '1.0.12.0', |
|
58 | + 'aliases' => |
|
59 | + array ( |
|
60 | + ), |
|
61 | + 'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288', |
|
62 | 62 | ), |
63 | 63 | 'ayecode/wp-super-duper' => |
64 | 64 | array ( |
65 | - 'pretty_version' => '1.0.22', |
|
66 | - 'version' => '1.0.22.0', |
|
67 | - 'aliases' => |
|
68 | - array ( |
|
69 | - ), |
|
70 | - 'reference' => '42b638502c9e4be0877f27903df7c7ed2080bdac', |
|
65 | + 'pretty_version' => '1.0.22', |
|
66 | + 'version' => '1.0.22.0', |
|
67 | + 'aliases' => |
|
68 | + array ( |
|
69 | + ), |
|
70 | + 'reference' => '42b638502c9e4be0877f27903df7c7ed2080bdac', |
|
71 | 71 | ), |
72 | 72 | 'composer/installers' => |
73 | 73 | array ( |
74 | - 'pretty_version' => 'v1.9.0', |
|
75 | - 'version' => '1.9.0.0', |
|
76 | - 'aliases' => |
|
77 | - array ( |
|
78 | - ), |
|
79 | - 'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca', |
|
74 | + 'pretty_version' => 'v1.9.0', |
|
75 | + 'version' => '1.9.0.0', |
|
76 | + 'aliases' => |
|
77 | + array ( |
|
78 | + ), |
|
79 | + 'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca', |
|
80 | 80 | ), |
81 | 81 | 'maxmind-db/reader' => |
82 | 82 | array ( |
83 | - 'pretty_version' => 'v1.6.0', |
|
84 | - 'version' => '1.6.0.0', |
|
85 | - 'aliases' => |
|
86 | - array ( |
|
87 | - ), |
|
88 | - 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
|
83 | + 'pretty_version' => 'v1.6.0', |
|
84 | + 'version' => '1.6.0.0', |
|
85 | + 'aliases' => |
|
86 | + array ( |
|
87 | + ), |
|
88 | + 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
|
89 | 89 | ), |
90 | 90 | 'roundcube/plugin-installer' => |
91 | 91 | array ( |
92 | - 'replaced' => |
|
93 | - array ( |
|
92 | + 'replaced' => |
|
93 | + array ( |
|
94 | 94 | 0 => '*', |
95 | - ), |
|
95 | + ), |
|
96 | 96 | ), |
97 | 97 | 'shama/baton' => |
98 | 98 | array ( |
99 | - 'replaced' => |
|
100 | - array ( |
|
99 | + 'replaced' => |
|
100 | + array ( |
|
101 | 101 | 0 => '*', |
102 | - ), |
|
102 | + ), |
|
103 | + ), |
|
103 | 104 | ), |
104 | - ), |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php return array ( |
2 | - 'root' => |
|
3 | - array ( |
|
2 | + 'root' => |
|
3 | + array ( |
|
4 | 4 | 'pretty_version' => 'dev-master', |
5 | 5 | 'version' => 'dev-master', |
6 | 6 | 'aliases' => |
@@ -8,85 +8,85 @@ discard block |
||
8 | 8 | ), |
9 | 9 | 'reference' => 'e7ff90e7321765e53e3b594204dc0a79ac15f567', |
10 | 10 | 'name' => 'ayecode/invoicing', |
11 | - ), |
|
12 | - 'versions' => |
|
13 | - array ( |
|
11 | + ), |
|
12 | + 'versions' => |
|
13 | + array ( |
|
14 | 14 | 'ayecode/ayecode-connect-helper' => |
15 | 15 | array ( |
16 | - 'pretty_version' => '1.0.3', |
|
17 | - 'version' => '1.0.3.0', |
|
18 | - 'aliases' => |
|
19 | - array ( |
|
20 | - ), |
|
21 | - 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
|
16 | + 'pretty_version' => '1.0.3', |
|
17 | + 'version' => '1.0.3.0', |
|
18 | + 'aliases' => |
|
19 | + array ( |
|
20 | + ), |
|
21 | + 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
|
22 | 22 | ), |
23 | 23 | 'ayecode/invoicing' => |
24 | 24 | array ( |
25 | - 'pretty_version' => 'dev-master', |
|
26 | - 'version' => 'dev-master', |
|
27 | - 'aliases' => |
|
28 | - array ( |
|
29 | - ), |
|
30 | - 'reference' => 'e7ff90e7321765e53e3b594204dc0a79ac15f567', |
|
25 | + 'pretty_version' => 'dev-master', |
|
26 | + 'version' => 'dev-master', |
|
27 | + 'aliases' => |
|
28 | + array ( |
|
29 | + ), |
|
30 | + 'reference' => 'e7ff90e7321765e53e3b594204dc0a79ac15f567', |
|
31 | 31 | ), |
32 | 32 | 'ayecode/wp-ayecode-ui' => |
33 | 33 | array ( |
34 | - 'pretty_version' => '0.1.36', |
|
35 | - 'version' => '0.1.36.0', |
|
36 | - 'aliases' => |
|
37 | - array ( |
|
38 | - ), |
|
39 | - 'reference' => '384b684e795db63caa50f1312b6c5cb5250c004b', |
|
34 | + 'pretty_version' => '0.1.36', |
|
35 | + 'version' => '0.1.36.0', |
|
36 | + 'aliases' => |
|
37 | + array ( |
|
38 | + ), |
|
39 | + 'reference' => '384b684e795db63caa50f1312b6c5cb5250c004b', |
|
40 | 40 | ), |
41 | 41 | 'ayecode/wp-font-awesome-settings' => |
42 | 42 | array ( |
43 | - 'pretty_version' => '1.0.12', |
|
44 | - 'version' => '1.0.12.0', |
|
45 | - 'aliases' => |
|
46 | - array ( |
|
47 | - ), |
|
48 | - 'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288', |
|
43 | + 'pretty_version' => '1.0.12', |
|
44 | + 'version' => '1.0.12.0', |
|
45 | + 'aliases' => |
|
46 | + array ( |
|
47 | + ), |
|
48 | + 'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288', |
|
49 | 49 | ), |
50 | 50 | 'ayecode/wp-super-duper' => |
51 | 51 | array ( |
52 | - 'pretty_version' => '1.0.22', |
|
53 | - 'version' => '1.0.22.0', |
|
54 | - 'aliases' => |
|
55 | - array ( |
|
56 | - ), |
|
57 | - 'reference' => '42b638502c9e4be0877f27903df7c7ed2080bdac', |
|
52 | + 'pretty_version' => '1.0.22', |
|
53 | + 'version' => '1.0.22.0', |
|
54 | + 'aliases' => |
|
55 | + array ( |
|
56 | + ), |
|
57 | + 'reference' => '42b638502c9e4be0877f27903df7c7ed2080bdac', |
|
58 | 58 | ), |
59 | 59 | 'composer/installers' => |
60 | 60 | array ( |
61 | - 'pretty_version' => 'v1.9.0', |
|
62 | - 'version' => '1.9.0.0', |
|
63 | - 'aliases' => |
|
64 | - array ( |
|
65 | - ), |
|
66 | - 'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca', |
|
61 | + 'pretty_version' => 'v1.9.0', |
|
62 | + 'version' => '1.9.0.0', |
|
63 | + 'aliases' => |
|
64 | + array ( |
|
65 | + ), |
|
66 | + 'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca', |
|
67 | 67 | ), |
68 | 68 | 'maxmind-db/reader' => |
69 | 69 | array ( |
70 | - 'pretty_version' => 'v1.6.0', |
|
71 | - 'version' => '1.6.0.0', |
|
72 | - 'aliases' => |
|
73 | - array ( |
|
74 | - ), |
|
75 | - 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
|
70 | + 'pretty_version' => 'v1.6.0', |
|
71 | + 'version' => '1.6.0.0', |
|
72 | + 'aliases' => |
|
73 | + array ( |
|
74 | + ), |
|
75 | + 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
|
76 | 76 | ), |
77 | 77 | 'roundcube/plugin-installer' => |
78 | 78 | array ( |
79 | - 'replaced' => |
|
80 | - array ( |
|
79 | + 'replaced' => |
|
80 | + array ( |
|
81 | 81 | 0 => '*', |
82 | - ), |
|
82 | + ), |
|
83 | 83 | ), |
84 | 84 | 'shama/baton' => |
85 | 85 | array ( |
86 | - 'replaced' => |
|
87 | - array ( |
|
86 | + 'replaced' => |
|
87 | + array ( |
|
88 | 88 | 0 => '*', |
89 | - ), |
|
89 | + ), |
|
90 | + ), |
|
90 | 91 | ), |
91 | - ), |
|
92 | 92 | ); |
@@ -7,40 +7,40 @@ |
||
7 | 7 | * Bail if we are not in WP. |
8 | 8 | */ |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; |
|
10 | + exit; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Set the version only if its the current newest while loading. |
15 | 15 | */ |
16 | 16 | add_action('after_setup_theme', function () { |
17 | - global $ayecode_ui_version,$ayecode_ui_file_key; |
|
18 | - $this_version = "0.1.36"; |
|
19 | - if(version_compare($this_version , $ayecode_ui_version, '>')){ |
|
20 | - $ayecode_ui_version = $this_version ; |
|
21 | - $ayecode_ui_file_key = wp_hash( __FILE__ ); |
|
22 | - } |
|
17 | + global $ayecode_ui_version,$ayecode_ui_file_key; |
|
18 | + $this_version = "0.1.36"; |
|
19 | + if(version_compare($this_version , $ayecode_ui_version, '>')){ |
|
20 | + $ayecode_ui_version = $this_version ; |
|
21 | + $ayecode_ui_file_key = wp_hash( __FILE__ ); |
|
22 | + } |
|
23 | 23 | },0); |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Load this version of WP Bootstrap Settings only if the file hash is the current one. |
27 | 27 | */ |
28 | 28 | add_action('after_setup_theme', function () { |
29 | - global $ayecode_ui_file_key; |
|
30 | - if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){ |
|
31 | - include_once( dirname( __FILE__ ) . '/includes/class-aui.php' ); |
|
32 | - include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' ); |
|
33 | - } |
|
29 | + global $ayecode_ui_file_key; |
|
30 | + if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){ |
|
31 | + include_once( dirname( __FILE__ ) . '/includes/class-aui.php' ); |
|
32 | + include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' ); |
|
33 | + } |
|
34 | 34 | },1); |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Add the function that calls the class. |
38 | 38 | */ |
39 | 39 | if(!function_exists('aui')){ |
40 | - function aui(){ |
|
41 | - if(!class_exists("AUI",false)){ |
|
42 | - return false; |
|
43 | - } |
|
44 | - return AUI::instance(); |
|
45 | - } |
|
40 | + function aui(){ |
|
41 | + if(!class_exists("AUI",false)){ |
|
42 | + return false; |
|
43 | + } |
|
44 | + return AUI::instance(); |
|
45 | + } |
|
46 | 46 | } |
47 | 47 | \ No newline at end of file |