@@ -1,99 +1,99 @@ |
||
1 | -<?php return array ( |
|
1 | +<?php return array( |
|
2 | 2 | 'root' => |
3 | - array ( |
|
3 | + array( |
|
4 | 4 | 'pretty_version' => 'dev-master', |
5 | 5 | 'version' => 'dev-master', |
6 | 6 | 'aliases' => |
7 | - array ( |
|
7 | + array( |
|
8 | 8 | ), |
9 | 9 | 'reference' => '9f729ee78be545f474a617e1a4abb041d6f6eb4a', |
10 | 10 | 'name' => 'ayecode/invoicing', |
11 | 11 | ), |
12 | 12 | 'versions' => |
13 | - array ( |
|
13 | + array( |
|
14 | 14 | 'ayecode/ayecode-connect-helper' => |
15 | - array ( |
|
15 | + array( |
|
16 | 16 | 'pretty_version' => '1.0.3', |
17 | 17 | 'version' => '1.0.3.0', |
18 | 18 | 'aliases' => |
19 | - array ( |
|
19 | + array( |
|
20 | 20 | ), |
21 | 21 | 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
22 | 22 | ), |
23 | 23 | 'ayecode/invoicing' => |
24 | - array ( |
|
24 | + array( |
|
25 | 25 | 'pretty_version' => 'dev-master', |
26 | 26 | 'version' => 'dev-master', |
27 | 27 | 'aliases' => |
28 | - array ( |
|
28 | + array( |
|
29 | 29 | ), |
30 | 30 | 'reference' => '9f729ee78be545f474a617e1a4abb041d6f6eb4a', |
31 | 31 | ), |
32 | 32 | 'ayecode/wp-ayecode-ui' => |
33 | - array ( |
|
33 | + array( |
|
34 | 34 | 'pretty_version' => '0.1.64', |
35 | 35 | 'version' => '0.1.64.0', |
36 | 36 | 'aliases' => |
37 | - array ( |
|
37 | + array( |
|
38 | 38 | ), |
39 | 39 | 'reference' => 'e47b13915328f4253e470646ebd1dcd2b753e09f', |
40 | 40 | ), |
41 | 41 | 'ayecode/wp-deactivation-survey' => |
42 | - array ( |
|
42 | + array( |
|
43 | 43 | 'pretty_version' => '1.0.4', |
44 | 44 | 'version' => '1.0.4.0', |
45 | 45 | 'aliases' => |
46 | - array ( |
|
46 | + array( |
|
47 | 47 | ), |
48 | 48 | 'reference' => 'd2777fed30acfc4da53b45bf3b4fec2fb27d8398', |
49 | 49 | ), |
50 | 50 | 'ayecode/wp-font-awesome-settings' => |
51 | - array ( |
|
51 | + array( |
|
52 | 52 | 'pretty_version' => '1.0.13', |
53 | 53 | 'version' => '1.0.13.0', |
54 | 54 | 'aliases' => |
55 | - array ( |
|
55 | + array( |
|
56 | 56 | ), |
57 | 57 | 'reference' => 'a7a11ee4290674ec214d1fe694139af275350402', |
58 | 58 | ), |
59 | 59 | 'ayecode/wp-super-duper' => |
60 | - array ( |
|
60 | + array( |
|
61 | 61 | 'pretty_version' => '1.0.29', |
62 | 62 | 'version' => '1.0.29.0', |
63 | 63 | 'aliases' => |
64 | - array ( |
|
64 | + array( |
|
65 | 65 | ), |
66 | 66 | 'reference' => '18f3da558aec750cfeaa582f72619fbf8867677a', |
67 | 67 | ), |
68 | 68 | 'composer/installers' => |
69 | - array ( |
|
69 | + array( |
|
70 | 70 | 'pretty_version' => 'v1.12.0', |
71 | 71 | 'version' => '1.12.0.0', |
72 | 72 | 'aliases' => |
73 | - array ( |
|
73 | + array( |
|
74 | 74 | ), |
75 | 75 | 'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19', |
76 | 76 | ), |
77 | 77 | 'maxmind-db/reader' => |
78 | - array ( |
|
78 | + array( |
|
79 | 79 | 'pretty_version' => 'v1.6.0', |
80 | 80 | 'version' => '1.6.0.0', |
81 | 81 | 'aliases' => |
82 | - array ( |
|
82 | + array( |
|
83 | 83 | ), |
84 | 84 | 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
85 | 85 | ), |
86 | 86 | 'roundcube/plugin-installer' => |
87 | - array ( |
|
87 | + array( |
|
88 | 88 | 'replaced' => |
89 | - array ( |
|
89 | + array( |
|
90 | 90 | 0 => '*', |
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | 'shama/baton' => |
94 | - array ( |
|
94 | + array( |
|
95 | 95 | 'replaced' => |
96 | - array ( |
|
96 | + array( |
|
97 | 97 | 0 => '*', |
98 | 98 | ), |
99 | 99 | ), |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,27 +21,27 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the item. |
27 | - $item = new WPInv_Item( $post ); |
|
27 | + $item = new WPInv_Item($post); |
|
28 | 28 | |
29 | 29 | // Nonce field. |
30 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
30 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
31 | 31 | |
32 | 32 | // Set the currency position. |
33 | 33 | $position = wpinv_currency_position(); |
34 | 34 | |
35 | - if ( $position == 'left_space' ) { |
|
35 | + if ($position == 'left_space') { |
|
36 | 36 | $position = 'left'; |
37 | 37 | } |
38 | 38 | |
39 | - if ( $position == 'right_space' ) { |
|
39 | + if ($position == 'right_space') { |
|
40 | 40 | $position = 'right'; |
41 | 41 | } |
42 | 42 | |
43 | 43 | ?> |
44 | - <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr( $item->get_type( 'edit' ) ); ?>" /> |
|
44 | + <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr($item->get_type('edit')); ?>" /> |
|
45 | 45 | <style> |
46 | 46 | #poststuff .input-group-text, |
47 | 47 | #poststuff .form-control { |
@@ -55,21 +55,21 @@ discard block |
||
55 | 55 | </style> |
56 | 56 | <div class='bsui' style='max-width: 600px;padding-top: 10px;'> |
57 | 57 | |
58 | - <?php do_action( 'wpinv_item_details_metabox_before_price', $item ); ?> |
|
58 | + <?php do_action('wpinv_item_details_metabox_before_price', $item); ?> |
|
59 | 59 | <div class="form-group row"> |
60 | - <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e( 'Item Price', 'invoicing' )?></span></label> |
|
60 | + <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e('Item Price', 'invoicing')?></span></label> |
|
61 | 61 | <div class="col-sm-8"> |
62 | 62 | <div class="row"> |
63 | 63 | <div class="col-sm-4 getpaid-price-input"> |
64 | 64 | <div class="input-group input-group-sm"> |
65 | - <?php if( 'left' == $position ) : ?> |
|
65 | + <?php if ('left' == $position) : ?> |
|
66 | 66 | <div class="input-group-prepend"> |
67 | 67 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
68 | 68 | </div> |
69 | 69 | <?php endif; ?> |
70 | - <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
70 | + <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_price('edit'))); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
71 | 71 | |
72 | - <?php if( 'left' != $position ) : ?> |
|
72 | + <?php if ('left' != $position) : ?> |
|
73 | 73 | <div class="input-group-append"> |
74 | 74 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
75 | 75 | </div> |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | </div> |
80 | 80 | <div class="col-sm-4 wpinv_show_if_recurring"> |
81 | 81 | <?php |
82 | - _e( 'every' ); |
|
82 | + _e('every'); |
|
83 | 83 | echo " "; |
84 | 84 | ?> |
85 | - <input type="number" style="max-width: 60px;" value="<?php echo esc_attr( $item->get_recurring_interval( 'edit' ) ); ?>" placeholder="1" name="wpinv_recurring_interval" id="wpinv_recurring_interval" /> |
|
85 | + <input type="number" style="max-width: 60px;" value="<?php echo esc_attr($item->get_recurring_interval('edit')); ?>" placeholder="1" name="wpinv_recurring_interval" id="wpinv_recurring_interval" /> |
|
86 | 86 | </div> |
87 | 87 | <div class="col-sm-4 wpinv_show_if_recurring"> |
88 | 88 | <?php |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | array( |
91 | 91 | 'id' => 'wpinv_recurring_period', |
92 | 92 | 'name' => 'wpinv_recurring_period', |
93 | - 'label' => __( 'Period', 'invoicing' ), |
|
94 | - 'placeholder' => __( 'Select Period', 'invoicing' ), |
|
95 | - 'value' => $item->get_recurring_period( 'edit' ), |
|
93 | + 'label' => __('Period', 'invoicing'), |
|
94 | + 'placeholder' => __('Select Period', 'invoicing'), |
|
95 | + 'value' => $item->get_recurring_period('edit'), |
|
96 | 96 | 'select2' => true, |
97 | 97 | 'data-allow-clear' => 'false', |
98 | 98 | 'options' => array( |
99 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
100 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
101 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
102 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
99 | + 'D' => __('day(s)', 'invoicing'), |
|
100 | + 'W' => __('week(s)', 'invoicing'), |
|
101 | + 'M' => __('month(s)', 'invoicing'), |
|
102 | + 'Y' => __('year(s)', 'invoicing'), |
|
103 | 103 | ) |
104 | 104 | ) |
105 | 105 | ); |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | <?php |
112 | 112 | |
113 | 113 | // Dynamic pricing. |
114 | - if( $item->supports_dynamic_pricing() ) { |
|
114 | + if ($item->supports_dynamic_pricing()) { |
|
115 | 115 | |
116 | - do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
116 | + do_action('wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item); |
|
117 | 117 | |
118 | 118 | // NYP toggle. |
119 | 119 | echo aui()->input( |
@@ -121,31 +121,31 @@ discard block |
||
121 | 121 | 'id' => 'wpinv_name_your_price', |
122 | 122 | 'name' => 'wpinv_name_your_price', |
123 | 123 | 'type' => 'checkbox', |
124 | - 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
124 | + 'label' => apply_filters('wpinv_name_your_price_toggle_text', __('Let customers name their price', 'invoicing')), |
|
125 | 125 | 'value' => '1', |
126 | 126 | 'checked' => $item->user_can_set_their_price(), |
127 | 127 | 'no_wrap' => true, |
128 | 128 | ) |
129 | 129 | ); |
130 | 130 | |
131 | - do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
131 | + do_action('wpinv_item_details_metabox_dynamic_pricing_checkbox', $item); |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | 135 | // Subscriptions. |
136 | - do_action( 'wpinv_item_details_metabox_before_subscription_checkbox', $item ); |
|
136 | + do_action('wpinv_item_details_metabox_before_subscription_checkbox', $item); |
|
137 | 137 | echo aui()->input( |
138 | 138 | array( |
139 | 139 | 'id' => 'wpinv_is_recurring', |
140 | 140 | 'name' => 'wpinv_is_recurring', |
141 | 141 | 'type' => 'checkbox', |
142 | - 'label' => apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Charge customers a recurring amount for this item', 'invoicing' ) ), |
|
142 | + 'label' => apply_filters('wpinv_is_recurring_toggle_text', __('Charge customers a recurring amount for this item', 'invoicing')), |
|
143 | 143 | 'value' => '1', |
144 | 144 | 'checked' => $item->is_recurring(), |
145 | 145 | 'no_wrap' => true, |
146 | 146 | ) |
147 | 147 | ); |
148 | - do_action( 'wpinv_item_details_metabox_subscription_checkbox', $item ); |
|
148 | + do_action('wpinv_item_details_metabox_subscription_checkbox', $item); |
|
149 | 149 | |
150 | 150 | ?> |
151 | 151 | <div class="wpinv_show_if_recurring"> |
@@ -155,30 +155,30 @@ discard block |
||
155 | 155 | </div> |
156 | 156 | </div> |
157 | 157 | <div class="col-sm-1 pt-2 pl-0"> |
158 | - <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e( 'Set the subscription price, billing interval and period.', 'invoicing' ); ?>"></span> |
|
158 | + <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e('Set the subscription price, billing interval and period.', 'invoicing'); ?>"></span> |
|
159 | 159 | </div> |
160 | 160 | </div> |
161 | - <?php do_action( 'wpinv_item_details_metabox_after_price', $item ); ?> |
|
161 | + <?php do_action('wpinv_item_details_metabox_after_price', $item); ?> |
|
162 | 162 | |
163 | - <?php if( $item->supports_dynamic_pricing() ) : ?> |
|
164 | - <?php do_action( 'wpinv_item_details_metabox_before_minimum_price', $item ); ?> |
|
163 | + <?php if ($item->supports_dynamic_pricing()) : ?> |
|
164 | + <?php do_action('wpinv_item_details_metabox_before_minimum_price', $item); ?> |
|
165 | 165 | <div class="wpinv_show_if_dynamic wpinv_minimum_price"> |
166 | 166 | |
167 | 167 | <div class="form-group row"> |
168 | 168 | <label for="wpinv_minimum_price" class="col-sm-3 col-form-label"> |
169 | - <?php _e( 'Minimum Price', 'invoicing' );?> |
|
169 | + <?php _e('Minimum Price', 'invoicing'); ?> |
|
170 | 170 | </label> |
171 | 171 | <div class="col-sm-8"> |
172 | 172 | <div class="input-group input-group-sm"> |
173 | - <?php if( 'left' == $position ) : ?> |
|
173 | + <?php if ('left' == $position) : ?> |
|
174 | 174 | <div class="input-group-prepend"> |
175 | 175 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
176 | 176 | </div> |
177 | 177 | <?php endif; ?> |
178 | 178 | |
179 | - <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
179 | + <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price('edit'))); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
180 | 180 | |
181 | - <?php if( 'left' != $position ) : ?> |
|
181 | + <?php if ('left' != $position) : ?> |
|
182 | 182 | <div class="input-group-append"> |
183 | 183 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
184 | 184 | </div> |
@@ -187,45 +187,45 @@ discard block |
||
187 | 187 | </div> |
188 | 188 | |
189 | 189 | <div class="col-sm-1 pt-2 pl-0"> |
190 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the minimum amount that users are allowed to set', 'invoicing' ); ?>"></span> |
|
190 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the minimum amount that users are allowed to set', 'invoicing'); ?>"></span> |
|
191 | 191 | </div> |
192 | 192 | </div> |
193 | 193 | |
194 | 194 | </div> |
195 | - <?php do_action( 'wpinv_item_details_metabox_minimum_price', $item ); ?> |
|
195 | + <?php do_action('wpinv_item_details_metabox_minimum_price', $item); ?> |
|
196 | 196 | <?php endif; ?> |
197 | 197 | |
198 | - <?php do_action( 'wpinv_item_details_metabox_before_maximum_renewals', $item ); ?> |
|
198 | + <?php do_action('wpinv_item_details_metabox_before_maximum_renewals', $item); ?> |
|
199 | 199 | <div class="wpinv_show_if_recurring wpinv_maximum_renewals"> |
200 | 200 | |
201 | 201 | <div class="form-group row"> |
202 | 202 | <label for="wpinv_recurring_limit" class="col-sm-3 col-form-label"> |
203 | - <?php _e( 'Maximum Renewals', 'invoicing' );?> |
|
203 | + <?php _e('Maximum Renewals', 'invoicing'); ?> |
|
204 | 204 | </label> |
205 | 205 | <div class="col-sm-8"> |
206 | - <input type="number" value="<?php echo esc_attr( $item->get_recurring_limit( 'edit' ) ); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
206 | + <input type="number" value="<?php echo esc_attr($item->get_recurring_limit('edit')); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
207 | 207 | </div> |
208 | 208 | <div class="col-sm-1 pt-2 pl-0"> |
209 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing' ); ?>"></span> |
|
209 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing'); ?>"></span> |
|
210 | 210 | </div> |
211 | 211 | </div> |
212 | 212 | |
213 | 213 | </div> |
214 | - <?php do_action( 'wpinv_item_details_metabox_maximum_renewals', $item ); ?> |
|
214 | + <?php do_action('wpinv_item_details_metabox_maximum_renewals', $item); ?> |
|
215 | 215 | |
216 | - <?php do_action( 'wpinv_item_details_metabox_before_free_trial', $item ); ?> |
|
216 | + <?php do_action('wpinv_item_details_metabox_before_free_trial', $item); ?> |
|
217 | 217 | <div class="wpinv_show_if_recurring wpinv_free_trial"> |
218 | 218 | |
219 | 219 | <div class="form-group row"> |
220 | - <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php defined( 'GETPAID_PAID_TRIALS_VERSION' ) ? _e( 'Free/Paid Trial', 'invoicing' ) : _e( 'Free Trial', 'invoicing' )?></label> |
|
220 | + <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php defined('GETPAID_PAID_TRIALS_VERSION') ? _e('Free/Paid Trial', 'invoicing') : _e('Free Trial', 'invoicing')?></label> |
|
221 | 221 | |
222 | 222 | <div class="col-sm-8"> |
223 | 223 | <div class="row"> |
224 | 224 | <div class="col-sm-6"> |
225 | - <?php $value = $item->has_free_trial() ? $item->get_trial_interval( 'edit' ) : 0;?> |
|
225 | + <?php $value = $item->has_free_trial() ? $item->get_trial_interval('edit') : 0; ?> |
|
226 | 226 | |
227 | 227 | <div> |
228 | - <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr( $value ); ?>" > |
|
228 | + <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr($value); ?>" > |
|
229 | 229 | </div> |
230 | 230 | </div> |
231 | 231 | <div class="col-sm-6"> |
@@ -234,17 +234,17 @@ discard block |
||
234 | 234 | array( |
235 | 235 | 'id' => 'wpinv_trial_period', |
236 | 236 | 'name' => 'wpinv_trial_period', |
237 | - 'label' => __( 'Trial Period', 'invoicing' ), |
|
238 | - 'placeholder' => __( 'Trial Period', 'invoicing' ), |
|
239 | - 'value' => $item->get_trial_period( 'edit' ), |
|
237 | + 'label' => __('Trial Period', 'invoicing'), |
|
238 | + 'placeholder' => __('Trial Period', 'invoicing'), |
|
239 | + 'value' => $item->get_trial_period('edit'), |
|
240 | 240 | 'select2' => true, |
241 | 241 | 'data-allow-clear' => 'false', |
242 | 242 | 'no_wrap' => true, |
243 | 243 | 'options' => array( |
244 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
245 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
246 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
247 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
244 | + 'D' => __('day(s)', 'invoicing'), |
|
245 | + 'W' => __('week(s)', 'invoicing'), |
|
246 | + 'M' => __('month(s)', 'invoicing'), |
|
247 | + 'Y' => __('year(s)', 'invoicing'), |
|
248 | 248 | ) |
249 | 249 | ) |
250 | 250 | ); |
@@ -255,15 +255,15 @@ discard block |
||
255 | 255 | </div> |
256 | 256 | |
257 | 257 | <div class="col-sm-1 pt-2 pl-0"> |
258 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'An optional period of time to wait before charging the first recurring payment.', 'invoicing' ); ?>"></span> |
|
258 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('An optional period of time to wait before charging the first recurring payment.', 'invoicing'); ?>"></span> |
|
259 | 259 | </div> |
260 | 260 | |
261 | 261 | </div> |
262 | 262 | |
263 | 263 | </div> |
264 | - <?php do_action( 'wpinv_item_details_metabox__free_trial', $item ); ?> |
|
264 | + <?php do_action('wpinv_item_details_metabox__free_trial', $item); ?> |
|
265 | 265 | |
266 | - <?php do_action( 'wpinv_item_details_metabox_item_details', $item ); ?> |
|
266 | + <?php do_action('wpinv_item_details_metabox_item_details', $item); ?> |
|
267 | 267 | </div> |
268 | 268 | <?php |
269 | 269 | |
@@ -274,31 +274,31 @@ discard block |
||
274 | 274 | * |
275 | 275 | * @param int $post_id |
276 | 276 | */ |
277 | - public static function save( $post_id ) { |
|
277 | + public static function save($post_id) { |
|
278 | 278 | |
279 | 279 | // Prepare the item. |
280 | - $item = new WPInv_Item( $post_id ); |
|
280 | + $item = new WPInv_Item($post_id); |
|
281 | 281 | |
282 | 282 | // Load new data. |
283 | 283 | $item->set_props( |
284 | 284 | array( |
285 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null, |
|
286 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
287 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
288 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
289 | - 'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ), |
|
290 | - 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_minimum_price'] ) : null, |
|
291 | - 'is_recurring' => ! empty( $_POST['wpinv_is_recurring'] ), |
|
292 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
293 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
294 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
295 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
296 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
297 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
285 | + 'price' => isset($_POST['wpinv_item_price']) ? getpaid_standardize_amount($_POST['wpinv_item_price']) : null, |
|
286 | + 'vat_rule' => isset($_POST['wpinv_vat_rules']) ? wpinv_clean($_POST['wpinv_vat_rules']) : null, |
|
287 | + 'vat_class' => isset($_POST['wpinv_vat_class']) ? wpinv_clean($_POST['wpinv_vat_class']) : null, |
|
288 | + 'type' => isset($_POST['wpinv_item_type']) ? wpinv_clean($_POST['wpinv_item_type']) : null, |
|
289 | + 'is_dynamic_pricing' => !empty($_POST['wpinv_name_your_price']), |
|
290 | + 'minimum_price' => isset($_POST['wpinv_minimum_price']) ? getpaid_standardize_amount($_POST['wpinv_minimum_price']) : null, |
|
291 | + 'is_recurring' => !empty($_POST['wpinv_is_recurring']), |
|
292 | + 'recurring_period' => isset($_POST['wpinv_recurring_period']) ? wpinv_clean($_POST['wpinv_recurring_period']) : null, |
|
293 | + 'recurring_interval' => isset($_POST['wpinv_recurring_interval']) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
294 | + 'recurring_limit' => isset($_POST['wpinv_recurring_limit']) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
295 | + 'is_free_trial' => isset($_POST['wpinv_trial_interval']) ? (0 != (int) $_POST['wpinv_trial_interval']) : null, |
|
296 | + 'trial_period' => isset($_POST['wpinv_trial_period']) ? wpinv_clean($_POST['wpinv_trial_period']) : null, |
|
297 | + 'trial_interval' => isset($_POST['wpinv_trial_interval']) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
298 | 298 | ) |
299 | 299 | ); |
300 | 300 | |
301 | 301 | $item->save(); |
302 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
302 | + do_action('getpaid_item_metabox_save', $post_id, $item); |
|
303 | 303 | } |
304 | 304 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,24 +21,24 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the discount. |
27 | - $discount = new WPInv_Discount( $post ); |
|
27 | + $discount = new WPInv_Discount($post); |
|
28 | 28 | |
29 | 29 | // Nonce field. |
30 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
30 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
31 | 31 | |
32 | - do_action( 'wpinv_discount_form_top', $discount ); |
|
32 | + do_action('wpinv_discount_form_top', $discount); |
|
33 | 33 | |
34 | 34 | // Set the currency position. |
35 | 35 | $position = wpinv_currency_position(); |
36 | 36 | |
37 | - if ( $position == 'left_space' ) { |
|
37 | + if ($position == 'left_space') { |
|
38 | 38 | $position = 'left'; |
39 | 39 | } |
40 | 40 | |
41 | - if ( $position == 'right_space' ) { |
|
41 | + if ($position == 'right_space') { |
|
42 | 42 | $position = 'right'; |
43 | 43 | } |
44 | 44 | |
@@ -52,66 +52,66 @@ discard block |
||
52 | 52 | </style> |
53 | 53 | <div class='bsui' style='max-width: 600px;padding-top: 10px;'> |
54 | 54 | |
55 | - <?php do_action( 'wpinv_discount_form_first', $discount ); ?> |
|
55 | + <?php do_action('wpinv_discount_form_first', $discount); ?> |
|
56 | 56 | |
57 | - <?php do_action( 'wpinv_discount_form_before_code', $discount ); ?> |
|
57 | + <?php do_action('wpinv_discount_form_before_code', $discount); ?> |
|
58 | 58 | <div class="form-group row"> |
59 | 59 | <label for="wpinv_discount_code" class="col-sm-3 col-form-label"> |
60 | - <?php _e( 'Discount Code', 'invoicing' );?> |
|
60 | + <?php _e('Discount Code', 'invoicing'); ?> |
|
61 | 61 | </label> |
62 | 62 | <div class="col-sm-8"> |
63 | 63 | <div class="row"> |
64 | 64 | <div class="col-sm-12 form-group"> |
65 | - <input type="text" value="<?php echo esc_attr( $discount->get_code( 'edit' ) ); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" /> |
|
65 | + <input type="text" value="<?php echo esc_attr($discount->get_code('edit')); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" /> |
|
66 | 66 | </div> |
67 | 67 | <div class="col-sm-12"> |
68 | 68 | <?php |
69 | - do_action( 'wpinv_discount_form_before_single_use', $discount ); |
|
69 | + do_action('wpinv_discount_form_before_single_use', $discount); |
|
70 | 70 | |
71 | 71 | echo aui()->input( |
72 | 72 | array( |
73 | 73 | 'id' => 'wpinv_discount_single_use', |
74 | 74 | 'name' => 'wpinv_discount_single_use', |
75 | 75 | 'type' => 'checkbox', |
76 | - 'label' => __( 'Each customer can only use this discount once', 'invoicing' ), |
|
76 | + 'label' => __('Each customer can only use this discount once', 'invoicing'), |
|
77 | 77 | 'value' => '1', |
78 | 78 | 'checked' => $discount->is_single_use(), |
79 | 79 | ) |
80 | 80 | ); |
81 | 81 | |
82 | - do_action( 'wpinv_discount_form_single_use', $discount ); |
|
82 | + do_action('wpinv_discount_form_single_use', $discount); |
|
83 | 83 | ?> |
84 | 84 | </div> |
85 | 85 | <div class="col-sm-12"> |
86 | 86 | <?php |
87 | - do_action( 'wpinv_discount_form_before_recurring', $discount ); |
|
87 | + do_action('wpinv_discount_form_before_recurring', $discount); |
|
88 | 88 | |
89 | 89 | echo aui()->input( |
90 | 90 | array( |
91 | 91 | 'id' => 'wpinv_discount_recurring', |
92 | 92 | 'name' => 'wpinv_discount_recurring', |
93 | 93 | 'type' => 'checkbox', |
94 | - 'label' => __( 'Apply this discount to all recurring payments for subscriptions', 'invoicing' ), |
|
94 | + 'label' => __('Apply this discount to all recurring payments for subscriptions', 'invoicing'), |
|
95 | 95 | 'value' => '1', |
96 | 96 | 'checked' => $discount->is_recurring(), |
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | |
100 | - do_action( 'wpinv_discount_form_recurring', $discount ); |
|
100 | + do_action('wpinv_discount_form_recurring', $discount); |
|
101 | 101 | ?> |
102 | 102 | </div> |
103 | 103 | </div> |
104 | 104 | </div> |
105 | 105 | <div class="col-sm-1 pt-2 pl-0"> |
106 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter a discount code such as 10OFF.', 'invoicing' ); ?>"></span> |
|
106 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter a discount code such as 10OFF.', 'invoicing'); ?>"></span> |
|
107 | 107 | </div> |
108 | 108 | </div> |
109 | - <?php do_action( 'wpinv_discount_form_code', $discount ); ?> |
|
109 | + <?php do_action('wpinv_discount_form_code', $discount); ?> |
|
110 | 110 | |
111 | - <?php do_action( 'wpinv_discount_form_before_type', $discount ); ?> |
|
111 | + <?php do_action('wpinv_discount_form_before_type', $discount); ?> |
|
112 | 112 | <div class="form-group row"> |
113 | 113 | <label for="wpinv_discount_type" class="col-sm-3 col-form-label"> |
114 | - <?php _e( 'Discount Type', 'invoicing' );?> |
|
114 | + <?php _e('Discount Type', 'invoicing'); ?> |
|
115 | 115 | </label> |
116 | 116 | <div class="col-sm-8"> |
117 | 117 | <?php |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | array( |
120 | 120 | 'id' => 'wpinv_discount_type', |
121 | 121 | 'name' => 'wpinv_discount_type', |
122 | - 'label' => __( 'Discount Type', 'invoicing' ), |
|
123 | - 'placeholder' => __( 'Select Discount Type', 'invoicing' ), |
|
124 | - 'value' => $discount->get_type( 'edit' ), |
|
122 | + 'label' => __('Discount Type', 'invoicing'), |
|
123 | + 'placeholder' => __('Select Discount Type', 'invoicing'), |
|
124 | + 'value' => $discount->get_type('edit'), |
|
125 | 125 | 'select2' => true, |
126 | 126 | 'data-allow-clear' => 'false', |
127 | 127 | 'options' => wpinv_get_discount_types() |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | ?> |
131 | 131 | </div> |
132 | 132 | <div class="col-sm-1 pt-2 pl-0"> |
133 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Discount type.', 'invoicing' ); ?>"></span> |
|
133 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Discount type.', 'invoicing'); ?>"></span> |
|
134 | 134 | </div> |
135 | 135 | </div> |
136 | - <?php do_action( 'wpinv_discount_form_type', $discount ); ?> |
|
136 | + <?php do_action('wpinv_discount_form_type', $discount); ?> |
|
137 | 137 | |
138 | - <?php do_action( 'wpinv_discount_form_before_amount', $discount ); ?> |
|
139 | - <div class="form-group row <?php echo esc_attr( $discount->get_type( 'edit' ) ); ?>" id="wpinv_discount_amount_wrap"> |
|
138 | + <?php do_action('wpinv_discount_form_before_amount', $discount); ?> |
|
139 | + <div class="form-group row <?php echo esc_attr($discount->get_type('edit')); ?>" id="wpinv_discount_amount_wrap"> |
|
140 | 140 | <label for="wpinv_discount_amount" class="col-sm-3 col-form-label"> |
141 | - <?php _e( 'Discount Amount', 'invoicing' );?> |
|
141 | + <?php _e('Discount Amount', 'invoicing'); ?> |
|
142 | 142 | </label> |
143 | 143 | <div class="col-sm-8"> |
144 | 144 | <div class="input-group input-group-sm"> |
145 | - <?php if( 'left' == $position ) : ?> |
|
145 | + <?php if ('left' == $position) : ?> |
|
146 | 146 | <div class="input-group-prepend left wpinv-if-flat"> |
147 | 147 | <span class="input-group-text"> |
148 | 148 | <?php echo wpinv_currency_symbol(); ?> |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | </div> |
151 | 151 | <?php endif; ?> |
152 | 152 | |
153 | - <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr( $discount->get_amount( 'edit' ) ); ?>" placeholder="0" class="form-control"> |
|
153 | + <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr($discount->get_amount('edit')); ?>" placeholder="0" class="form-control"> |
|
154 | 154 | |
155 | - <?php if( 'right' == $position ) : ?> |
|
155 | + <?php if ('right' == $position) : ?> |
|
156 | 156 | <div class="input-group-prepend left wpinv-if-flat"> |
157 | 157 | <span class="input-group-text"> |
158 | 158 | <?php echo wpinv_currency_symbol(); ?> |
@@ -165,15 +165,15 @@ discard block |
||
165 | 165 | </div> |
166 | 166 | </div> |
167 | 167 | <div class="col-sm-1 pt-2 pl-0"> |
168 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?>"></span> |
|
168 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the discount value. Ex: 10', 'invoicing'); ?>"></span> |
|
169 | 169 | </div> |
170 | 170 | </div> |
171 | - <?php do_action( 'wpinv_discount_form_amount', $discount ); ?> |
|
171 | + <?php do_action('wpinv_discount_form_amount', $discount); ?> |
|
172 | 172 | |
173 | - <?php do_action( 'wpinv_discount_form_before_items', $discount ); ?> |
|
173 | + <?php do_action('wpinv_discount_form_before_items', $discount); ?> |
|
174 | 174 | <div class="form-group row"> |
175 | 175 | <label for="wpinv_discount_items" class="col-sm-3 col-form-label"> |
176 | - <?php _e( 'Items', 'invoicing' );?> |
|
176 | + <?php _e('Items', 'invoicing'); ?> |
|
177 | 177 | </label> |
178 | 178 | <div class="col-sm-8"> |
179 | 179 | <?php |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | array( |
182 | 182 | 'id' => 'wpinv_discount_items', |
183 | 183 | 'name' => 'wpinv_discount_items[]', |
184 | - 'label' => __( 'Items', 'invoicing' ), |
|
185 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
186 | - 'value' => $discount->get_items( 'edit' ), |
|
184 | + 'label' => __('Items', 'invoicing'), |
|
185 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
186 | + 'value' => $discount->get_items('edit'), |
|
187 | 187 | 'select2' => true, |
188 | 188 | 'multiple' => true, |
189 | 189 | 'data-allow-clear' => 'false', |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | ?> |
194 | 194 | </div> |
195 | 195 | <div class="col-sm-1 pt-2 pl-0"> |
196 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing' ); ?>"></span> |
|
196 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing'); ?>"></span> |
|
197 | 197 | </div> |
198 | 198 | </div> |
199 | - <?php do_action( 'wpinv_discount_form_items', $discount ); ?> |
|
199 | + <?php do_action('wpinv_discount_form_items', $discount); ?> |
|
200 | 200 | |
201 | - <?php do_action( 'wpinv_discount_form_before_excluded_items', $discount ); ?> |
|
201 | + <?php do_action('wpinv_discount_form_before_excluded_items', $discount); ?> |
|
202 | 202 | <div class="form-group row"> |
203 | 203 | <label for="wpinv_discount_excluded_items" class="col-sm-3 col-form-label"> |
204 | - <?php _e( 'Excluded Items', 'invoicing' );?> |
|
204 | + <?php _e('Excluded Items', 'invoicing'); ?> |
|
205 | 205 | </label> |
206 | 206 | <div class="col-sm-8"> |
207 | 207 | <?php |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | array( |
210 | 210 | 'id' => 'wpinv_discount_excluded_items', |
211 | 211 | 'name' => 'wpinv_discount_excluded_items[]', |
212 | - 'label' => __( 'Excluded Items', 'invoicing' ), |
|
213 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
214 | - 'value' => $discount->get_excluded_items( 'edit' ), |
|
212 | + 'label' => __('Excluded Items', 'invoicing'), |
|
213 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
214 | + 'value' => $discount->get_excluded_items('edit'), |
|
215 | 215 | 'select2' => true, |
216 | 216 | 'multiple' => true, |
217 | 217 | 'data-allow-clear' => 'false', |
@@ -221,15 +221,15 @@ discard block |
||
221 | 221 | ?> |
222 | 222 | </div> |
223 | 223 | <div class="col-sm-1 pt-2 pl-0"> |
224 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are not allowed to use this discount.', 'invoicing' ); ?>"></span> |
|
224 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are not allowed to use this discount.', 'invoicing'); ?>"></span> |
|
225 | 225 | </div> |
226 | 226 | </div> |
227 | - <?php do_action( 'wpinv_discount_form_excluded_items', $discount ); ?> |
|
227 | + <?php do_action('wpinv_discount_form_excluded_items', $discount); ?> |
|
228 | 228 | |
229 | - <?php do_action( 'wpinv_discount_form_before_required_items', $discount ); ?> |
|
229 | + <?php do_action('wpinv_discount_form_before_required_items', $discount); ?> |
|
230 | 230 | <div class="form-group row"> |
231 | 231 | <label for="wpinv_discount_required_items" class="col-sm-3 col-form-label"> |
232 | - <?php _e( 'Required Items', 'invoicing' );?> |
|
232 | + <?php _e('Required Items', 'invoicing'); ?> |
|
233 | 233 | </label> |
234 | 234 | <div class="col-sm-8"> |
235 | 235 | <?php |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | array( |
238 | 238 | 'id' => 'wpinv_discount_required_items', |
239 | 239 | 'name' => 'wpinv_discount_required_items[]', |
240 | - 'label' => __( 'Required Items', 'invoicing' ), |
|
241 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
242 | - 'value' => $discount->get_required_items( 'edit' ), |
|
240 | + 'label' => __('Required Items', 'invoicing'), |
|
241 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
242 | + 'value' => $discount->get_required_items('edit'), |
|
243 | 243 | 'select2' => true, |
244 | 244 | 'multiple' => true, |
245 | 245 | 'data-allow-clear' => 'false', |
@@ -249,15 +249,15 @@ discard block |
||
249 | 249 | ?> |
250 | 250 | </div> |
251 | 251 | <div class="col-sm-1 pt-2 pl-0"> |
252 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are required to be in the cart before using this discount.', 'invoicing' ); ?>"></span> |
|
252 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are required to be in the cart before using this discount.', 'invoicing'); ?>"></span> |
|
253 | 253 | </div> |
254 | 254 | </div> |
255 | - <?php do_action( 'wpinv_discount_form_required_items', $discount ); ?> |
|
255 | + <?php do_action('wpinv_discount_form_required_items', $discount); ?> |
|
256 | 256 | |
257 | - <?php do_action( 'wpinv_discount_form_before_start', $discount ); ?> |
|
257 | + <?php do_action('wpinv_discount_form_before_start', $discount); ?> |
|
258 | 258 | <div class="form-group row"> |
259 | 259 | <label for="wpinv_discount_start" class="col-sm-3 col-form-label"> |
260 | - <?php _e( 'Start Date', 'invoicing' );?> |
|
260 | + <?php _e('Start Date', 'invoicing'); ?> |
|
261 | 261 | </label> |
262 | 262 | <div class="col-sm-8"> |
263 | 263 | <?php |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | 'type' => 'datepicker', |
267 | 267 | 'id' => 'wpinv_discount_start', |
268 | 268 | 'name' => 'wpinv_discount_start', |
269 | - 'label' => __( 'Start Date', 'invoicing' ), |
|
269 | + 'label' => __('Start Date', 'invoicing'), |
|
270 | 270 | 'placeholder' => 'YYYY-MM-DD 00:00', |
271 | 271 | 'class' => 'form-control-sm', |
272 | - 'value' => $discount->get_start_date( 'edit' ), |
|
272 | + 'value' => $discount->get_start_date('edit'), |
|
273 | 273 | 'extra_attributes' => array( |
274 | 274 | 'data-enable-time' => 'true', |
275 | 275 | 'data-time_24hr' => 'true', |
@@ -280,15 +280,15 @@ discard block |
||
280 | 280 | ?> |
281 | 281 | </div> |
282 | 282 | <div class="col-sm-1 pt-2 pl-0"> |
283 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing' ); ?>"></span> |
|
283 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing'); ?>"></span> |
|
284 | 284 | </div> |
285 | 285 | </div> |
286 | - <?php do_action( 'wpinv_discount_form_start', $discount ); ?> |
|
286 | + <?php do_action('wpinv_discount_form_start', $discount); ?> |
|
287 | 287 | |
288 | - <?php do_action( 'wpinv_discount_form_before_expiration', $discount ); ?> |
|
288 | + <?php do_action('wpinv_discount_form_before_expiration', $discount); ?> |
|
289 | 289 | <div class="form-group row"> |
290 | 290 | <label for="wpinv_discount_expiration" class="col-sm-3 col-form-label"> |
291 | - <?php _e( 'Expiration Date', 'invoicing' );?> |
|
291 | + <?php _e('Expiration Date', 'invoicing'); ?> |
|
292 | 292 | </label> |
293 | 293 | <div class="col-sm-8"> |
294 | 294 | <?php |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | 'type' => 'datepicker', |
298 | 298 | 'id' => 'wpinv_discount_expiration', |
299 | 299 | 'name' => 'wpinv_discount_expiration', |
300 | - 'label' => __( 'Expiration Date', 'invoicing' ), |
|
300 | + 'label' => __('Expiration Date', 'invoicing'), |
|
301 | 301 | 'placeholder' => 'YYYY-MM-DD 00:00', |
302 | 302 | 'class' => 'form-control-sm', |
303 | - 'value' => $discount->get_end_date( 'edit' ), |
|
303 | + 'value' => $discount->get_end_date('edit'), |
|
304 | 304 | 'extra_attributes' => array( |
305 | 305 | 'data-enable-time' => 'true', |
306 | 306 | 'data-time_24hr' => 'true', |
@@ -313,27 +313,27 @@ discard block |
||
313 | 313 | ?> |
314 | 314 | </div> |
315 | 315 | <div class="col-sm-1 pt-2 pl-0"> |
316 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the date after which the discount will expire.', 'invoicing' ); ?>"></span> |
|
316 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the date after which the discount will expire.', 'invoicing'); ?>"></span> |
|
317 | 317 | </div> |
318 | 318 | </div> |
319 | - <?php do_action( 'wpinv_discount_form_expiration', $discount ); ?> |
|
319 | + <?php do_action('wpinv_discount_form_expiration', $discount); ?> |
|
320 | 320 | |
321 | - <?php do_action( 'wpinv_discount_form_before_min_total', $discount ); ?> |
|
321 | + <?php do_action('wpinv_discount_form_before_min_total', $discount); ?> |
|
322 | 322 | <div class="form-group row"> |
323 | 323 | <label for="wpinv_discount_min_total" class="col-sm-3 col-form-label"> |
324 | - <?php _e( 'Minimum Amount', 'invoicing' );?> |
|
324 | + <?php _e('Minimum Amount', 'invoicing'); ?> |
|
325 | 325 | </label> |
326 | 326 | <div class="col-sm-8"> |
327 | 327 | <div class="input-group input-group-sm"> |
328 | - <?php if( 'left' == $position ) : ?> |
|
328 | + <?php if ('left' == $position) : ?> |
|
329 | 329 | <div class="input-group-prepend"> |
330 | 330 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
331 | 331 | </div> |
332 | 332 | <?php endif; ?> |
333 | 333 | |
334 | - <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr( $discount->get_minimum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No minimum', 'invoicing' ); ?>" class="form-control"> |
|
334 | + <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr($discount->get_minimum_total('edit')); ?>" placeholder="<?php esc_attr_e('No minimum', 'invoicing'); ?>" class="form-control"> |
|
335 | 335 | |
336 | - <?php if( 'left' != $position ) : ?> |
|
336 | + <?php if ('left' != $position) : ?> |
|
337 | 337 | <div class="input-group-append"> |
338 | 338 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
339 | 339 | </div> |
@@ -341,27 +341,27 @@ discard block |
||
341 | 341 | </div> |
342 | 342 | </div> |
343 | 343 | <div class="col-sm-1 pt-2 pl-0"> |
344 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing' ); ?>"></span> |
|
344 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing'); ?>"></span> |
|
345 | 345 | </div> |
346 | 346 | </div> |
347 | - <?php do_action( 'wpinv_discount_form_min_total', $discount ); ?> |
|
347 | + <?php do_action('wpinv_discount_form_min_total', $discount); ?> |
|
348 | 348 | |
349 | - <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?> |
|
349 | + <?php do_action('wpinv_discount_form_before_max_total', $discount); ?> |
|
350 | 350 | <div class="form-group row"> |
351 | 351 | <label for="wpinv_discount_max_total" class="col-sm-3 col-form-label"> |
352 | - <?php _e( 'Maximum Amount', 'invoicing' );?> |
|
352 | + <?php _e('Maximum Amount', 'invoicing'); ?> |
|
353 | 353 | </label> |
354 | 354 | <div class="col-sm-8"> |
355 | 355 | <div class="input-group input-group-sm"> |
356 | - <?php if( 'left' == $position ) : ?> |
|
356 | + <?php if ('left' == $position) : ?> |
|
357 | 357 | <div class="input-group-prepend"> |
358 | 358 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
359 | 359 | </div> |
360 | 360 | <?php endif; ?> |
361 | 361 | |
362 | - <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr( $discount->get_maximum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No maximum', 'invoicing' ); ?>" class="form-control"> |
|
362 | + <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr($discount->get_maximum_total('edit')); ?>" placeholder="<?php esc_attr_e('No maximum', 'invoicing'); ?>" class="form-control"> |
|
363 | 363 | |
364 | - <?php if( 'left' != $position ) : ?> |
|
364 | + <?php if ('left' != $position) : ?> |
|
365 | 365 | <div class="input-group-append"> |
366 | 366 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
367 | 367 | </div> |
@@ -369,30 +369,30 @@ discard block |
||
369 | 369 | </div> |
370 | 370 | </div> |
371 | 371 | <div class="col-sm-1 pt-2 pl-0"> |
372 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing' ); ?>"></span> |
|
372 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing'); ?>"></span> |
|
373 | 373 | </div> |
374 | 374 | </div> |
375 | - <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?> |
|
375 | + <?php do_action('wpinv_discount_form_before_max_total', $discount); ?> |
|
376 | 376 | |
377 | - <?php do_action( 'wpinv_discount_form_before_max_uses', $discount ); ?> |
|
377 | + <?php do_action('wpinv_discount_form_before_max_uses', $discount); ?> |
|
378 | 378 | <div class="form-group row"> |
379 | 379 | <label for="wpinv_discount_max_uses" class="col-sm-3 col-form-label"> |
380 | - <?php _e( 'Maximum Uses', 'invoicing' );?> |
|
380 | + <?php _e('Maximum Uses', 'invoicing'); ?> |
|
381 | 381 | </label> |
382 | 382 | <div class="col-sm-8"> |
383 | - <input type="text" value="<?php echo esc_attr( $discount->get_max_uses( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'Unlimited', 'invoicing' ); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" /> |
|
383 | + <input type="text" value="<?php echo esc_attr($discount->get_max_uses('edit')); ?>" placeholder="<?php esc_attr_e('Unlimited', 'invoicing'); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" /> |
|
384 | 384 | </div> |
385 | 385 | <div class="col-sm-1 pt-2 pl-0"> |
386 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum number of times that this discount code can be used.', 'invoicing' ); ?>"></span> |
|
386 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum number of times that this discount code can be used.', 'invoicing'); ?>"></span> |
|
387 | 387 | </div> |
388 | 388 | </div> |
389 | - <?php do_action( 'wpinv_discount_form_max_uses', $discount ); ?> |
|
389 | + <?php do_action('wpinv_discount_form_max_uses', $discount); ?> |
|
390 | 390 | |
391 | - <?php do_action( 'wpinv_discount_form_last', $discount ); ?> |
|
391 | + <?php do_action('wpinv_discount_form_last', $discount); ?> |
|
392 | 392 | |
393 | 393 | </div> |
394 | 394 | <?php |
395 | - do_action( 'wpinv_discount_form_bottom', $post ); |
|
395 | + do_action('wpinv_discount_form_bottom', $post); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
@@ -400,31 +400,31 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @param int $post_id |
402 | 402 | */ |
403 | - public static function save( $post_id ) { |
|
403 | + public static function save($post_id) { |
|
404 | 404 | |
405 | 405 | // Prepare the discount. |
406 | - $discount = new WPInv_Discount( $post_id ); |
|
406 | + $discount = new WPInv_Discount($post_id); |
|
407 | 407 | |
408 | 408 | // Load new data. |
409 | 409 | $discount->set_props( |
410 | 410 | array( |
411 | - 'code' => isset( $_POST['wpinv_discount_code'] ) ? wpinv_clean( $_POST['wpinv_discount_code'] ) : null, |
|
412 | - 'amount' => isset( $_POST['wpinv_discount_amount'] ) ? floatval( $_POST['wpinv_discount_amount'] ) : null, |
|
413 | - 'start' => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null, |
|
414 | - 'expiration' => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null, |
|
415 | - 'is_single_use' => ! empty( $_POST['wpinv_discount_single_use'] ), |
|
416 | - 'type' => isset( $_POST['wpinv_discount_type'] ) ? wpinv_clean( $_POST['wpinv_discount_type'] ) : null, |
|
417 | - 'is_recurring' => ! empty( $_POST['wpinv_discount_recurring'] ), |
|
418 | - 'items' => isset( $_POST['wpinv_discount_items'] ) ? wpinv_clean( $_POST['wpinv_discount_items'] ) : array(), |
|
419 | - 'excluded_items' => isset( $_POST['wpinv_discount_excluded_items'] ) ? wpinv_clean( $_POST['wpinv_discount_excluded_items'] ) : array(), |
|
420 | - 'required_items' => isset( $_POST['wpinv_discount_required_items'] ) ? wpinv_clean( $_POST['wpinv_discount_required_items'] ) : array(), |
|
421 | - 'max_uses' => isset( $_POST['wpinv_discount_max_uses'] ) ? intval( $_POST['wpinv_discount_max_uses'] ) : null, |
|
422 | - 'min_total' => isset( $_POST['wpinv_discount_min_total'] ) ? floatval( $_POST['wpinv_discount_min_total'] ) : null, |
|
423 | - 'max_total' => isset( $_POST['wpinv_discount_max_total'] ) ? floatval( $_POST['wpinv_discount_max_total'] ) : null, |
|
411 | + 'code' => isset($_POST['wpinv_discount_code']) ? wpinv_clean($_POST['wpinv_discount_code']) : null, |
|
412 | + 'amount' => isset($_POST['wpinv_discount_amount']) ? floatval($_POST['wpinv_discount_amount']) : null, |
|
413 | + 'start' => isset($_POST['wpinv_discount_start']) ? wpinv_clean($_POST['wpinv_discount_start']) : null, |
|
414 | + 'expiration' => isset($_POST['wpinv_discount_expiration']) ? wpinv_clean($_POST['wpinv_discount_expiration']) : null, |
|
415 | + 'is_single_use' => !empty($_POST['wpinv_discount_single_use']), |
|
416 | + 'type' => isset($_POST['wpinv_discount_type']) ? wpinv_clean($_POST['wpinv_discount_type']) : null, |
|
417 | + 'is_recurring' => !empty($_POST['wpinv_discount_recurring']), |
|
418 | + 'items' => isset($_POST['wpinv_discount_items']) ? wpinv_clean($_POST['wpinv_discount_items']) : array(), |
|
419 | + 'excluded_items' => isset($_POST['wpinv_discount_excluded_items']) ? wpinv_clean($_POST['wpinv_discount_excluded_items']) : array(), |
|
420 | + 'required_items' => isset($_POST['wpinv_discount_required_items']) ? wpinv_clean($_POST['wpinv_discount_required_items']) : array(), |
|
421 | + 'max_uses' => isset($_POST['wpinv_discount_max_uses']) ? intval($_POST['wpinv_discount_max_uses']) : null, |
|
422 | + 'min_total' => isset($_POST['wpinv_discount_min_total']) ? floatval($_POST['wpinv_discount_min_total']) : null, |
|
423 | + 'max_total' => isset($_POST['wpinv_discount_max_total']) ? floatval($_POST['wpinv_discount_max_total']) : null, |
|
424 | 424 | ) |
425 | 425 | ); |
426 | 426 | |
427 | 427 | $discount->save(); |
428 | - do_action( 'getpaid_discount_metabox_save', $post_id, $discount ); |
|
428 | + do_action('getpaid_discount_metabox_save', $post_id, $discount); |
|
429 | 429 | } |
430 | 430 | } |
@@ -4,11 +4,11 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -if ( ! defined( 'ABSPATH' ) ) { |
|
7 | +if (!defined('ABSPATH')) { |
|
8 | 8 | exit; // Exit if accessed directly |
9 | 9 | } |
10 | 10 | |
11 | -if ( ! class_exists( 'GetPaid_Admin_Profile', false ) ) : |
|
11 | +if (!class_exists('GetPaid_Admin_Profile', false)) : |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * GetPaid_Admin_Profile Class. |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | * Hook in tabs. |
20 | 20 | */ |
21 | 21 | public function __construct() { |
22 | - add_action( 'show_user_profile', array( $this, 'add_customer_meta_fields' ), 100 ); |
|
23 | - add_action( 'edit_user_profile', array( $this, 'add_customer_meta_fields' ), 100 ); |
|
22 | + add_action('show_user_profile', array($this, 'add_customer_meta_fields'), 100); |
|
23 | + add_action('edit_user_profile', array($this, 'add_customer_meta_fields'), 100); |
|
24 | 24 | |
25 | - add_action( 'personal_options_update', array( $this, 'save_customer_meta_fields' ) ); |
|
26 | - add_action( 'edit_user_profile_update', array( $this, 'save_customer_meta_fields' ) ); |
|
25 | + add_action('personal_options_update', array($this, 'save_customer_meta_fields')); |
|
26 | + add_action('edit_user_profile_update', array($this, 'save_customer_meta_fields')); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -37,54 +37,54 @@ discard block |
||
37 | 37 | 'getpaid_customer_meta_fields', |
38 | 38 | array( |
39 | 39 | 'billing' => array( |
40 | - 'title' => __( 'Billing Details (GetPaid)', 'invoicing' ), |
|
40 | + 'title' => __('Billing Details (GetPaid)', 'invoicing'), |
|
41 | 41 | 'fields' => array( |
42 | 42 | '_wpinv_first_name' => array( |
43 | - 'label' => __( 'First name', 'invoicing' ), |
|
43 | + 'label' => __('First name', 'invoicing'), |
|
44 | 44 | 'description' => '', |
45 | 45 | ), |
46 | 46 | '_wpinv_last_name' => array( |
47 | - 'label' => __( 'Last name', 'invoicing' ), |
|
47 | + 'label' => __('Last name', 'invoicing'), |
|
48 | 48 | 'description' => '', |
49 | 49 | ), |
50 | 50 | '_wpinv_company' => array( |
51 | - 'label' => __( 'Company', 'invoicing' ), |
|
51 | + 'label' => __('Company', 'invoicing'), |
|
52 | 52 | 'description' => '', |
53 | 53 | ), |
54 | 54 | '_wpinv_company_id' => array( |
55 | - 'label' => __( 'Company ID', 'invoicing' ), |
|
55 | + 'label' => __('Company ID', 'invoicing'), |
|
56 | 56 | 'description' => '', |
57 | 57 | ), |
58 | 58 | '_wpinv_address' => array( |
59 | - 'label' => __( 'Address', 'invoicing' ), |
|
59 | + 'label' => __('Address', 'invoicing'), |
|
60 | 60 | 'description' => '', |
61 | 61 | ), |
62 | 62 | '_wpinv_city' => array( |
63 | - 'label' => __( 'City', 'invoicing' ), |
|
63 | + 'label' => __('City', 'invoicing'), |
|
64 | 64 | 'description' => '', |
65 | 65 | ), |
66 | 66 | '_wpinv_zip' => array( |
67 | - 'label' => __( 'Postcode / ZIP', 'invoicing' ), |
|
67 | + 'label' => __('Postcode / ZIP', 'invoicing'), |
|
68 | 68 | 'description' => '', |
69 | 69 | ), |
70 | 70 | '_wpinv_country' => array( |
71 | - 'label' => __( 'Country / Region', 'invoicing' ), |
|
71 | + 'label' => __('Country / Region', 'invoicing'), |
|
72 | 72 | 'description' => '', |
73 | 73 | 'class' => 'getpaid_js_field-country', |
74 | 74 | 'type' => 'select', |
75 | - 'options' => array( '' => __( 'Select a country / region…', 'invoicing' ) ) + wpinv_get_country_list(), |
|
75 | + 'options' => array('' => __('Select a country / region…', 'invoicing')) + wpinv_get_country_list(), |
|
76 | 76 | ), |
77 | 77 | '_wpinv_state' => array( |
78 | - 'label' => __( 'State / County', 'invoicing' ), |
|
79 | - 'description' => __( 'State / County or state code', 'invoicing' ), |
|
78 | + 'label' => __('State / County', 'invoicing'), |
|
79 | + 'description' => __('State / County or state code', 'invoicing'), |
|
80 | 80 | 'class' => 'getpaid_js_field-state regular-text', |
81 | 81 | ), |
82 | 82 | '_wpinv_phone' => array( |
83 | - 'label' => __( 'Phone', 'invoicing' ), |
|
83 | + 'label' => __('Phone', 'invoicing'), |
|
84 | 84 | 'description' => '', |
85 | 85 | ), |
86 | 86 | '_wpinv_vat_number' => array( |
87 | - 'label' => __( 'VAT Number', 'invoicing' ), |
|
87 | + 'label' => __('VAT Number', 'invoicing'), |
|
88 | 88 | 'description' => '', |
89 | 89 | ), |
90 | 90 | ), |
@@ -99,39 +99,39 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @param WP_User $user |
101 | 101 | */ |
102 | - public function add_customer_meta_fields( $user ) { |
|
102 | + public function add_customer_meta_fields($user) { |
|
103 | 103 | |
104 | - if ( ! apply_filters( 'getpaid_current_user_can_edit_customer_meta_fields', current_user_can( 'manage_options' ), $user->ID ) ) { |
|
104 | + if (!apply_filters('getpaid_current_user_can_edit_customer_meta_fields', current_user_can('manage_options'), $user->ID)) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
108 | 108 | $show_fields = $this->get_customer_meta_fields(); |
109 | 109 | |
110 | - foreach ( $show_fields as $fieldset_key => $fieldset ) : |
|
110 | + foreach ($show_fields as $fieldset_key => $fieldset) : |
|
111 | 111 | ?> |
112 | 112 | <h2><?php echo $fieldset['title']; ?></h2> |
113 | - <table class="form-table" id="<?php echo esc_attr( 'getpaid-fieldset-' . $fieldset_key ); ?>"> |
|
114 | - <?php foreach ( $fieldset['fields'] as $key => $field ) : ?> |
|
113 | + <table class="form-table" id="<?php echo esc_attr('getpaid-fieldset-' . $fieldset_key); ?>"> |
|
114 | + <?php foreach ($fieldset['fields'] as $key => $field) : ?> |
|
115 | 115 | <tr> |
116 | 116 | <th> |
117 | - <label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ); ?></label> |
|
117 | + <label for="<?php echo esc_attr($key); ?>"><?php echo esc_html($field['label']); ?></label> |
|
118 | 118 | </th> |
119 | 119 | <td> |
120 | - <?php if ( ! empty( $field['type'] ) && 'select' === $field['type'] ) : ?> |
|
121 | - <select name="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>" class="<?php echo esc_attr( $field['class'] ); ?> wpi_select2" style="width: 25em;"> |
|
120 | + <?php if (!empty($field['type']) && 'select' === $field['type']) : ?> |
|
121 | + <select name="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" class="<?php echo esc_attr($field['class']); ?> wpi_select2" style="width: 25em;"> |
|
122 | 122 | <?php |
123 | - $selected = esc_attr( get_user_meta( $user->ID, $key, true ) ); |
|
124 | - foreach ( $field['options'] as $option_key => $option_value ) : |
|
123 | + $selected = esc_attr(get_user_meta($user->ID, $key, true)); |
|
124 | + foreach ($field['options'] as $option_key => $option_value) : |
|
125 | 125 | ?> |
126 | - <option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $selected, $option_key, true ); ?>><?php echo esc_html( $option_value ); ?></option> |
|
126 | + <option value="<?php echo esc_attr($option_key); ?>" <?php selected($selected, $option_key, true); ?>><?php echo esc_html($option_value); ?></option> |
|
127 | 127 | <?php endforeach; ?> |
128 | 128 | </select> |
129 | - <?php elseif ( ! empty( $field['type'] ) && 'checkbox' === $field['type'] ) : ?> |
|
130 | - <input type="checkbox" name="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>" value="1" class="<?php echo esc_attr( $field['class'] ); ?>" <?php checked( (int) get_user_meta( $user->ID, $key, true ), 1, true ); ?> /> |
|
129 | + <?php elseif (!empty($field['type']) && 'checkbox' === $field['type']) : ?> |
|
130 | + <input type="checkbox" name="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" value="1" class="<?php echo esc_attr($field['class']); ?>" <?php checked((int) get_user_meta($user->ID, $key, true), 1, true); ?> /> |
|
131 | 131 | <?php else : ?> |
132 | - <input type="text" name="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( $this->get_user_meta( $user->ID, $key ) ); ?>" class="<?php echo ( ! empty( $field['class'] ) ? esc_attr( $field['class'] ) : 'regular-text' ); ?>" /> |
|
132 | + <input type="text" name="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" value="<?php echo esc_attr($this->get_user_meta($user->ID, $key)); ?>" class="<?php echo (!empty($field['class']) ? esc_attr($field['class']) : 'regular-text'); ?>" /> |
|
133 | 133 | <?php endif; ?> |
134 | - <p class="description"><?php echo wp_kses_post( $field['description'] ); ?></p> |
|
134 | + <p class="description"><?php echo wp_kses_post($field['description']); ?></p> |
|
135 | 135 | </td> |
136 | 136 | </tr> |
137 | 137 | <?php endforeach; ?> |
@@ -145,21 +145,21 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @param int $user_id User ID of the user being saved |
147 | 147 | */ |
148 | - public function save_customer_meta_fields( $user_id ) { |
|
149 | - if ( ! apply_filters( 'getpaid_current_user_can_edit_customer_meta_fields', current_user_can( 'manage_options' ), $user_id ) ) { |
|
148 | + public function save_customer_meta_fields($user_id) { |
|
149 | + if (!apply_filters('getpaid_current_user_can_edit_customer_meta_fields', current_user_can('manage_options'), $user_id)) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | |
153 | 153 | $save_fields = $this->get_customer_meta_fields(); |
154 | 154 | |
155 | - foreach ( $save_fields as $fieldset ) { |
|
155 | + foreach ($save_fields as $fieldset) { |
|
156 | 156 | |
157 | - foreach ( $fieldset['fields'] as $key => $field ) { |
|
157 | + foreach ($fieldset['fields'] as $key => $field) { |
|
158 | 158 | |
159 | - if ( isset( $field['type'] ) && 'checkbox' === $field['type'] ) { |
|
160 | - update_user_meta( $user_id, $key, ! empty( $_POST[ $key ] ) ); |
|
161 | - } elseif ( isset( $_POST[ $key ] ) ) { |
|
162 | - update_user_meta( $user_id, $key, wpinv_clean( $_POST[ $key ] ) ); |
|
159 | + if (isset($field['type']) && 'checkbox' === $field['type']) { |
|
160 | + update_user_meta($user_id, $key, !empty($_POST[$key])); |
|
161 | + } elseif (isset($_POST[$key])) { |
|
162 | + update_user_meta($user_id, $key, wpinv_clean($_POST[$key])); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | } |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | * @param string $key Key for user meta field |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - protected function get_user_meta( $user_id, $key ) { |
|
177 | - $value = get_user_meta( $user_id, $key, true ); |
|
178 | - $existing_fields = array( '_wpinv_first_name', '_wpinv_last_name' ); |
|
179 | - if ( ! $value && in_array( $key, $existing_fields ) ) { |
|
180 | - $value = get_user_meta( $user_id, str_replace( '_wpinv_', '', $key ), true ); |
|
176 | + protected function get_user_meta($user_id, $key) { |
|
177 | + $value = get_user_meta($user_id, $key, true); |
|
178 | + $existing_fields = array('_wpinv_first_name', '_wpinv_last_name'); |
|
179 | + if (!$value && in_array($key, $existing_fields)) { |
|
180 | + $value = get_user_meta($user_id, str_replace('_wpinv_', '', $key), true); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | return $value; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
28 | - $customer = $invoice->exists() ? $invoice->get_user_id( 'edit' ) : get_current_user_id(); |
|
29 | - $customer = new WP_User( $customer ); |
|
30 | - $display = sprintf( _x( '%1$s (%2$s)', 'user dropdown', 'invoicing' ), $customer->display_name, $customer->user_email ); |
|
31 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | + $customer = $invoice->exists() ? $invoice->get_user_id('edit') : get_current_user_id(); |
|
29 | + $customer = new WP_User($customer); |
|
30 | + $display = sprintf(_x('%1$s (%2$s)', 'user dropdown', 'invoicing'), $customer->display_name, $customer->user_email); |
|
31 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
32 | 32 | |
33 | 33 | ?> |
34 | 34 | |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | <div class="col-12 col-sm-6"> |
44 | 44 | <div id="getpaid-invoice-user-id-wrapper" class="form-group"> |
45 | 45 | <div> |
46 | - <label for="post_author_override"><?php _e( 'Customer', 'invoicing' );?></label> |
|
46 | + <label for="post_author_override"><?php _e('Customer', 'invoicing'); ?></label> |
|
47 | 47 | </div> |
48 | 48 | <div> |
49 | - <select name="post_author_override" id="wpinv_post_author_override" class="getpaid-customer-search form-control regular-text" data-placeholder="<?php esc_attr_e( 'Search for a customer by email or name', 'invoicing' ); ?>"> |
|
50 | - <option selected="selected" value="<?php echo (int) $customer->ID; ?>"><?php echo esc_html( $display ); ?> </option>) |
|
49 | + <select name="post_author_override" id="wpinv_post_author_override" class="getpaid-customer-search form-control regular-text" data-placeholder="<?php esc_attr_e('Search for a customer by email or name', 'invoicing'); ?>"> |
|
50 | + <option selected="selected" value="<?php echo (int) $customer->ID; ?>"><?php echo esc_html($display); ?> </option>) |
|
51 | 51 | </select> |
52 | 52 | </div> |
53 | 53 | </div> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'type' => 'text', |
61 | 61 | 'id' => 'getpaid-invoice-new-user-email', |
62 | 62 | 'name' => 'wpinv_email', |
63 | - 'label' => __( 'Email', 'invoicing' ) . '<span class="required">*</span>', |
|
63 | + 'label' => __('Email', 'invoicing') . '<span class="required">*</span>', |
|
64 | 64 | 'label_type' => 'vertical', |
65 | 65 | 'placeholder' => '[email protected]', |
66 | 66 | 'class' => 'form-control-sm', |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | </div> |
71 | 71 | </div> |
72 | 72 | <div class="col-12 col-sm-6 form-group mt-sm-4"> |
73 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
73 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
74 | 74 | <a id="getpaid-invoice-fill-user-details" class="button button-small button-secondary" href="javascript:void(0)"> |
75 | 75 | <i aria-hidden="true" class="fa fa-refresh"></i> |
76 | - <?php _e( 'Fill User Details', 'invoicing' );?> |
|
76 | + <?php _e('Fill User Details', 'invoicing'); ?> |
|
77 | 77 | </a> |
78 | 78 | <a id="getpaid-invoice-create-new-user-button" class="button button-small button-secondary" href="javascript:void(0)"> |
79 | 79 | <i aria-hidden="true" class="fa fa-plus"></i> |
80 | - <?php _e( 'Add New User', 'invoicing' );?> |
|
80 | + <?php _e('Add New User', 'invoicing'); ?> |
|
81 | 81 | </a> |
82 | 82 | <a id="getpaid-invoice-cancel-create-new-user" class="button button-small button-secondary d-none" href="javascript:void(0)"> |
83 | 83 | <i aria-hidden="true" class="fa fa-close"></i> |
84 | - <?php _e( 'Cancel', 'invoicing' );?> |
|
84 | + <?php _e('Cancel', 'invoicing'); ?> |
|
85 | 85 | </a> |
86 | 86 | <?php endif; ?> |
87 | 87 | </div> |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | 'type' => 'text', |
95 | 95 | 'id' => 'wpinv_first_name', |
96 | 96 | 'name' => 'wpinv_first_name', |
97 | - 'label' => __( 'First Name', 'invoicing' ), |
|
97 | + 'label' => __('First Name', 'invoicing'), |
|
98 | 98 | 'label_type' => 'vertical', |
99 | 99 | 'placeholder' => '', |
100 | 100 | 'class' => 'form-control-sm', |
101 | - 'value' => $invoice->get_first_name( 'edit' ), |
|
101 | + 'value' => $invoice->get_first_name('edit'), |
|
102 | 102 | ) |
103 | 103 | ); |
104 | 104 | ?> |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | 'type' => 'text', |
111 | 111 | 'id' => 'wpinv_last_name', |
112 | 112 | 'name' => 'wpinv_last_name', |
113 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
113 | + 'label' => __('Last Name', 'invoicing'), |
|
114 | 114 | 'label_type' => 'vertical', |
115 | 115 | 'placeholder' => '', |
116 | 116 | 'class' => 'form-control-sm', |
117 | - 'value' => $invoice->get_last_name( 'edit' ), |
|
117 | + 'value' => $invoice->get_last_name('edit'), |
|
118 | 118 | ) |
119 | 119 | ); |
120 | 120 | ?> |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | 'type' => 'text', |
130 | 130 | 'id' => 'wpinv_company', |
131 | 131 | 'name' => 'wpinv_company', |
132 | - 'label' => __( 'Company', 'invoicing' ), |
|
132 | + 'label' => __('Company', 'invoicing'), |
|
133 | 133 | 'label_type' => 'vertical', |
134 | 134 | 'placeholder' => '', |
135 | 135 | 'class' => 'form-control-sm', |
136 | - 'value' => $invoice->get_company( 'edit' ), |
|
136 | + 'value' => $invoice->get_company('edit'), |
|
137 | 137 | ) |
138 | 138 | ); |
139 | 139 | ?> |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | 'type' => 'text', |
146 | 146 | 'id' => 'wpinv_vat_number', |
147 | 147 | 'name' => 'wpinv_vat_number', |
148 | - 'label' => __( 'Vat Number', 'invoicing' ), |
|
148 | + 'label' => __('Vat Number', 'invoicing'), |
|
149 | 149 | 'label_type' => 'vertical', |
150 | 150 | 'placeholder' => '', |
151 | 151 | 'class' => 'form-control-sm getpaid-recalculate-prices-on-change', |
152 | - 'value' => $invoice->get_vat_number( 'edit' ), |
|
152 | + 'value' => $invoice->get_vat_number('edit'), |
|
153 | 153 | ) |
154 | 154 | ); |
155 | 155 | ?> |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | 'type' => 'text', |
165 | 165 | 'id' => 'wpinv_address', |
166 | 166 | 'name' => 'wpinv_address', |
167 | - 'label' => __( 'Address', 'invoicing' ), |
|
167 | + 'label' => __('Address', 'invoicing'), |
|
168 | 168 | 'label_type' => 'vertical', |
169 | 169 | 'placeholder' => '', |
170 | 170 | 'class' => 'form-control-sm', |
171 | - 'value' => $invoice->get_address( 'edit' ), |
|
171 | + 'value' => $invoice->get_address('edit'), |
|
172 | 172 | ) |
173 | 173 | ); |
174 | 174 | ?> |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | 'type' => 'text', |
181 | 181 | 'id' => 'wpinv_city', |
182 | 182 | 'name' => 'wpinv_city', |
183 | - 'label' => __( 'City', 'invoicing' ), |
|
183 | + 'label' => __('City', 'invoicing'), |
|
184 | 184 | 'label_type' => 'vertical', |
185 | 185 | 'placeholder' => '', |
186 | 186 | 'class' => 'form-control-sm', |
187 | - 'value' => $invoice->get_city( 'edit' ), |
|
187 | + 'value' => $invoice->get_city('edit'), |
|
188 | 188 | ) |
189 | 189 | ); |
190 | 190 | ?> |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | array( |
199 | 199 | 'id' => 'wpinv_country', |
200 | 200 | 'name' => 'wpinv_country', |
201 | - 'label' => __( 'Country', 'invoicing' ), |
|
201 | + 'label' => __('Country', 'invoicing'), |
|
202 | 202 | 'label_type' => 'vertical', |
203 | - 'placeholder' => __( 'Choose a country', 'invoicing' ), |
|
203 | + 'placeholder' => __('Choose a country', 'invoicing'), |
|
204 | 204 | 'class' => 'form-control-sm getpaid-recalculate-prices-on-change', |
205 | - 'value' => $invoice->get_country( 'edit' ), |
|
205 | + 'value' => $invoice->get_country('edit'), |
|
206 | 206 | 'options' => wpinv_get_country_list(), |
207 | 207 | 'data-allow-clear' => 'false', |
208 | 208 | 'select2' => true, |
@@ -213,20 +213,20 @@ discard block |
||
213 | 213 | <div class="col-12 col-sm-6"> |
214 | 214 | <?php |
215 | 215 | |
216 | - $states = wpinv_get_country_states( $invoice->get_country( 'edit' ) ); |
|
216 | + $states = wpinv_get_country_states($invoice->get_country('edit')); |
|
217 | 217 | |
218 | - if ( empty( $states ) ) { |
|
218 | + if (empty($states)) { |
|
219 | 219 | |
220 | 220 | echo aui()->input( |
221 | 221 | array( |
222 | 222 | 'type' => 'text', |
223 | 223 | 'id' => 'wpinv_state', |
224 | 224 | 'name' => 'wpinv_state', |
225 | - 'label' => __( 'State', 'invoicing' ), |
|
225 | + 'label' => __('State', 'invoicing'), |
|
226 | 226 | 'label_type' => 'vertical', |
227 | 227 | 'placeholder' => '', |
228 | 228 | 'class' => 'form-control-sm', |
229 | - 'value' => $invoice->get_state( 'edit' ), |
|
229 | + 'value' => $invoice->get_state('edit'), |
|
230 | 230 | ) |
231 | 231 | ); |
232 | 232 | |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | array( |
237 | 237 | 'id' => 'wpinv_state', |
238 | 238 | 'name' => 'wpinv_state', |
239 | - 'label' => __( 'State', 'invoicing' ), |
|
239 | + 'label' => __('State', 'invoicing'), |
|
240 | 240 | 'label_type' => 'vertical', |
241 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
241 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
242 | 242 | 'class' => 'form-control-sm', |
243 | - 'value' => $invoice->get_state( 'edit' ), |
|
243 | + 'value' => $invoice->get_state('edit'), |
|
244 | 244 | 'options' => $states, |
245 | 245 | 'data-allow-clear' => 'false', |
246 | 246 | 'select2' => true, |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | 'type' => 'text', |
262 | 262 | 'id' => 'wpinv_zip', |
263 | 263 | 'name' => 'wpinv_zip', |
264 | - 'label' => __( 'Zip / Postal Code', 'invoicing' ), |
|
264 | + 'label' => __('Zip / Postal Code', 'invoicing'), |
|
265 | 265 | 'label_type' => 'vertical', |
266 | 266 | 'placeholder' => '', |
267 | 267 | 'class' => 'form-control-sm', |
268 | - 'value' => $invoice->get_zip( 'edit' ), |
|
268 | + 'value' => $invoice->get_zip('edit'), |
|
269 | 269 | ) |
270 | 270 | ); |
271 | 271 | ?> |
@@ -277,19 +277,19 @@ discard block |
||
277 | 277 | 'type' => 'text', |
278 | 278 | 'id' => 'wpinv_phone', |
279 | 279 | 'name' => 'wpinv_phone', |
280 | - 'label' => __( 'Phone', 'invoicing' ), |
|
280 | + 'label' => __('Phone', 'invoicing'), |
|
281 | 281 | 'label_type' => 'vertical', |
282 | 282 | 'placeholder' => '', |
283 | 283 | 'class' => 'form-control-sm', |
284 | - 'value' => $invoice->get_phone( 'edit' ), |
|
284 | + 'value' => $invoice->get_phone('edit'), |
|
285 | 285 | ) |
286 | 286 | ); |
287 | 287 | ?> |
288 | 288 | </div> |
289 | 289 | </div> |
290 | 290 | |
291 | - <?php if ( ! apply_filters( 'getpaid_use_new_invoice_items_metabox', false ) ) : ?> |
|
292 | - <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?> |
|
291 | + <?php if (!apply_filters('getpaid_use_new_invoice_items_metabox', false)) : ?> |
|
292 | + <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?> |
|
293 | 293 | |
294 | 294 | <div class="row"> |
295 | 295 | <div class="col-12 col-sm-6"> |
@@ -298,14 +298,14 @@ discard block |
||
298 | 298 | array( |
299 | 299 | 'id' => 'wpinv_template', |
300 | 300 | 'name' => 'wpinv_template', |
301 | - 'label' => __( 'Template', 'invoicing' ), |
|
301 | + 'label' => __('Template', 'invoicing'), |
|
302 | 302 | 'label_type' => 'vertical', |
303 | - 'placeholder' => __( 'Choose a template', 'invoicing' ), |
|
303 | + 'placeholder' => __('Choose a template', 'invoicing'), |
|
304 | 304 | 'class' => 'form-control-sm', |
305 | - 'value' => $invoice->get_template( 'edit' ), |
|
305 | + 'value' => $invoice->get_template('edit'), |
|
306 | 306 | 'options' => array( |
307 | - 'quantity' => __( 'Quantity', 'invoicing' ), |
|
308 | - 'hours' => __( 'Hours', 'invoicing' ), |
|
307 | + 'quantity' => __('Quantity', 'invoicing'), |
|
308 | + 'hours' => __('Hours', 'invoicing'), |
|
309 | 309 | //'amount' => __( 'Amount Only', 'invoicing' ), |
310 | 310 | ), |
311 | 311 | 'data-allow-clear' => 'false', |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | array( |
323 | 323 | 'id' => 'wpinv_currency', |
324 | 324 | 'name' => 'wpinv_currency', |
325 | - 'label' => __( 'Currency', 'invoicing' ), |
|
325 | + 'label' => __('Currency', 'invoicing'), |
|
326 | 326 | 'label_type' => 'vertical', |
327 | - 'placeholder' => __( 'Select Invoice Currency', 'invoicing' ), |
|
327 | + 'placeholder' => __('Select Invoice Currency', 'invoicing'), |
|
328 | 328 | 'class' => 'form-control-sm getpaid-recalculate-prices-on-change', |
329 | - 'value' => $invoice->get_currency( 'edit' ), |
|
329 | + 'value' => $invoice->get_currency('edit'), |
|
330 | 330 | 'required' => false, |
331 | 331 | 'data-allow-clear' => 'false', |
332 | 332 | 'select2' => true, |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | </div> |
339 | 339 | </div> |
340 | 340 | |
341 | - <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?> |
|
341 | + <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?> |
|
342 | 342 | <?php endif; ?> |
343 | 343 | |
344 | 344 | <div class="row"> |
@@ -349,18 +349,18 @@ discard block |
||
349 | 349 | 'type' => 'text', |
350 | 350 | 'id' => 'wpinv_company_id', |
351 | 351 | 'name' => 'wpinv_company_id', |
352 | - 'label' => __( 'Company ID', 'invoicing' ), |
|
352 | + 'label' => __('Company ID', 'invoicing'), |
|
353 | 353 | 'label_type' => 'vertical', |
354 | 354 | 'placeholder' => '', |
355 | 355 | 'class' => 'form-control-sm', |
356 | - 'value' => $invoice->get_company_id( 'edit' ), |
|
356 | + 'value' => $invoice->get_company_id('edit'), |
|
357 | 357 | ) |
358 | 358 | ); |
359 | 359 | ?> |
360 | 360 | </div> |
361 | 361 | </div> |
362 | 362 | |
363 | - <?php do_action( 'getpaid_after_metabox_invoice_address', $invoice ); ?> |
|
363 | + <?php do_action('getpaid_after_metabox_invoice_address', $invoice); ?> |
|
364 | 364 | </div> |
365 | 365 | <?php |
366 | 366 | } |
@@ -370,51 +370,51 @@ discard block |
||
370 | 370 | * |
371 | 371 | * @param int $post_id |
372 | 372 | */ |
373 | - public static function save( $post_id ) { |
|
373 | + public static function save($post_id) { |
|
374 | 374 | |
375 | 375 | // Prepare the invoice. |
376 | - $invoice = new WPInv_Invoice( $post_id ); |
|
376 | + $invoice = new WPInv_Invoice($post_id); |
|
377 | 377 | |
378 | 378 | // Load new data. |
379 | 379 | $invoice->set_props( |
380 | 380 | array( |
381 | - 'template' => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null, |
|
382 | - 'email_cc' => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null, |
|
383 | - 'disable_taxes' => ! empty( $_POST['disable_taxes'] ), |
|
384 | - 'currency' => isset( $_POST['wpinv_currency'] ) ? wpinv_clean( $_POST['wpinv_currency'] ) : null, |
|
385 | - 'gateway' => ( $invoice->needs_payment() && isset( $_POST['wpinv_gateway'] ) ) ? wpinv_clean( $_POST['wpinv_gateway'] ) : null, |
|
386 | - 'address' => isset( $_POST['wpinv_address'] ) ? wpinv_clean( $_POST['wpinv_address'] ) : null, |
|
387 | - 'vat_number' => isset( $_POST['wpinv_vat_number'] ) ? wpinv_clean( $_POST['wpinv_vat_number'] ) : null, |
|
388 | - 'company' => isset( $_POST['wpinv_company'] ) ? wpinv_clean( $_POST['wpinv_company'] ) : null, |
|
389 | - 'company_id' => isset( $_POST['wpinv_company_id'] ) ? wpinv_clean( $_POST['wpinv_company_id'] ) : null, |
|
390 | - 'zip' => isset( $_POST['wpinv_zip'] ) ? wpinv_clean( $_POST['wpinv_zip'] ) : null, |
|
391 | - 'state' => isset( $_POST['wpinv_state'] ) ? wpinv_clean( $_POST['wpinv_state'] ) : null, |
|
392 | - 'city' => isset( $_POST['wpinv_city'] ) ? wpinv_clean( $_POST['wpinv_city'] ) : null, |
|
393 | - 'country' => isset( $_POST['wpinv_country'] ) ? wpinv_clean( $_POST['wpinv_country'] ) : null, |
|
394 | - 'phone' => isset( $_POST['wpinv_phone'] ) ? wpinv_clean( $_POST['wpinv_phone'] ) : null, |
|
395 | - 'first_name' => isset( $_POST['wpinv_first_name'] ) ? wpinv_clean( $_POST['wpinv_first_name'] ) : null, |
|
396 | - 'last_name' => isset( $_POST['wpinv_last_name'] ) ? wpinv_clean( $_POST['wpinv_last_name'] ) : null, |
|
397 | - 'author' => isset( $_POST['post_author_override'] ) ? wpinv_clean( $_POST['post_author_override'] ) : null, |
|
398 | - 'date_created' => isset( $_POST['date_created'] ) ? wpinv_clean( $_POST['date_created'] ) : null, |
|
399 | - 'date_completed' => isset( $_POST['wpinv_date_completed'] ) ? wpinv_clean( $_POST['wpinv_date_completed'] ) : null, |
|
400 | - 'due_date' => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null, |
|
401 | - 'number' => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null, |
|
402 | - 'status' => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null, |
|
381 | + 'template' => isset($_POST['wpinv_template']) ? wpinv_clean($_POST['wpinv_template']) : null, |
|
382 | + 'email_cc' => isset($_POST['wpinv_cc']) ? wpinv_clean($_POST['wpinv_cc']) : null, |
|
383 | + 'disable_taxes' => !empty($_POST['disable_taxes']), |
|
384 | + 'currency' => isset($_POST['wpinv_currency']) ? wpinv_clean($_POST['wpinv_currency']) : null, |
|
385 | + 'gateway' => ($invoice->needs_payment() && isset($_POST['wpinv_gateway'])) ? wpinv_clean($_POST['wpinv_gateway']) : null, |
|
386 | + 'address' => isset($_POST['wpinv_address']) ? wpinv_clean($_POST['wpinv_address']) : null, |
|
387 | + 'vat_number' => isset($_POST['wpinv_vat_number']) ? wpinv_clean($_POST['wpinv_vat_number']) : null, |
|
388 | + 'company' => isset($_POST['wpinv_company']) ? wpinv_clean($_POST['wpinv_company']) : null, |
|
389 | + 'company_id' => isset($_POST['wpinv_company_id']) ? wpinv_clean($_POST['wpinv_company_id']) : null, |
|
390 | + 'zip' => isset($_POST['wpinv_zip']) ? wpinv_clean($_POST['wpinv_zip']) : null, |
|
391 | + 'state' => isset($_POST['wpinv_state']) ? wpinv_clean($_POST['wpinv_state']) : null, |
|
392 | + 'city' => isset($_POST['wpinv_city']) ? wpinv_clean($_POST['wpinv_city']) : null, |
|
393 | + 'country' => isset($_POST['wpinv_country']) ? wpinv_clean($_POST['wpinv_country']) : null, |
|
394 | + 'phone' => isset($_POST['wpinv_phone']) ? wpinv_clean($_POST['wpinv_phone']) : null, |
|
395 | + 'first_name' => isset($_POST['wpinv_first_name']) ? wpinv_clean($_POST['wpinv_first_name']) : null, |
|
396 | + 'last_name' => isset($_POST['wpinv_last_name']) ? wpinv_clean($_POST['wpinv_last_name']) : null, |
|
397 | + 'author' => isset($_POST['post_author_override']) ? wpinv_clean($_POST['post_author_override']) : null, |
|
398 | + 'date_created' => isset($_POST['date_created']) ? wpinv_clean($_POST['date_created']) : null, |
|
399 | + 'date_completed' => isset($_POST['wpinv_date_completed']) ? wpinv_clean($_POST['wpinv_date_completed']) : null, |
|
400 | + 'due_date' => isset($_POST['wpinv_due_date']) ? wpinv_clean($_POST['wpinv_due_date']) : null, |
|
401 | + 'number' => isset($_POST['wpinv_number']) ? wpinv_clean($_POST['wpinv_number']) : null, |
|
402 | + 'status' => isset($_POST['wpinv_status']) ? wpinv_clean($_POST['wpinv_status']) : null, |
|
403 | 403 | ) |
404 | 404 | ); |
405 | 405 | |
406 | 406 | // Discount code. |
407 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
407 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
408 | 408 | |
409 | - if ( isset( $_POST['wpinv_discount_code'] ) ) { |
|
410 | - $invoice->set_discount_code( wpinv_clean( $_POST['wpinv_discount_code'] ) ); |
|
409 | + if (isset($_POST['wpinv_discount_code'])) { |
|
410 | + $invoice->set_discount_code(wpinv_clean($_POST['wpinv_discount_code'])); |
|
411 | 411 | } |
412 | 412 | |
413 | - $discount = new WPInv_Discount( $invoice->get_discount_code() ); |
|
414 | - if ( $discount->exists() ) { |
|
415 | - $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) ); |
|
413 | + $discount = new WPInv_Discount($invoice->get_discount_code()); |
|
414 | + if ($discount->exists()) { |
|
415 | + $invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount)); |
|
416 | 416 | } else { |
417 | - $invoice->remove_discount( 'discount_code' ); |
|
417 | + $invoice->remove_discount('discount_code'); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | // Recalculate totals. |
@@ -423,17 +423,17 @@ discard block |
||
423 | 423 | } |
424 | 424 | |
425 | 425 | // If we're creating a new user... |
426 | - if ( ! empty( $_POST['wpinv_new_user'] ) && is_email( stripslashes( $_POST['wpinv_email'] ) ) ) { |
|
426 | + if (!empty($_POST['wpinv_new_user']) && is_email(stripslashes($_POST['wpinv_email']))) { |
|
427 | 427 | |
428 | 428 | // Attempt to create the user. |
429 | - $user = wpinv_create_user( sanitize_email( stripslashes( $_POST['wpinv_email'] ) ) ); |
|
429 | + $user = wpinv_create_user(sanitize_email(stripslashes($_POST['wpinv_email']))); |
|
430 | 430 | |
431 | 431 | |
432 | 432 | // If successful, update the invoice author. |
433 | - if ( is_numeric( $user ) ) { |
|
434 | - $invoice->set_author( $user ); |
|
433 | + if (is_numeric($user)) { |
|
434 | + $invoice->set_author($user); |
|
435 | 435 | } else { |
436 | - wpinv_error_log( $user->get_error_message(), __( 'Invoice add new user', 'invoicing' ), __FILE__, __LINE__ ); |
|
436 | + wpinv_error_log($user->get_error_message(), __('Invoice add new user', 'invoicing'), __FILE__, __LINE__); |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
@@ -447,24 +447,24 @@ discard block |
||
447 | 447 | $GLOBALS['wpinv_skip_invoice_notification'] = false; |
448 | 448 | |
449 | 449 | // (Maybe) send new user notification. |
450 | - $should_send_notification = wpinv_get_option( 'disable_new_user_emails' ); |
|
451 | - if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', empty( $should_send_notification ) ) ) { |
|
452 | - wp_send_new_user_notifications( $user, 'user' ); |
|
450 | + $should_send_notification = wpinv_get_option('disable_new_user_emails'); |
|
451 | + if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', empty($should_send_notification))) { |
|
452 | + wp_send_new_user_notifications($user, 'user'); |
|
453 | 453 | } |
454 | 454 | |
455 | - if ( ! empty( $_POST['send_to_customer'] ) && ! $invoice->is_draft() ) { |
|
455 | + if (!empty($_POST['send_to_customer']) && !$invoice->is_draft()) { |
|
456 | 456 | |
457 | - $sent = getpaid()->get( 'invoice_emails' )->user_invoice( $invoice, true ); |
|
457 | + $sent = getpaid()->get('invoice_emails')->user_invoice($invoice, true); |
|
458 | 458 | |
459 | - if ( $sent ) { |
|
460 | - getpaid_admin()->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) ); |
|
459 | + if ($sent) { |
|
460 | + getpaid_admin()->show_success(__('Invoice was successfully sent to the customer', 'invoicing')); |
|
461 | 461 | } else { |
462 | - getpaid_admin()->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) ); |
|
462 | + getpaid_admin()->show_error(__('Could not send the invoice to the customer', 'invoicing')); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | } |
466 | 466 | |
467 | 467 | // Fires after an invoice is saved. |
468 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
468 | + do_action('wpinv_invoice_metabox_saved', $invoice); |
|
469 | 469 | } |
470 | 470 | } |
@@ -15,20 +15,20 @@ discard block |
||
15 | 15 | * @package GetPaid |
16 | 16 | */ |
17 | 17 | |
18 | -defined( 'ABSPATH' ) || exit; |
|
18 | +defined('ABSPATH') || exit; |
|
19 | 19 | |
20 | 20 | // Define constants. |
21 | -if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
|
22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
21 | +if (!defined('WPINV_PLUGIN_FILE')) { |
|
22 | + define('WPINV_PLUGIN_FILE', __FILE__); |
|
23 | 23 | } |
24 | 24 | |
25 | -if ( ! defined( 'WPINV_VERSION' ) ) { |
|
26 | - define( 'WPINV_VERSION', '2.5.14' ); |
|
25 | +if (!defined('WPINV_VERSION')) { |
|
26 | + define('WPINV_VERSION', '2.5.14'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // Include the main Invoicing class. |
30 | -if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
|
31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
30 | +if (!class_exists('WPInv_Plugin', false)) { |
|
31 | + require_once plugin_dir_path(WPINV_PLUGIN_FILE) . 'includes/class-wpinv.php'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function getpaid() { |
41 | 41 | |
42 | - if ( empty( $GLOBALS['invoicing'] ) ) { |
|
42 | + if (empty($GLOBALS['invoicing'])) { |
|
43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
44 | 44 | } |
45 | 45 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @since 2.0.8 |
53 | 53 | */ |
54 | 54 | function getpaid_deactivation_hook() { |
55 | - update_option( 'wpinv_flush_permalinks', 1 ); |
|
55 | + update_option('wpinv_flush_permalinks', 1); |
|
56 | 56 | } |
57 | -register_deactivation_hook( __FILE__, 'getpaid_deactivation_hook' ); |
|
57 | +register_deactivation_hook(__FILE__, 'getpaid_deactivation_hook'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @deprecated |
@@ -64,4 +64,4 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | // Kickstart the plugin. |
67 | -add_action( 'plugins_loaded', 'getpaid', -100 ); |
|
67 | +add_action('plugins_loaded', 'getpaid', -100); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,20 +21,20 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the item. |
27 | - $item = new WPInv_Item( $post ); |
|
27 | + $item = new WPInv_Item($post); |
|
28 | 28 | |
29 | 29 | ?> |
30 | 30 | |
31 | 31 | <div class='bsui' style='padding-top: 10px;'> |
32 | - <?php do_action( 'wpinv_item_before_info_metabox', $item ); ?> |
|
32 | + <?php do_action('wpinv_item_before_info_metabox', $item); ?> |
|
33 | 33 | |
34 | 34 | <div class="wpinv_item_type form-group row"> |
35 | 35 | <label for="wpinv_item_type" class="col-sm-12 col-form-label"> |
36 | - <?php _e( 'Item Type', 'invoicing' );?> |
|
37 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php echo strip_tags( self::get_tooltip( $post ) ); ?>"></span> |
|
36 | + <?php _e('Item Type', 'invoicing'); ?> |
|
37 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php echo strip_tags(self::get_tooltip($post)); ?>"></span> |
|
38 | 38 | </label> |
39 | 39 | |
40 | 40 | <div class="col-sm-12"> |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | array( |
45 | 45 | 'id' => 'wpinv_item_type', |
46 | 46 | 'name' => 'wpinv_item_type', |
47 | - 'placeholder' => __( 'Select item type', 'invoicing' ), |
|
48 | - 'value' => $item->get_type( 'edit' ), |
|
47 | + 'placeholder' => __('Select item type', 'invoicing'), |
|
48 | + 'value' => $item->get_type('edit'), |
|
49 | 49 | 'select2' => true, |
50 | 50 | 'data-allow-clear' => 'false', |
51 | 51 | 'no_wrap' => true, |
@@ -57,59 +57,59 @@ discard block |
||
57 | 57 | </div> |
58 | 58 | </div> |
59 | 59 | |
60 | - <?php if ( 'fee' === $item->get_type( 'edit' ) || 'custom' === $item->get_type( 'edit' ) ) : ?> |
|
60 | + <?php if ('fee' === $item->get_type('edit') || 'custom' === $item->get_type('edit')) : ?> |
|
61 | 61 | |
62 | 62 | <div class="wpinv_item_shortcode form-group row"> |
63 | 63 | <label for="wpinv_item_shortcode" class="col-sm-12 col-form-label"> |
64 | - <?php _e( 'Payment Form Shortcode', 'invoicing' );?> |
|
65 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a payment form', 'invoicing' ); ?>"></span> |
|
64 | + <?php _e('Payment Form Shortcode', 'invoicing'); ?> |
|
65 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a payment form', 'invoicing'); ?>"></span> |
|
66 | 66 | </label> |
67 | 67 | |
68 | 68 | <div class="col-sm-12"> |
69 | - <input onClick="this.select()" type="text" id="wpinv_item_shortcode" value="[getpaid item=<?php echo esc_attr( $item->get_id() ); ?>]" style="width: 100%;" readonly/> |
|
69 | + <input onClick="this.select()" type="text" id="wpinv_item_shortcode" value="[getpaid item=<?php echo esc_attr($item->get_id()); ?>]" style="width: 100%;" readonly/> |
|
70 | 70 | </div> |
71 | 71 | </div> |
72 | 72 | |
73 | 73 | <div class="wpinv_item_buy_shortcode form-group row"> |
74 | 74 | <label for="wpinv_item_button_shortcode" class="col-sm-12 col-form-label"> |
75 | - <?php _e( 'Payment Button Shortcode', 'invoicing' );?> |
|
76 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a buy now button', 'invoicing' ); ?>"></span> |
|
75 | + <?php _e('Payment Button Shortcode', 'invoicing'); ?> |
|
76 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a buy now button', 'invoicing'); ?>"></span> |
|
77 | 77 | </label> |
78 | 78 | |
79 | 79 | <div class="col-sm-12"> |
80 | - <input onClick="this.select()" type="text" id="wpinv_item_button_shortcode" value="[getpaid item=<?php echo esc_attr( $item->get_id() ); ?> button='Buy Now']" style="width: 100%;" readonly/> |
|
80 | + <input onClick="this.select()" type="text" id="wpinv_item_button_shortcode" value="[getpaid item=<?php echo esc_attr($item->get_id()); ?> button='Buy Now']" style="width: 100%;" readonly/> |
|
81 | 81 | <small class="form-text text-muted"> |
82 | - <?php _e( 'Or use the following URL in a link:', 'invoicing' );?> |
|
83 | - <code>#getpaid-item-<?php echo intval( $item->get_id() ); ?>|0</code> |
|
82 | + <?php _e('Or use the following URL in a link:', 'invoicing'); ?> |
|
83 | + <code>#getpaid-item-<?php echo intval($item->get_id()); ?>|0</code> |
|
84 | 84 | </small> |
85 | 85 | </div> |
86 | 86 | </div> |
87 | 87 | |
88 | 88 | <div class="wpinv_item_buy_url form-group row"> |
89 | 89 | <label for="wpinv_item_buy_url" class="col-sm-12 col-form-label"> |
90 | - <?php _e( 'Direct Payment URL', 'invoicing' );?> |
|
91 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'You can use this in an iFrame to embed the payment form on another website', 'invoicing' ); ?>"></span> |
|
90 | + <?php _e('Direct Payment URL', 'invoicing'); ?> |
|
91 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('You can use this in an iFrame to embed the payment form on another website', 'invoicing'); ?>"></span> |
|
92 | 92 | </label> |
93 | 93 | |
94 | 94 | <div class="col-sm-12"> |
95 | - <input onClick="this.select()" type="text" id="wpinv_item_buy_url" value="<?php echo esc_url( getpaid_embed_url( false, $item->get_id() . '|0' ) ); ?>" style="width: 100%;" readonly/> |
|
95 | + <input onClick="this.select()" type="text" id="wpinv_item_buy_url" value="<?php echo esc_url(getpaid_embed_url(false, $item->get_id() . '|0')); ?>" style="width: 100%;" readonly/> |
|
96 | 96 | </div> |
97 | 97 | </div> |
98 | 98 | |
99 | 99 | <?php endif; ?> |
100 | 100 | |
101 | 101 | <div class="wpinv_item_custom_id form-group"> |
102 | - <?php _e( 'Custom ID', 'invoicing' );?> — <?php echo esc_html( $item->get_custom_id() ) ?> |
|
102 | + <?php _e('Custom ID', 'invoicing'); ?> — <?php echo esc_html($item->get_custom_id()) ?> |
|
103 | 103 | </div> |
104 | 104 | |
105 | - <?php do_action( 'wpinv_meta_values_metabox_before', $post ); ?> |
|
106 | - <?php foreach ( apply_filters( 'wpinv_show_meta_values_for_keys', array() ) as $meta_key ) : ?> |
|
105 | + <?php do_action('wpinv_meta_values_metabox_before', $post); ?> |
|
106 | + <?php foreach (apply_filters('wpinv_show_meta_values_for_keys', array()) as $meta_key) : ?> |
|
107 | 107 | <div class="wpinv_item_custom_id form-group"> |
108 | - <?php echo esc_html( $meta_key );?> — <?php echo esc_html( get_post_meta( $item->get_id(), '_wpinv_' . $meta_key, true ) ); ?> |
|
108 | + <?php echo esc_html($meta_key); ?> — <?php echo esc_html(get_post_meta($item->get_id(), '_wpinv_' . $meta_key, true)); ?> |
|
109 | 109 | </div> |
110 | 110 | <?php endforeach; ?> |
111 | - <?php do_action( 'wpinv_meta_values_metabox_after', $post ); ?> |
|
112 | - <?php do_action( 'wpinv_item_info_metabox', $item ); ?> |
|
111 | + <?php do_action('wpinv_meta_values_metabox_after', $post); ?> |
|
112 | + <?php do_action('wpinv_item_info_metabox', $item); ?> |
|
113 | 113 | </div> |
114 | 114 | <?php |
115 | 115 | |
@@ -119,16 +119,16 @@ discard block |
||
119 | 119 | * Returns item type tolltip. |
120 | 120 | * |
121 | 121 | */ |
122 | - public static function get_tooltip( $post ) { |
|
122 | + public static function get_tooltip($post) { |
|
123 | 123 | |
124 | 124 | ob_start(); |
125 | 125 | ?> |
126 | 126 | |
127 | - <?php _e( 'Standard: Standard item type', 'invoicing' );?> |
|
128 | - <?php _e( 'Fee: Like Registration Fee, Sign up Fee etc', 'invoicing' );?> |
|
127 | + <?php _e('Standard: Standard item type', 'invoicing'); ?> |
|
128 | + <?php _e('Fee: Like Registration Fee, Sign up Fee etc', 'invoicing'); ?> |
|
129 | 129 | |
130 | 130 | <?php |
131 | - do_action( 'wpinv_item_info_metabox_after', $post ); |
|
131 | + do_action('wpinv_item_info_metabox_after', $post); |
|
132 | 132 | |
133 | 133 | return ob_get_clean(); |
134 | 134 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Post types Admin Class |
@@ -21,74 +21,74 @@ discard block |
||
21 | 21 | GetPaid_Metaboxes::init(); |
22 | 22 | |
23 | 23 | // Filter the post updated messages. |
24 | - add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' ); |
|
24 | + add_filter('post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages'); |
|
25 | 25 | |
26 | 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 ); |
|
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 | 29 | |
30 | 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 | - add_filter( 'bulk_actions-edit-wpi_invoice', array( __CLASS__, 'invoice_bulk_actions' ) ); |
|
34 | - add_filter( 'handle_bulk_actions-edit-wpi_invoice', array( __CLASS__, 'handle_invoice_bulk_actions' ), 10, 3 ); |
|
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 | + add_filter('bulk_actions-edit-wpi_invoice', array(__CLASS__, 'invoice_bulk_actions')); |
|
34 | + add_filter('handle_bulk_actions-edit-wpi_invoice', array(__CLASS__, 'handle_invoice_bulk_actions'), 10, 3); |
|
35 | 35 | |
36 | 36 | // Items table columns. |
37 | - add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 ); |
|
38 | - add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 ); |
|
39 | - add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 ); |
|
40 | - add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 ); |
|
41 | - add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 ); |
|
42 | - add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 ); |
|
37 | + add_filter('manage_wpi_item_posts_columns', array(__CLASS__, 'item_columns'), 100); |
|
38 | + add_filter('manage_edit-wpi_item_sortable_columns', array(__CLASS__, 'sortable_item_columns'), 20); |
|
39 | + add_action('manage_wpi_item_posts_custom_column', array(__CLASS__, 'display_item_columns'), 10, 2); |
|
40 | + add_action('restrict_manage_posts', array(__CLASS__, 'add_item_filters'), 100); |
|
41 | + add_action('parse_query', array(__CLASS__, 'filter_item_query'), 100); |
|
42 | + add_action('request', array(__CLASS__, 'reorder_items'), 100); |
|
43 | 43 | |
44 | 44 | // Payment forms columns. |
45 | - add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 ); |
|
46 | - add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 ); |
|
47 | - add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 ); |
|
45 | + add_filter('manage_wpi_payment_form_posts_columns', array(__CLASS__, 'payment_form_columns'), 100); |
|
46 | + add_action('manage_wpi_payment_form_posts_custom_column', array(__CLASS__, 'display_payment_form_columns'), 10, 2); |
|
47 | + add_filter('display_post_states', array(__CLASS__, 'filter_payment_form_state'), 10, 2); |
|
48 | 48 | |
49 | 49 | // Discount table columns. |
50 | - add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 ); |
|
51 | - add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 ); |
|
50 | + add_filter('manage_wpi_discount_posts_columns', array(__CLASS__, 'discount_columns'), 100); |
|
51 | + add_filter('bulk_actions-edit-wpi_discount', '__return_empty_array', 100); |
|
52 | 52 | |
53 | 53 | // Deleting posts. |
54 | - add_action( 'delete_post', array( __CLASS__, 'delete_post' ) ); |
|
55 | - add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 ); |
|
54 | + add_action('delete_post', array(__CLASS__, 'delete_post')); |
|
55 | + add_filter('display_post_states', array(__CLASS__, 'filter_discount_state'), 10, 2); |
|
56 | 56 | |
57 | - add_filter( 'display_post_states', array( __CLASS__, 'add_display_post_states' ), 10, 2 ); |
|
57 | + add_filter('display_post_states', array(__CLASS__, 'add_display_post_states'), 10, 2); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Post updated messages. |
62 | 62 | */ |
63 | - public static function post_updated_messages( $messages ) { |
|
63 | + public static function post_updated_messages($messages) { |
|
64 | 64 | global $post; |
65 | 65 | |
66 | 66 | $messages['wpi_discount'] = array( |
67 | 67 | 0 => '', |
68 | - 1 => __( 'Discount updated.', 'invoicing' ), |
|
69 | - 2 => __( 'Custom field updated.', 'invoicing' ), |
|
70 | - 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
71 | - 4 => __( 'Discount updated.', 'invoicing' ), |
|
72 | - 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
73 | - 6 => __( 'Discount updated.', 'invoicing' ), |
|
74 | - 7 => __( 'Discount saved.', 'invoicing' ), |
|
75 | - 8 => __( 'Discount submitted.', 'invoicing' ), |
|
76 | - 9 => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
77 | - 10 => __( 'Discount draft updated.', 'invoicing' ), |
|
68 | + 1 => __('Discount updated.', 'invoicing'), |
|
69 | + 2 => __('Custom field updated.', 'invoicing'), |
|
70 | + 3 => __('Custom field deleted.', 'invoicing'), |
|
71 | + 4 => __('Discount updated.', 'invoicing'), |
|
72 | + 5 => isset($_GET['revision']) ? wp_sprintf(__('Discount restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
73 | + 6 => __('Discount updated.', 'invoicing'), |
|
74 | + 7 => __('Discount saved.', 'invoicing'), |
|
75 | + 8 => __('Discount submitted.', 'invoicing'), |
|
76 | + 9 => wp_sprintf(__('Discount scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))), |
|
77 | + 10 => __('Discount draft updated.', 'invoicing'), |
|
78 | 78 | ); |
79 | 79 | |
80 | 80 | $messages['wpi_payment_form'] = array( |
81 | 81 | 0 => '', |
82 | - 1 => __( 'Payment Form updated.', 'invoicing' ), |
|
83 | - 2 => __( 'Custom field updated.', 'invoicing' ), |
|
84 | - 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
85 | - 4 => __( 'Payment Form updated.', 'invoicing' ), |
|
86 | - 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
87 | - 6 => __( 'Payment Form updated.', 'invoicing' ), |
|
88 | - 7 => __( 'Payment Form saved.', 'invoicing' ), |
|
89 | - 8 => __( 'Payment Form submitted.', 'invoicing' ), |
|
90 | - 9 => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
91 | - 10 => __( 'Payment Form draft updated.', 'invoicing' ), |
|
82 | + 1 => __('Payment Form updated.', 'invoicing'), |
|
83 | + 2 => __('Custom field updated.', 'invoicing'), |
|
84 | + 3 => __('Custom field deleted.', 'invoicing'), |
|
85 | + 4 => __('Payment Form updated.', 'invoicing'), |
|
86 | + 5 => isset($_GET['revision']) ? wp_sprintf(__('Payment Form restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
87 | + 6 => __('Payment Form updated.', 'invoicing'), |
|
88 | + 7 => __('Payment Form saved.', 'invoicing'), |
|
89 | + 8 => __('Payment Form submitted.', 'invoicing'), |
|
90 | + 9 => wp_sprintf(__('Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))), |
|
91 | + 10 => __('Payment Form draft updated.', 'invoicing'), |
|
92 | 92 | ); |
93 | 93 | |
94 | 94 | return $messages; |
@@ -98,19 +98,19 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * Post row actions. |
100 | 100 | */ |
101 | - public static function post_row_actions( $actions, $post ) { |
|
101 | + public static function post_row_actions($actions, $post) { |
|
102 | 102 | |
103 | - $post = get_post( $post ); |
|
103 | + $post = get_post($post); |
|
104 | 104 | |
105 | 105 | // We do not want to edit the default payment form. |
106 | - if ( 'wpi_payment_form' == $post->post_type ) { |
|
106 | + if ('wpi_payment_form' == $post->post_type) { |
|
107 | 107 | |
108 | - if ( $post->ID == wpinv_get_default_payment_form() ) { |
|
109 | - unset( $actions['trash'] ); |
|
110 | - unset( $actions['inline hide-if-no-js'] ); |
|
108 | + if ($post->ID == wpinv_get_default_payment_form()) { |
|
109 | + unset($actions['trash']); |
|
110 | + unset($actions['inline hide-if-no-js']); |
|
111 | 111 | } |
112 | 112 | |
113 | - $actions['duplicate'] = sprintf( |
|
113 | + $actions['duplicate'] = sprintf( |
|
114 | 114 | '<a href="%1$s">%2$s</a>', |
115 | 115 | esc_url( |
116 | 116 | wp_nonce_url( |
@@ -124,20 +124,20 @@ discard block |
||
124 | 124 | 'getpaid-nonce' |
125 | 125 | ) |
126 | 126 | ), |
127 | - esc_html( __( 'Duplicate', 'invoicing' ) ) |
|
127 | + esc_html(__('Duplicate', 'invoicing')) |
|
128 | 128 | ); |
129 | 129 | |
130 | 130 | } |
131 | 131 | |
132 | 132 | // Link to item payment form. |
133 | - if ( 'wpi_item' == $post->post_type ) { |
|
133 | + if ('wpi_item' == $post->post_type) { |
|
134 | 134 | |
135 | - if ( in_array( get_post_meta( $post->ID, '_wpinv_type', true ), array( '', 'fee', 'custom' ) ) ) { |
|
135 | + if (in_array(get_post_meta($post->ID, '_wpinv_type', true), array('', 'fee', 'custom'))) { |
|
136 | 136 | |
137 | - $actions['buy'] = sprintf( |
|
137 | + $actions['buy'] = sprintf( |
|
138 | 138 | '<a href="%1$s">%2$s</a>', |
139 | - esc_url( getpaid_embed_url( false, $post->ID . '|0' ) ), |
|
140 | - esc_html( __( 'Buy', 'invoicing' ) ) |
|
139 | + esc_url(getpaid_embed_url(false, $post->ID . '|0')), |
|
140 | + esc_html(__('Buy', 'invoicing')) |
|
141 | 141 | ); |
142 | 142 | |
143 | 143 | } |
@@ -155,31 +155,31 @@ discard block |
||
155 | 155 | * @param WP_Post $post |
156 | 156 | * @return array $actions actions without edit option |
157 | 157 | */ |
158 | - public static function filter_invoice_row_actions( $actions, $post ) { |
|
158 | + public static function filter_invoice_row_actions($actions, $post) { |
|
159 | 159 | |
160 | - if ( getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
160 | + if (getpaid_is_invoice_post_type($post->post_type)) { |
|
161 | 161 | |
162 | 162 | $actions = array(); |
163 | - $invoice = new WPInv_Invoice( $post ); |
|
163 | + $invoice = new WPInv_Invoice($post); |
|
164 | 164 | |
165 | - $actions['edit'] = sprintf( |
|
165 | + $actions['edit'] = sprintf( |
|
166 | 166 | '<a href="%1$s">%2$s</a>', |
167 | - esc_url( get_edit_post_link( $invoice->get_id() ) ), |
|
168 | - esc_html( __( 'Edit', 'invoicing' ) ) |
|
167 | + esc_url(get_edit_post_link($invoice->get_id())), |
|
168 | + esc_html(__('Edit', 'invoicing')) |
|
169 | 169 | ); |
170 | 170 | |
171 | - if ( ! $invoice->is_draft() ) { |
|
171 | + if (!$invoice->is_draft()) { |
|
172 | 172 | |
173 | - $actions['view'] = sprintf( |
|
173 | + $actions['view'] = sprintf( |
|
174 | 174 | '<a href="%1$s">%2$s</a>', |
175 | - esc_url( $invoice->get_view_url() ), |
|
175 | + esc_url($invoice->get_view_url()), |
|
176 | 176 | sprintf( |
177 | - esc_html( __( 'View %s', 'invoicing' ) ), |
|
178 | - getpaid_get_post_type_label( $invoice->get_post_type(), false ) |
|
177 | + esc_html(__('View %s', 'invoicing')), |
|
178 | + getpaid_get_post_type_label($invoice->get_post_type(), false) |
|
179 | 179 | ) |
180 | 180 | ); |
181 | 181 | |
182 | - $actions['send'] = sprintf( |
|
182 | + $actions['send'] = sprintf( |
|
183 | 183 | '<a href="%1$s">%2$s</a>', |
184 | 184 | esc_url( |
185 | 185 | wp_nonce_url( |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | 'getpaid-nonce' |
194 | 194 | ) |
195 | 195 | ), |
196 | - esc_html( __( 'Send to Customer', 'invoicing' ) ) |
|
196 | + esc_html(__('Send to Customer', 'invoicing')) |
|
197 | 197 | ); |
198 | 198 | |
199 | 199 | } |
200 | 200 | |
201 | - $actions['duplicate'] = sprintf( |
|
201 | + $actions['duplicate'] = sprintf( |
|
202 | 202 | '<a href="%1$s">%2$s</a>', |
203 | 203 | esc_url( |
204 | 204 | wp_nonce_url( |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | 'getpaid-nonce' |
213 | 213 | ) |
214 | 214 | ), |
215 | - esc_html( __( 'Duplicate', 'invoicing' ) ) |
|
215 | + esc_html(__('Duplicate', 'invoicing')) |
|
216 | 216 | ); |
217 | 217 | |
218 | 218 | } |
@@ -223,42 +223,42 @@ discard block |
||
223 | 223 | /** |
224 | 224 | * Returns an array of invoice table columns. |
225 | 225 | */ |
226 | - public static function invoice_columns( $columns ) { |
|
226 | + public static function invoice_columns($columns) { |
|
227 | 227 | |
228 | 228 | $columns = array( |
229 | 229 | 'cb' => $columns['cb'], |
230 | - 'number' => __( 'Invoice', 'invoicing' ), |
|
231 | - 'customer' => __( 'Customer', 'invoicing' ), |
|
232 | - 'invoice_date' => __( 'Created', 'invoicing' ), |
|
233 | - 'payment_date' => __( 'Completed', 'invoicing' ), |
|
234 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
235 | - 'recurring' => __( 'Recurring', 'invoicing' ), |
|
236 | - 'status' => __( 'Status', 'invoicing' ), |
|
230 | + 'number' => __('Invoice', 'invoicing'), |
|
231 | + 'customer' => __('Customer', 'invoicing'), |
|
232 | + 'invoice_date' => __('Created', 'invoicing'), |
|
233 | + 'payment_date' => __('Completed', 'invoicing'), |
|
234 | + 'amount' => __('Amount', 'invoicing'), |
|
235 | + 'recurring' => __('Recurring', 'invoicing'), |
|
236 | + 'status' => __('Status', 'invoicing'), |
|
237 | 237 | ); |
238 | 238 | |
239 | - return apply_filters( 'wpi_invoice_table_columns', $columns ); |
|
239 | + return apply_filters('wpi_invoice_table_columns', $columns); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
243 | 243 | * Displays invoice table columns. |
244 | 244 | */ |
245 | - public static function display_invoice_columns( $column_name, $post_id ) { |
|
245 | + public static function display_invoice_columns($column_name, $post_id) { |
|
246 | 246 | |
247 | - $invoice = new WPInv_Invoice( $post_id ); |
|
247 | + $invoice = new WPInv_Invoice($post_id); |
|
248 | 248 | |
249 | - switch ( $column_name ) { |
|
249 | + switch ($column_name) { |
|
250 | 250 | |
251 | 251 | case 'invoice_date' : |
252 | - $date_time = esc_attr( $invoice->get_created_date() ); |
|
253 | - $date = getpaid_format_date_value( $date_time, "—", true ); |
|
252 | + $date_time = esc_attr($invoice->get_created_date()); |
|
253 | + $date = getpaid_format_date_value($date_time, "—", true); |
|
254 | 254 | echo "<span title='$date_time'>$date</span>"; |
255 | 255 | break; |
256 | 256 | |
257 | 257 | case 'payment_date' : |
258 | 258 | |
259 | - if ( $invoice->is_paid() ) { |
|
260 | - $date_time = esc_attr( $invoice->get_completed_date() ); |
|
261 | - $date = getpaid_format_date_value( $date_time, "—", true ); |
|
259 | + if ($invoice->is_paid()) { |
|
260 | + $date_time = esc_attr($invoice->get_completed_date()); |
|
261 | + $date = getpaid_format_date_value($date_time, "—", true); |
|
262 | 262 | echo "<span title='$date_time'>$date</span>"; |
263 | 263 | } else { |
264 | 264 | echo "—"; |
@@ -269,17 +269,17 @@ discard block |
||
269 | 269 | case 'amount' : |
270 | 270 | |
271 | 271 | $amount = $invoice->get_total(); |
272 | - $formated_amount = wpinv_price( $amount, $invoice->get_currency() ); |
|
272 | + $formated_amount = wpinv_price($amount, $invoice->get_currency()); |
|
273 | 273 | |
274 | - if ( $invoice->is_refunded() ) { |
|
275 | - $refunded_amount = wpinv_price( 0, $invoice->get_currency() ); |
|
274 | + if ($invoice->is_refunded()) { |
|
275 | + $refunded_amount = wpinv_price(0, $invoice->get_currency()); |
|
276 | 276 | echo "<del>$formated_amount</del> <ins>$refunded_amount</ins>"; |
277 | 277 | } else { |
278 | 278 | |
279 | 279 | $discount = $invoice->get_total_discount(); |
280 | 280 | |
281 | - if ( ! empty( $discount ) ) { |
|
282 | - $new_amount = wpinv_price( $amount + $discount, $invoice->get_currency() ); |
|
281 | + if (!empty($discount)) { |
|
282 | + $new_amount = wpinv_price($amount + $discount, $invoice->get_currency()); |
|
283 | 283 | echo "<del>$new_amount</del> <ins>$formated_amount</ins>"; |
284 | 284 | } else { |
285 | 285 | echo $formated_amount; |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | break; |
291 | 291 | |
292 | 292 | case 'status' : |
293 | - $status = esc_html( $invoice->get_status() ); |
|
294 | - $status_label = esc_html( $invoice->get_status_nicename() ); |
|
293 | + $status = esc_html($invoice->get_status()); |
|
294 | + $status_label = esc_html($invoice->get_status_nicename()); |
|
295 | 295 | |
296 | 296 | // If it is paid, show the gateway title. |
297 | - if ( $invoice->is_paid() ) { |
|
298 | - $gateway = esc_html( $invoice->get_gateway_title() ); |
|
299 | - $gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), $gateway ); |
|
297 | + if ($invoice->is_paid()) { |
|
298 | + $gateway = esc_html($invoice->get_gateway_title()); |
|
299 | + $gateway = wp_sprintf(esc_attr__('Paid via %s', 'invoicing'), $gateway); |
|
300 | 300 | |
301 | 301 | echo "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>"; |
302 | 302 | } else { |
@@ -304,22 +304,22 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | // If it is not paid, display the overdue and view status. |
307 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
307 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
308 | 308 | |
309 | 309 | // Invoice view status. |
310 | - if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) { |
|
311 | - echo ' <i class="fa fa-eye wpi-help-tip" title="'. esc_attr__( 'Viewed by Customer', 'invoicing' ).'"></i>'; |
|
310 | + if (wpinv_is_invoice_viewed($invoice->get_id())) { |
|
311 | + echo ' <i class="fa fa-eye wpi-help-tip" title="' . esc_attr__('Viewed by Customer', 'invoicing') . '"></i>'; |
|
312 | 312 | } else { |
313 | - echo ' <i class="fa fa-eye-slash wpi-help-tip" title="'. esc_attr__( 'Not Viewed by Customer', 'invoicing' ).'"></i>'; |
|
313 | + echo ' <i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__('Not Viewed by Customer', 'invoicing') . '"></i>'; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | // Display the overview status. |
317 | - if ( wpinv_get_option( 'overdue_active' ) ) { |
|
317 | + if (wpinv_get_option('overdue_active')) { |
|
318 | 318 | $due_date = $invoice->get_due_date(); |
319 | - $fomatted = getpaid_format_date( $due_date ); |
|
319 | + $fomatted = getpaid_format_date($due_date); |
|
320 | 320 | |
321 | - if ( ! empty( $fomatted ) ) { |
|
322 | - $date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted ); |
|
321 | + if (!empty($fomatted)) { |
|
322 | + $date = wp_sprintf(__('Due %s', 'invoicing'), $fomatted); |
|
323 | 323 | echo "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>"; |
324 | 324 | } |
325 | 325 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | case 'recurring': |
332 | 332 | |
333 | - if ( $invoice->is_recurring() ) { |
|
333 | + if ($invoice->is_recurring()) { |
|
334 | 334 | echo '<i class="fa fa-check" style="color:#43850a;"></i>'; |
335 | 335 | } else { |
336 | 336 | echo '<i class="fa fa-times" style="color:#616161;"></i>'; |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | |
340 | 340 | case 'number' : |
341 | 341 | |
342 | - $edit_link = esc_url( get_edit_post_link( $invoice->get_id() ) ); |
|
343 | - $invoice_number = esc_html( $invoice->get_number() ); |
|
344 | - $invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' ); |
|
342 | + $edit_link = esc_url(get_edit_post_link($invoice->get_id())); |
|
343 | + $invoice_number = esc_html($invoice->get_number()); |
|
344 | + $invoice_details = esc_attr__('View Invoice Details', 'invoicing'); |
|
345 | 345 | |
346 | 346 | echo "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>"; |
347 | 347 | |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | |
352 | 352 | $customer_name = $invoice->get_user_full_name(); |
353 | 353 | |
354 | - if ( empty( $customer_name ) ) { |
|
354 | + if (empty($customer_name)) { |
|
355 | 355 | $customer_name = $invoice->get_email(); |
356 | 356 | } |
357 | 357 | |
358 | - if ( ! empty( $customer_name ) ) { |
|
359 | - $customer_details = esc_attr__( 'View Customer Details', 'invoicing' ); |
|
360 | - $view_link = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) ); |
|
358 | + if (!empty($customer_name)) { |
|
359 | + $customer_details = esc_attr__('View Customer Details', 'invoicing'); |
|
360 | + $view_link = esc_url(add_query_arg('user_id', $invoice->get_user_id(), admin_url('user-edit.php'))); |
|
361 | 361 | echo "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>"; |
362 | 362 | } else { |
363 | 363 | echo '<div>—</div>'; |
@@ -372,27 +372,27 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * Displays invoice bulk actions. |
374 | 374 | */ |
375 | - public static function invoice_bulk_actions( $actions ) { |
|
376 | - $actions['resend-invoice'] = __( 'Send to Customer', 'invoicing' ); |
|
375 | + public static function invoice_bulk_actions($actions) { |
|
376 | + $actions['resend-invoice'] = __('Send to Customer', 'invoicing'); |
|
377 | 377 | return $actions; |
378 | 378 | } |
379 | 379 | |
380 | 380 | /** |
381 | 381 | * Processes invoice bulk actions. |
382 | 382 | */ |
383 | - public static function handle_invoice_bulk_actions( $redirect_url, $action, $post_ids ) { |
|
383 | + public static function handle_invoice_bulk_actions($redirect_url, $action, $post_ids) { |
|
384 | 384 | |
385 | - if ( $action == 'resend-invoice' ) { |
|
385 | + if ($action == 'resend-invoice') { |
|
386 | 386 | |
387 | 387 | $success = false; |
388 | - foreach ( $post_ids as $post_id ) { |
|
389 | - $success = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $post_id ), true ); |
|
388 | + foreach ($post_ids as $post_id) { |
|
389 | + $success = getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($post_id), true); |
|
390 | 390 | } |
391 | 391 | |
392 | - if ( $success ) { |
|
393 | - getpaid_admin()->show_success( __( 'Invoices were successfully sent', 'invoicing' ) ); |
|
392 | + if ($success) { |
|
393 | + getpaid_admin()->show_success(__('Invoices were successfully sent', 'invoicing')); |
|
394 | 394 | } else { |
395 | - getpaid_admin()->show_error( __( 'Could not send some invoices', 'invoicing' ) ); |
|
395 | + getpaid_admin()->show_error(__('Could not send some invoices', 'invoicing')); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | } |
@@ -404,50 +404,50 @@ discard block |
||
404 | 404 | /** |
405 | 405 | * Returns an array of payment forms table columns. |
406 | 406 | */ |
407 | - public static function payment_form_columns( $columns ) { |
|
407 | + public static function payment_form_columns($columns) { |
|
408 | 408 | |
409 | 409 | $columns = array( |
410 | 410 | 'cb' => $columns['cb'], |
411 | - 'title' => __( 'Name', 'invoicing' ), |
|
412 | - 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
413 | - 'earnings' => __( 'Revenue', 'invoicing' ), |
|
414 | - 'refunds' => __( 'Refunded', 'invoicing' ), |
|
415 | - 'items' => __( 'Items', 'invoicing' ), |
|
416 | - 'date' => __( 'Date', 'invoicing' ), |
|
411 | + 'title' => __('Name', 'invoicing'), |
|
412 | + 'shortcode' => __('Shortcode', 'invoicing'), |
|
413 | + 'earnings' => __('Revenue', 'invoicing'), |
|
414 | + 'refunds' => __('Refunded', 'invoicing'), |
|
415 | + 'items' => __('Items', 'invoicing'), |
|
416 | + 'date' => __('Date', 'invoicing'), |
|
417 | 417 | ); |
418 | 418 | |
419 | - return apply_filters( 'wpi_payment_form_table_columns', $columns ); |
|
419 | + return apply_filters('wpi_payment_form_table_columns', $columns); |
|
420 | 420 | |
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
424 | 424 | * Displays payment form table columns. |
425 | 425 | */ |
426 | - public static function display_payment_form_columns( $column_name, $post_id ) { |
|
426 | + public static function display_payment_form_columns($column_name, $post_id) { |
|
427 | 427 | |
428 | 428 | // Retrieve the payment form. |
429 | - $form = new GetPaid_Payment_Form( $post_id ); |
|
429 | + $form = new GetPaid_Payment_Form($post_id); |
|
430 | 430 | |
431 | - switch ( $column_name ) { |
|
431 | + switch ($column_name) { |
|
432 | 432 | |
433 | 433 | case 'earnings' : |
434 | - echo wpinv_price( $form->get_earned() ); |
|
434 | + echo wpinv_price($form->get_earned()); |
|
435 | 435 | break; |
436 | 436 | |
437 | 437 | case 'refunds' : |
438 | - echo wpinv_price( $form->get_refunded() ); |
|
438 | + echo wpinv_price($form->get_refunded()); |
|
439 | 439 | break; |
440 | 440 | |
441 | 441 | case 'refunds' : |
442 | - echo wpinv_price( $form->get_refunded() ); |
|
442 | + echo wpinv_price($form->get_refunded()); |
|
443 | 443 | break; |
444 | 444 | |
445 | 445 | case 'shortcode' : |
446 | 446 | |
447 | - if ( $form->is_default() ) { |
|
447 | + if ($form->is_default()) { |
|
448 | 448 | echo '—'; |
449 | 449 | } else { |
450 | - echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>'; |
|
450 | + echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr($form->get_id()) . ']" style="width: 100%;" readonly/>'; |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | break; |
@@ -456,29 +456,29 @@ discard block |
||
456 | 456 | |
457 | 457 | $items = $form->get_items(); |
458 | 458 | |
459 | - if ( $form->is_default() || empty( $items ) ) { |
|
459 | + if ($form->is_default() || empty($items)) { |
|
460 | 460 | echo '—'; |
461 | 461 | return; |
462 | 462 | } |
463 | 463 | |
464 | 464 | $_items = array(); |
465 | 465 | |
466 | - foreach ( $items as $item ) { |
|
466 | + foreach ($items as $item) { |
|
467 | 467 | $url = $item->get_edit_url(); |
468 | 468 | |
469 | - if ( empty( $url ) ) { |
|
470 | - $_items[] = esc_html( $item->get_name() ); |
|
469 | + if (empty($url)) { |
|
470 | + $_items[] = esc_html($item->get_name()); |
|
471 | 471 | } else { |
472 | 472 | $_items[] = sprintf( |
473 | 473 | '<a href="%s">%s</a>', |
474 | - esc_url( $url ), |
|
475 | - esc_html( $item->get_name() ) |
|
474 | + esc_url($url), |
|
475 | + esc_html($item->get_name()) |
|
476 | 476 | ); |
477 | 477 | } |
478 | 478 | |
479 | 479 | } |
480 | 480 | |
481 | - echo implode( '<br>', $_items ); |
|
481 | + echo implode('<br>', $_items); |
|
482 | 482 | |
483 | 483 | break; |
484 | 484 | |
@@ -489,10 +489,10 @@ discard block |
||
489 | 489 | /** |
490 | 490 | * Filters post states. |
491 | 491 | */ |
492 | - public static function filter_payment_form_state( $post_states, $post ) { |
|
492 | + public static function filter_payment_form_state($post_states, $post) { |
|
493 | 493 | |
494 | - if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) { |
|
495 | - $post_states[ 'default_form' ] = __( 'Default Payment Form', 'invoicing' ); |
|
494 | + if ('wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID) { |
|
495 | + $post_states['default_form'] = __('Default Payment Form', 'invoicing'); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | return $post_states; |
@@ -502,35 +502,35 @@ discard block |
||
502 | 502 | /** |
503 | 503 | * Returns an array of coupon table columns. |
504 | 504 | */ |
505 | - public static function discount_columns( $columns ) { |
|
505 | + public static function discount_columns($columns) { |
|
506 | 506 | |
507 | 507 | $columns = array( |
508 | 508 | 'cb' => $columns['cb'], |
509 | - 'title' => __( 'Name', 'invoicing' ), |
|
510 | - 'code' => __( 'Code', 'invoicing' ), |
|
511 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
512 | - 'usage' => __( 'Usage / Limit', 'invoicing' ), |
|
513 | - 'start_date' => __( 'Start Date', 'invoicing' ), |
|
514 | - 'expiry_date' => __( 'Expiry Date', 'invoicing' ), |
|
509 | + 'title' => __('Name', 'invoicing'), |
|
510 | + 'code' => __('Code', 'invoicing'), |
|
511 | + 'amount' => __('Amount', 'invoicing'), |
|
512 | + 'usage' => __('Usage / Limit', 'invoicing'), |
|
513 | + 'start_date' => __('Start Date', 'invoicing'), |
|
514 | + 'expiry_date' => __('Expiry Date', 'invoicing'), |
|
515 | 515 | ); |
516 | 516 | |
517 | - return apply_filters( 'wpi_discount_table_columns', $columns ); |
|
517 | + return apply_filters('wpi_discount_table_columns', $columns); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | /** |
521 | 521 | * Filters post states. |
522 | 522 | */ |
523 | - public static function filter_discount_state( $post_states, $post ) { |
|
523 | + public static function filter_discount_state($post_states, $post) { |
|
524 | 524 | |
525 | - if ( 'wpi_discount' == $post->post_type ) { |
|
525 | + if ('wpi_discount' == $post->post_type) { |
|
526 | 526 | |
527 | - $discount = new WPInv_Discount( $post ); |
|
527 | + $discount = new WPInv_Discount($post); |
|
528 | 528 | |
529 | 529 | $status = $discount->is_expired() ? 'expired' : $discount->get_status(); |
530 | 530 | |
531 | - if ( $status != 'publish' ) { |
|
531 | + if ($status != 'publish') { |
|
532 | 532 | return array( |
533 | - 'discount_status' => wpinv_discount_status( $status ), |
|
533 | + 'discount_status' => wpinv_discount_status($status), |
|
534 | 534 | ); |
535 | 535 | } |
536 | 536 | |
@@ -545,30 +545,30 @@ discard block |
||
545 | 545 | /** |
546 | 546 | * Returns an array of items table columns. |
547 | 547 | */ |
548 | - public static function item_columns( $columns ) { |
|
548 | + public static function item_columns($columns) { |
|
549 | 549 | |
550 | 550 | $columns = array( |
551 | 551 | 'cb' => $columns['cb'], |
552 | - 'title' => __( 'Name', 'invoicing' ), |
|
553 | - 'price' => __( 'Price', 'invoicing' ), |
|
554 | - 'vat_rule' => __( 'VAT rule', 'invoicing' ), |
|
555 | - 'vat_class' => __( 'VAT class', 'invoicing' ), |
|
556 | - 'type' => __( 'Type', 'invoicing' ), |
|
557 | - 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
552 | + 'title' => __('Name', 'invoicing'), |
|
553 | + 'price' => __('Price', 'invoicing'), |
|
554 | + 'vat_rule' => __('VAT rule', 'invoicing'), |
|
555 | + 'vat_class' => __('VAT class', 'invoicing'), |
|
556 | + 'type' => __('Type', 'invoicing'), |
|
557 | + 'shortcode' => __('Shortcode', 'invoicing'), |
|
558 | 558 | ); |
559 | 559 | |
560 | - if ( ! wpinv_use_taxes() ) { |
|
561 | - unset( $columns['vat_rule'] ); |
|
562 | - unset( $columns['vat_class'] ); |
|
560 | + if (!wpinv_use_taxes()) { |
|
561 | + unset($columns['vat_rule']); |
|
562 | + unset($columns['vat_class']); |
|
563 | 563 | } |
564 | 564 | |
565 | - return apply_filters( 'wpi_item_table_columns', $columns ); |
|
565 | + return apply_filters('wpi_item_table_columns', $columns); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
569 | 569 | * Returns an array of sortable items table columns. |
570 | 570 | */ |
571 | - public static function sortable_item_columns( $columns ) { |
|
571 | + public static function sortable_item_columns($columns) { |
|
572 | 572 | |
573 | 573 | return array_merge( |
574 | 574 | $columns, |
@@ -585,47 +585,47 @@ discard block |
||
585 | 585 | /** |
586 | 586 | * Displays items table columns. |
587 | 587 | */ |
588 | - public static function display_item_columns( $column_name, $post_id ) { |
|
588 | + public static function display_item_columns($column_name, $post_id) { |
|
589 | 589 | |
590 | - $item = new WPInv_Item( $post_id ); |
|
590 | + $item = new WPInv_Item($post_id); |
|
591 | 591 | |
592 | - switch ( $column_name ) { |
|
592 | + switch ($column_name) { |
|
593 | 593 | |
594 | 594 | case 'price' : |
595 | 595 | |
596 | - if ( ! $item->is_recurring() ) { |
|
596 | + if (!$item->is_recurring()) { |
|
597 | 597 | echo $item->get_the_price(); |
598 | 598 | break; |
599 | 599 | } |
600 | 600 | |
601 | 601 | $price = wp_sprintf( |
602 | - __( '%s / %s', 'invoicing' ), |
|
602 | + __('%s / %s', 'invoicing'), |
|
603 | 603 | $item->get_the_price(), |
604 | - getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' ) |
|
604 | + getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '') |
|
605 | 605 | ); |
606 | 606 | |
607 | - if ( $item->get_the_price() == $item->get_the_initial_price() ) { |
|
607 | + if ($item->get_the_price() == $item->get_the_initial_price()) { |
|
608 | 608 | echo $price; |
609 | 609 | break; |
610 | 610 | } |
611 | 611 | |
612 | 612 | echo $item->get_the_initial_price(); |
613 | 613 | |
614 | - echo '<span class="meta">' . wp_sprintf( __( 'then %s', 'invoicing' ), $price ) .'</span>'; |
|
614 | + echo '<span class="meta">' . wp_sprintf(__('then %s', 'invoicing'), $price) . '</span>'; |
|
615 | 615 | break; |
616 | 616 | |
617 | 617 | case 'vat_rule' : |
618 | - echo getpaid_get_tax_rule_label( $item->get_vat_rule() ); |
|
618 | + echo getpaid_get_tax_rule_label($item->get_vat_rule()); |
|
619 | 619 | break; |
620 | 620 | |
621 | 621 | case 'vat_class' : |
622 | - echo getpaid_get_tax_class_label( $item->get_vat_class() ); |
|
622 | + echo getpaid_get_tax_class_label($item->get_vat_class()); |
|
623 | 623 | break; |
624 | 624 | |
625 | 625 | case 'shortcode' : |
626 | 626 | |
627 | - if ( $item->is_type( array( '', 'fee', 'custom' ) ) ) { |
|
628 | - echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>'; |
|
627 | + if ($item->is_type(array('', 'fee', 'custom'))) { |
|
628 | + echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr($item->get_id()) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>'; |
|
629 | 629 | } else { |
630 | 630 | echo "—"; |
631 | 631 | } |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | break; |
634 | 634 | |
635 | 635 | case 'type' : |
636 | - echo wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>'; |
|
636 | + echo wpinv_item_type($item->get_id()) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>'; |
|
637 | 637 | break; |
638 | 638 | |
639 | 639 | } |
@@ -643,21 +643,21 @@ discard block |
||
643 | 643 | /** |
644 | 644 | * Lets users filter items using taxes. |
645 | 645 | */ |
646 | - public static function add_item_filters( $post_type ) { |
|
646 | + public static function add_item_filters($post_type) { |
|
647 | 647 | |
648 | 648 | // Abort if we're not dealing with items. |
649 | - if ( $post_type != 'wpi_item' ) { |
|
649 | + if ($post_type != 'wpi_item') { |
|
650 | 650 | return; |
651 | 651 | } |
652 | 652 | |
653 | 653 | // Filter by vat rules. |
654 | - if ( wpinv_use_taxes() ) { |
|
654 | + if (wpinv_use_taxes()) { |
|
655 | 655 | |
656 | 656 | // Sanitize selected vat rule. |
657 | 657 | $vat_rule = ''; |
658 | 658 | $vat_rules = getpaid_get_tax_rules(); |
659 | - if ( isset( $_GET['vat_rule'] ) ) { |
|
660 | - $vat_rule = $_GET['vat_rule']; |
|
659 | + if (isset($_GET['vat_rule'])) { |
|
660 | + $vat_rule = $_GET['vat_rule']; |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | // Filter by VAT rule. |
@@ -665,13 +665,13 @@ discard block |
||
665 | 665 | array( |
666 | 666 | 'options' => array_merge( |
667 | 667 | array( |
668 | - '' => __( 'All VAT rules', 'invoicing' ) |
|
668 | + '' => __('All VAT rules', 'invoicing') |
|
669 | 669 | ), |
670 | 670 | $vat_rules |
671 | 671 | ), |
672 | 672 | 'name' => 'vat_rule', |
673 | 673 | 'id' => 'vat_rule', |
674 | - 'selected' => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '', |
|
674 | + 'selected' => in_array($vat_rule, array_keys($vat_rules)) ? $vat_rule : '', |
|
675 | 675 | 'show_option_all' => false, |
676 | 676 | 'show_option_none' => false, |
677 | 677 | ) |
@@ -682,21 +682,21 @@ discard block |
||
682 | 682 | // Sanitize selected vat rule. |
683 | 683 | $vat_class = ''; |
684 | 684 | $vat_classes = getpaid_get_tax_classes(); |
685 | - if ( isset( $_GET['vat_class'] ) ) { |
|
686 | - $vat_class = $_GET['vat_class']; |
|
685 | + if (isset($_GET['vat_class'])) { |
|
686 | + $vat_class = $_GET['vat_class']; |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | echo wpinv_html_select( |
690 | 690 | array( |
691 | 691 | 'options' => array_merge( |
692 | 692 | array( |
693 | - '' => __( 'All VAT classes', 'invoicing' ) |
|
693 | + '' => __('All VAT classes', 'invoicing') |
|
694 | 694 | ), |
695 | 695 | $vat_classes |
696 | 696 | ), |
697 | 697 | 'name' => 'vat_class', |
698 | 698 | 'id' => 'vat_class', |
699 | - 'selected' => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '', |
|
699 | + 'selected' => in_array($vat_class, array_keys($vat_classes)) ? $vat_class : '', |
|
700 | 700 | 'show_option_all' => false, |
701 | 701 | 'show_option_none' => false, |
702 | 702 | ) |
@@ -705,22 +705,22 @@ discard block |
||
705 | 705 | } |
706 | 706 | |
707 | 707 | // Filter by item type. |
708 | - $type = ''; |
|
709 | - if ( isset( $_GET['type'] ) ) { |
|
710 | - $type = $_GET['type']; |
|
708 | + $type = ''; |
|
709 | + if (isset($_GET['type'])) { |
|
710 | + $type = $_GET['type']; |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | echo wpinv_html_select( |
714 | 714 | array( |
715 | 715 | 'options' => array_merge( |
716 | 716 | array( |
717 | - '' => __( 'All item types', 'invoicing' ) |
|
717 | + '' => __('All item types', 'invoicing') |
|
718 | 718 | ), |
719 | 719 | wpinv_get_item_types() |
720 | 720 | ), |
721 | 721 | 'name' => 'type', |
722 | 722 | 'id' => 'type', |
723 | - 'selected' => in_array( $type, wpinv_item_types() ) ? $type : '', |
|
723 | + 'selected' => in_array($type, wpinv_item_types()) ? $type : '', |
|
724 | 724 | 'show_option_all' => false, |
725 | 725 | 'show_option_none' => false, |
726 | 726 | ) |
@@ -731,45 +731,45 @@ discard block |
||
731 | 731 | /** |
732 | 732 | * Filters the item query. |
733 | 733 | */ |
734 | - public static function filter_item_query( $query ) { |
|
734 | + public static function filter_item_query($query) { |
|
735 | 735 | |
736 | 736 | // modify the query only if it admin and main query. |
737 | - if ( ! ( is_admin() && $query->is_main_query() ) ){ |
|
737 | + if (!(is_admin() && $query->is_main_query())) { |
|
738 | 738 | return $query; |
739 | 739 | } |
740 | 740 | |
741 | 741 | // we want to modify the query for our items. |
742 | - if ( empty( $query->query['post_type'] ) || 'wpi_item' != $query->query['post_type'] ){ |
|
742 | + if (empty($query->query['post_type']) || 'wpi_item' != $query->query['post_type']) { |
|
743 | 743 | return $query; |
744 | 744 | } |
745 | 745 | |
746 | - if ( empty( $query->query_vars['meta_query'] ) ) { |
|
746 | + if (empty($query->query_vars['meta_query'])) { |
|
747 | 747 | $query->query_vars['meta_query'] = array(); |
748 | 748 | } |
749 | 749 | |
750 | 750 | // Filter vat rule type |
751 | - if ( ! empty( $_GET['vat_rule'] ) ) { |
|
751 | + if (!empty($_GET['vat_rule'])) { |
|
752 | 752 | $query->query_vars['meta_query'][] = array( |
753 | 753 | 'key' => '_wpinv_vat_rule', |
754 | - 'value' => sanitize_text_field( $_GET['vat_rule'] ), |
|
754 | + 'value' => sanitize_text_field($_GET['vat_rule']), |
|
755 | 755 | 'compare' => '=' |
756 | 756 | ); |
757 | 757 | } |
758 | 758 | |
759 | 759 | // Filter vat class |
760 | - if ( ! empty( $_GET['vat_class'] ) ) { |
|
760 | + if (!empty($_GET['vat_class'])) { |
|
761 | 761 | $query->query_vars['meta_query'][] = array( |
762 | 762 | 'key' => '_wpinv_vat_class', |
763 | - 'value' => sanitize_text_field( $_GET['vat_class'] ), |
|
763 | + 'value' => sanitize_text_field($_GET['vat_class']), |
|
764 | 764 | 'compare' => '=' |
765 | 765 | ); |
766 | 766 | } |
767 | 767 | |
768 | 768 | // Filter item type |
769 | - if ( ! empty( $_GET['type'] ) ) { |
|
769 | + if (!empty($_GET['type'])) { |
|
770 | 770 | $query->query_vars['meta_query'][] = array( |
771 | 771 | 'key' => '_wpinv_type', |
772 | - 'value' => sanitize_text_field( $_GET['type'] ), |
|
772 | + 'value' => sanitize_text_field($_GET['type']), |
|
773 | 773 | 'compare' => '=' |
774 | 774 | ); |
775 | 775 | } |
@@ -779,15 +779,15 @@ discard block |
||
779 | 779 | /** |
780 | 780 | * Reorders items. |
781 | 781 | */ |
782 | - public static function reorder_items( $vars ) { |
|
782 | + public static function reorder_items($vars) { |
|
783 | 783 | global $typenow; |
784 | 784 | |
785 | - if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) { |
|
785 | + if ('wpi_item' !== $typenow || empty($vars['orderby'])) { |
|
786 | 786 | return $vars; |
787 | 787 | } |
788 | 788 | |
789 | 789 | // By item type. |
790 | - if ( 'type' == $vars['orderby'] ) { |
|
790 | + if ('type' == $vars['orderby']) { |
|
791 | 791 | return array_merge( |
792 | 792 | $vars, |
793 | 793 | array( |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | } |
799 | 799 | |
800 | 800 | // By vat class. |
801 | - if ( 'vat_class' == $vars['orderby'] ) { |
|
801 | + if ('vat_class' == $vars['orderby']) { |
|
802 | 802 | return array_merge( |
803 | 803 | $vars, |
804 | 804 | array( |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | } |
810 | 810 | |
811 | 811 | // By vat rule. |
812 | - if ( 'vat_rule' == $vars['orderby'] ) { |
|
812 | + if ('vat_rule' == $vars['orderby']) { |
|
813 | 813 | return array_merge( |
814 | 814 | $vars, |
815 | 815 | array( |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | } |
821 | 821 | |
822 | 822 | // By price. |
823 | - if ( 'price' == $vars['orderby'] ) { |
|
823 | + if ('price' == $vars['orderby']) { |
|
824 | 824 | return array_merge( |
825 | 825 | $vars, |
826 | 826 | array( |
@@ -837,27 +837,27 @@ discard block |
||
837 | 837 | /** |
838 | 838 | * Fired when deleting a post. |
839 | 839 | */ |
840 | - public static function delete_post( $post_id ) { |
|
840 | + public static function delete_post($post_id) { |
|
841 | 841 | |
842 | - switch ( get_post_type( $post_id ) ) { |
|
842 | + switch (get_post_type($post_id)) { |
|
843 | 843 | |
844 | 844 | case 'wpi_item' : |
845 | - do_action( "getpaid_before_delete_item", new WPInv_Item( $post_id ) ); |
|
845 | + do_action("getpaid_before_delete_item", new WPInv_Item($post_id)); |
|
846 | 846 | break; |
847 | 847 | |
848 | 848 | case 'wpi_payment_form' : |
849 | - do_action( "getpaid_before_delete_payment_form", new GetPaid_Payment_Form( $post_id ) ); |
|
849 | + do_action("getpaid_before_delete_payment_form", new GetPaid_Payment_Form($post_id)); |
|
850 | 850 | break; |
851 | 851 | |
852 | 852 | case 'wpi_discount' : |
853 | - do_action( "getpaid_before_delete_discount", new WPInv_Discount( $post_id ) ); |
|
853 | + do_action("getpaid_before_delete_discount", new WPInv_Discount($post_id)); |
|
854 | 854 | break; |
855 | 855 | |
856 | 856 | case 'wpi_invoice' : |
857 | - $invoice = new WPInv_Invoice( $post_id ); |
|
858 | - do_action( "getpaid_before_delete_invoice", $invoice ); |
|
859 | - $invoice->get_data_store()->delete_items( $invoice ); |
|
860 | - $invoice->get_data_store()->delete_special_fields( $invoice ); |
|
857 | + $invoice = new WPInv_Invoice($post_id); |
|
858 | + do_action("getpaid_before_delete_invoice", $invoice); |
|
859 | + $invoice->get_data_store()->delete_items($invoice); |
|
860 | + $invoice->get_data_store()->delete_special_fields($invoice); |
|
861 | 861 | break; |
862 | 862 | } |
863 | 863 | } |
@@ -870,29 +870,29 @@ discard block |
||
870 | 870 | * |
871 | 871 | * @return mixed |
872 | 872 | */ |
873 | - public static function add_display_post_states( $post_states, $post ) { |
|
873 | + public static function add_display_post_states($post_states, $post) { |
|
874 | 874 | |
875 | - if ( wpinv_get_option( 'success_page', 0 ) == $post->ID ) { |
|
876 | - $post_states['getpaid_success_page'] = __( 'GetPaid Receipt Page', 'invoicing' ); |
|
875 | + if (wpinv_get_option('success_page', 0) == $post->ID) { |
|
876 | + $post_states['getpaid_success_page'] = __('GetPaid Receipt Page', 'invoicing'); |
|
877 | 877 | } |
878 | 878 | |
879 | - foreach ( getpaid_get_invoice_post_types() as $post_type => $label ) { |
|
879 | + foreach (getpaid_get_invoice_post_types() as $post_type => $label) { |
|
880 | 880 | |
881 | - if ( wpinv_get_option( "{$post_type}_history_page", 0 ) == $post->ID ) { |
|
881 | + if (wpinv_get_option("{$post_type}_history_page", 0) == $post->ID) { |
|
882 | 882 | $post_states["getpaid_{$post_type}_history_page"] = sprintf( |
883 | - __( 'GetPaid %s History Page', 'invoicing' ), |
|
883 | + __('GetPaid %s History Page', 'invoicing'), |
|
884 | 884 | $label |
885 | 885 | ); |
886 | 886 | } |
887 | 887 | |
888 | 888 | } |
889 | 889 | |
890 | - if ( wpinv_get_option( 'invoice_subscription_page', 0 ) == $post->ID ) { |
|
891 | - $post_states['getpaid_invoice_subscription_page'] = __( 'GetPaid Subscription Page', 'invoicing' ); |
|
890 | + if (wpinv_get_option('invoice_subscription_page', 0) == $post->ID) { |
|
891 | + $post_states['getpaid_invoice_subscription_page'] = __('GetPaid Subscription Page', 'invoicing'); |
|
892 | 892 | } |
893 | 893 | |
894 | - if ( wpinv_get_option( 'checkout_page', 0 ) == $post->ID ) { |
|
895 | - $post_states['getpaid_checkout_page'] = __( 'GetPaid Checkout Page', 'invoicing' ); |
|
894 | + if (wpinv_get_option('checkout_page', 0) == $post->ID) { |
|
895 | + $post_states['getpaid_checkout_page'] = __('GetPaid Checkout Page', 'invoicing'); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | return $post_states; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | 29 | ?> |
30 | 30 | |
@@ -40,20 +40,20 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php |
42 | 42 | |
43 | - if ( $invoice->is_draft() ) { |
|
43 | + if ($invoice->is_draft()) { |
|
44 | 44 | |
45 | 45 | // Set gateway. |
46 | 46 | echo aui()->select( |
47 | 47 | array( |
48 | 48 | 'id' => 'wpinv_gateway', |
49 | 49 | 'name' => 'wpinv_gateway', |
50 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
50 | + 'label' => __('Gateway:', 'invoicing'), |
|
51 | 51 | 'label_type' => 'vertical', |
52 | - 'placeholder' => __( 'Select Gateway', 'invoicing' ), |
|
52 | + 'placeholder' => __('Select Gateway', 'invoicing'), |
|
53 | 53 | 'value' => wpinv_get_default_gateway(), |
54 | 54 | 'select2' => true, |
55 | 55 | 'data-allow-clear' => 'false', |
56 | - 'options' => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ), |
|
56 | + 'options' => wp_list_pluck(wpinv_get_enabled_payment_gateways(true), 'admin_label'), |
|
57 | 57 | ) |
58 | 58 | ); |
59 | 59 | |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | 'id' => 'wpinv_key', |
66 | 66 | 'name' => 'wpinv_key', |
67 | 67 | 'label' => sprintf( |
68 | - __( '%s Key:', 'invoicing' ), |
|
69 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
68 | + __('%s Key:', 'invoicing'), |
|
69 | + ucfirst($invoice->get_invoice_quote_type()) |
|
70 | 70 | ), |
71 | 71 | 'label_type' => 'vertical', |
72 | 72 | 'class' => 'form-control-sm', |
73 | - 'value' => $invoice->get_key( 'edit' ), |
|
73 | + 'value' => $invoice->get_key('edit'), |
|
74 | 74 | 'extra_attributes' => array( |
75 | 75 | 'onclick' => 'this.select();', |
76 | 76 | 'readonly' => 'true', |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | 'id' => 'wpinv_view_url', |
86 | 86 | 'name' => 'wpinv_view_url', |
87 | 87 | 'label' => sprintf( |
88 | - __( '%s URL:', 'invoicing' ), |
|
89 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
90 | - ) . ' <a href="' . esc_url_raw( $invoice->get_view_url() ) . '" title="' . __( 'View invoice', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>', |
|
88 | + __('%s URL:', 'invoicing'), |
|
89 | + ucfirst($invoice->get_invoice_quote_type()) |
|
90 | + ) . ' <a href="' . esc_url_raw($invoice->get_view_url()) . '" title="' . __('View invoice', 'invoicing') . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>', |
|
91 | 91 | 'label_type' => 'vertical', |
92 | 92 | 'class' => 'form-control-sm', |
93 | 93 | 'value' => $invoice->get_view_url(), |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | ); |
100 | 100 | |
101 | 101 | // If the invoice is paid... |
102 | - if ( $invoice->is_paid() || $invoice->is_refunded() ) { |
|
102 | + if ($invoice->is_paid() || $invoice->is_refunded()) { |
|
103 | 103 | |
104 | 104 | // Gateway. |
105 | 105 | echo aui()->input( |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | 'type' => 'text', |
108 | 108 | 'id' => 'wpinv_gateway', |
109 | 109 | 'name' => '', |
110 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
110 | + 'label' => __('Gateway:', 'invoicing'), |
|
111 | 111 | 'label_type' => 'vertical', |
112 | 112 | 'class' => 'form-control-sm', |
113 | - 'value' => wpinv_get_gateway_admin_label( $invoice->get_gateway( 'edit' ) ), |
|
113 | + 'value' => wpinv_get_gateway_admin_label($invoice->get_gateway('edit')), |
|
114 | 114 | 'extra_attributes' => array( |
115 | 115 | 'onclick' => 'this.select();', |
116 | 116 | 'readonly' => 'true', |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | 'type' => 'text', |
126 | 126 | 'id' => 'wpinv_transaction_id', |
127 | 127 | 'name' => 'wpinv_transaction_id', |
128 | - 'label' => __( 'Transaction ID:', 'invoicing' ) . ( $transaction_url ? ' <a href="' . esc_url( $transaction_url ) . '" title="' . __( 'View details', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>' : '' ), |
|
128 | + 'label' => __('Transaction ID:', 'invoicing') . ($transaction_url ? ' <a href="' . esc_url($transaction_url) . '" title="' . __('View details', 'invoicing') . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>' : ''), |
|
129 | 129 | 'label_type' => 'vertical', |
130 | 130 | 'class' => 'form-control-sm', |
131 | - 'value' => $invoice->get_transaction_id( 'edit' ), |
|
132 | - 'help_text' => apply_filters( 'wpinv_invoice_transaction_link_' . $invoice->get_gateway( 'edit' ), '', $invoice->get_transaction_id(), $invoice ), |
|
131 | + 'value' => $invoice->get_transaction_id('edit'), |
|
132 | + 'help_text' => apply_filters('wpinv_invoice_transaction_link_' . $invoice->get_gateway('edit'), '', $invoice->get_transaction_id(), $invoice), |
|
133 | 133 | 'extra_attributes' => array( |
134 | 134 | 'onclick' => 'this.select();', |
135 | 135 | 'readonly' => 'true', |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | 'type' => 'text', |
144 | 144 | 'id' => 'wpinv_currency', |
145 | 145 | 'name' => 'wpinv_currency', |
146 | - 'label' => __( 'Currency:', 'invoicing' ), |
|
146 | + 'label' => __('Currency:', 'invoicing'), |
|
147 | 147 | 'label_type' => 'vertical', |
148 | 148 | 'class' => 'form-control-sm', |
149 | - 'value' => $invoice->get_currency( 'edit' ), |
|
149 | + 'value' => $invoice->get_currency('edit'), |
|
150 | 150 | 'extra_attributes' => array( |
151 | 151 | 'onclick' => 'this.select();', |
152 | 152 | 'readonly' => 'true', |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | } else { |
158 | 158 | |
159 | - if ( 'wpi_invoice' == $invoice->get_post_type() ) { |
|
159 | + if ('wpi_invoice' == $invoice->get_post_type()) { |
|
160 | 160 | |
161 | 161 | // Payment URL. |
162 | 162 | echo aui()->input( |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | 'type' => 'text', |
165 | 165 | 'id' => 'wpinv_payment_url', |
166 | 166 | 'name' => 'wpinv_payment_url', |
167 | - 'label' => __( 'Payment URL:', 'invoicing' ), |
|
167 | + 'label' => __('Payment URL:', 'invoicing'), |
|
168 | 168 | 'label_type' => 'vertical', |
169 | 169 | 'class' => 'form-control-sm', |
170 | 170 | 'value' => $invoice->get_checkout_payment_url(), |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | array( |
181 | 181 | 'id' => 'wpinv_gateway', |
182 | 182 | 'name' => 'wpinv_gateway', |
183 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
183 | + 'label' => __('Gateway:', 'invoicing'), |
|
184 | 184 | 'label_type' => 'vertical', |
185 | - 'placeholder' => __( 'Select Gateway', 'invoicing' ), |
|
186 | - 'value' => $invoice->get_gateway( 'edit' ), |
|
185 | + 'placeholder' => __('Select Gateway', 'invoicing'), |
|
186 | + 'value' => $invoice->get_gateway('edit'), |
|
187 | 187 | 'select2' => true, |
188 | 188 | 'data-allow-clear' => 'false', |
189 | - 'options' => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ), |
|
189 | + 'options' => wp_list_pluck(wpinv_get_enabled_payment_gateways(true), 'admin_label'), |
|
190 | 190 | ) |
191 | 191 | ); |
192 | 192 |