|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Contains settings related functions |
|
4
|
|
|
* |
|
5
|
|
|
* @package Invoicing |
|
6
|
|
|
* @since 1.0.0 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
defined( 'ABSPATH' ) || exit; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Retrieves all default settings. |
|
13
|
|
|
* |
|
14
|
|
|
* @return array |
|
15
|
|
|
*/ |
|
16
|
|
|
function wpinv_get_settings() { |
|
17
|
|
|
$defaults = array(); |
|
18
|
|
|
|
|
19
|
|
|
foreach ( array_values( wpinv_get_registered_settings() ) as $tab_settings ) { |
|
20
|
|
|
|
|
21
|
|
|
foreach ( array_values( $tab_settings ) as $section_settings ) { |
|
22
|
|
|
|
|
23
|
|
|
foreach ( $section_settings as $key => $setting ) { |
|
24
|
|
|
if ( isset( $setting['std'] ) ) { |
|
25
|
|
|
$defaults[ $key ] = $setting['std']; |
|
26
|
|
|
} |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
return $defaults; |
|
34
|
|
|
|
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Retrieves all settings. |
|
39
|
|
|
* |
|
40
|
|
|
* @return array |
|
41
|
|
|
*/ |
|
42
|
|
|
function wpinv_get_options() { |
|
43
|
|
|
global $wpinv_options; |
|
44
|
|
|
|
|
45
|
|
|
// Try fetching the saved options. |
|
46
|
|
|
if ( ! is_array( $wpinv_options ) ) { |
|
47
|
|
|
$wpinv_options = get_option( 'wpinv_settings' ); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
// If that fails, don't fetch the default settings to prevent a loop. |
|
51
|
|
|
if ( ! is_array( $wpinv_options ) ) { |
|
52
|
|
|
$wpinv_options = array(); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
return $wpinv_options; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Retrieves a single setting. |
|
60
|
|
|
* |
|
61
|
|
|
* @param string $key the setting key. |
|
62
|
|
|
* @param mixed $default The default value to use if the setting has not been set. |
|
63
|
|
|
* @return mixed |
|
64
|
|
|
*/ |
|
65
|
|
|
function wpinv_get_option( $key = '', $default = false ) { |
|
66
|
|
|
|
|
67
|
|
|
$options = wpinv_get_options(); |
|
68
|
|
|
$value = isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
69
|
|
|
$value = apply_filters( 'wpinv_get_option', $value, $key, $default ); |
|
70
|
|
|
|
|
71
|
|
|
return apply_filters( 'wpinv_get_option_' . $key, $value, $key, $default ); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Updates all settings. |
|
76
|
|
|
* |
|
77
|
|
|
* @param array $options the new options. |
|
78
|
|
|
* @return bool |
|
79
|
|
|
*/ |
|
80
|
|
|
function wpinv_update_options( $options ) { |
|
81
|
|
|
global $wpinv_options; |
|
82
|
|
|
|
|
83
|
|
|
// update the option. |
|
84
|
|
|
if ( is_array( $options ) && update_option( 'wpinv_settings', $options ) ) { |
|
85
|
|
|
$wpinv_options = $options; |
|
86
|
|
|
return true; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
return false; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* Updates a single setting. |
|
94
|
|
|
* |
|
95
|
|
|
* @param string $key the setting key. |
|
96
|
|
|
* @param mixed $value The setting value. |
|
97
|
|
|
* @return bool |
|
98
|
|
|
*/ |
|
99
|
|
|
function wpinv_update_option( $key = '', $value = false ) { |
|
100
|
|
|
|
|
101
|
|
|
// If no key, exit. |
|
102
|
|
|
if ( empty( $key ) ) { |
|
103
|
|
|
return false; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
// Maybe delete the option instead. |
|
107
|
|
|
if ( is_null( $value ) ) { |
|
108
|
|
|
return wpinv_delete_option( $key ); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
// Prepare the new options. |
|
112
|
|
|
$options = wpinv_get_options(); |
|
113
|
|
|
$options[ $key ] = apply_filters( 'wpinv_update_option', $value, $key ); |
|
114
|
|
|
|
|
115
|
|
|
// Save the new options. |
|
116
|
|
|
return wpinv_update_options( $options ); |
|
117
|
|
|
|
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Deletes a single setting. |
|
122
|
|
|
* |
|
123
|
|
|
* @param string $key the setting key. |
|
124
|
|
|
* @return bool |
|
125
|
|
|
*/ |
|
126
|
|
|
function wpinv_delete_option( $key = '' ) { |
|
127
|
|
|
|
|
128
|
|
|
// If no key, exit |
|
129
|
|
|
if ( empty( $key ) ) { |
|
130
|
|
|
return false; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
$options = wpinv_get_options(); |
|
134
|
|
|
|
|
135
|
|
|
if ( isset( $options[ $key ] ) ) { |
|
136
|
|
|
unset( $options[ $key ] ); |
|
137
|
|
|
return wpinv_update_options( $options ); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
return true; |
|
141
|
|
|
|
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* Register settings after admin inits. |
|
146
|
|
|
* |
|
147
|
|
|
*/ |
|
148
|
|
|
function wpinv_register_settings() { |
|
149
|
|
|
|
|
150
|
|
|
// Loop through all tabs. |
|
151
|
|
|
foreach ( wpinv_get_registered_settings() as $tab => $sections ) { |
|
152
|
|
|
|
|
153
|
|
|
// In each tab, loop through sections. |
|
154
|
|
|
foreach ( $sections as $section => $settings ) { |
|
155
|
|
|
|
|
156
|
|
|
// Check for backwards compatibility |
|
157
|
|
|
$section_tabs = wpinv_get_settings_tab_sections( $tab ); |
|
158
|
|
|
if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) { |
|
159
|
|
|
$section = 'main'; |
|
160
|
|
|
$settings = $sections; |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
// Register the setting section. |
|
164
|
|
|
add_settings_section( |
|
165
|
|
|
'wpinv_settings_' . $tab . '_' . $section, |
|
166
|
|
|
__return_null(), |
|
|
|
|
|
|
167
|
|
|
'__return_false', |
|
168
|
|
|
'wpinv_settings_' . $tab . '_' . $section |
|
169
|
|
|
); |
|
170
|
|
|
|
|
171
|
|
|
foreach ( $settings as $option ) { |
|
172
|
|
|
if ( ! empty( $option['id'] ) ) { |
|
173
|
|
|
wpinv_register_settings_option( $tab, $section, $option ); |
|
174
|
|
|
} |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
} |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
// Creates our settings in the options table. |
|
181
|
|
|
register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' ); |
|
|
|
|
|
|
182
|
|
|
} |
|
183
|
|
|
add_action( 'admin_init', 'wpinv_register_settings' ); |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* Register a single settings option. |
|
187
|
|
|
* |
|
188
|
|
|
* @param string $tab |
|
189
|
|
|
* @param string $section |
|
190
|
|
|
* @param string $option |
|
191
|
|
|
* |
|
192
|
|
|
*/ |
|
193
|
|
|
function wpinv_register_settings_option( $tab, $section, $option ) { |
|
194
|
|
|
|
|
195
|
|
|
$name = isset( $option['name'] ) ? $option['name'] : ''; |
|
196
|
|
|
$cb = "wpinv_{$option['type']}_callback"; |
|
197
|
|
|
$section = "wpinv_settings_{$tab}_$section"; |
|
198
|
|
|
|
|
199
|
|
|
if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) { |
|
200
|
|
|
$tip = esc_attr( $option['desc'] ); |
|
201
|
|
|
$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>"; |
|
202
|
|
|
unset( $option['desc'] ); |
|
203
|
|
|
} |
|
204
|
|
|
|
|
205
|
|
|
// Loop through all tabs. |
|
206
|
|
|
add_settings_field( |
|
207
|
|
|
'wpinv_settings[' . $option['id'] . ']', |
|
208
|
|
|
$name, |
|
209
|
|
|
function_exists( $cb ) ? $cb : 'wpinv_missing_callback', |
|
210
|
|
|
$section, |
|
211
|
|
|
$section, |
|
212
|
|
|
array( |
|
213
|
|
|
'section' => $section, |
|
214
|
|
|
'id' => isset( $option['id'] ) ? $option['id'] : null, |
|
215
|
|
|
'desc' => isset( $option['desc'] ) ? $option['desc'] : '', |
|
216
|
|
|
'name' => $name, |
|
217
|
|
|
'size' => isset( $option['size'] ) ? $option['size'] : null, |
|
218
|
|
|
'options' => isset( $option['options'] ) ? $option['options'] : '', |
|
219
|
|
|
'selected' => isset( $option['selected'] ) ? $option['selected'] : null, |
|
220
|
|
|
'std' => isset( $option['std'] ) ? $option['std'] : '', |
|
221
|
|
|
'min' => isset( $option['min'] ) ? $option['min'] : null, |
|
222
|
|
|
'max' => isset( $option['max'] ) ? $option['max'] : null, |
|
223
|
|
|
'step' => isset( $option['step'] ) ? $option['step'] : null, |
|
224
|
|
|
'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null, |
|
225
|
|
|
'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true, |
|
226
|
|
|
'readonly' => isset( $option['readonly'] ) ? $option['readonly'] : false, |
|
227
|
|
|
'faux' => isset( $option['faux'] ) ? $option['faux'] : false, |
|
228
|
|
|
'onchange' => isset( $option['onchange'] ) ? $option['onchange'] : '', |
|
229
|
|
|
'custom' => isset( $option['custom'] ) ? $option['custom'] : '', |
|
230
|
|
|
'class' => isset( $option['class'] ) ? $option['class'] : '', |
|
231
|
|
|
'cols' => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50, |
|
232
|
|
|
'rows' => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5, |
|
233
|
|
|
) |
|
234
|
|
|
); |
|
235
|
|
|
|
|
236
|
|
|
} |
|
237
|
|
|
|
|
238
|
|
|
/** |
|
239
|
|
|
* Returns an array of all registered settings. |
|
240
|
|
|
* |
|
241
|
|
|
* @return array |
|
242
|
|
|
*/ |
|
243
|
|
|
function wpinv_get_registered_settings() { |
|
244
|
|
|
return apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ); |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* Sanitizes settings before they are saved. |
|
249
|
|
|
* |
|
250
|
|
|
* @return array |
|
251
|
|
|
*/ |
|
252
|
|
|
function wpinv_settings_sanitize( $input = array() ) { |
|
253
|
|
|
|
|
254
|
|
|
$wpinv_options = wpinv_get_options(); |
|
255
|
|
|
|
|
256
|
|
|
if ( empty( wp_get_raw_referer() ) ) { |
|
257
|
|
|
return $input; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
wp_parse_str( wp_get_raw_referer(), $referrer ); |
|
|
|
|
|
|
261
|
|
|
|
|
262
|
|
|
$settings = wpinv_get_registered_settings(); |
|
263
|
|
|
$tab = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general'; |
|
264
|
|
|
$section = isset( $referrer['section'] ) ? $referrer['section'] : 'main'; |
|
265
|
|
|
|
|
266
|
|
|
$input = $input ? $input : array(); |
|
267
|
|
|
$input = apply_filters( 'wpinv_settings_tab_' . $tab . '_sanitize', $input ); |
|
268
|
|
|
$input = apply_filters( 'wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input ); |
|
269
|
|
|
|
|
270
|
|
|
// Loop through each setting being saved and pass it through a sanitization filter |
|
271
|
|
|
foreach ( $input as $key => $value ) { |
|
272
|
|
|
|
|
273
|
|
|
// Get the setting type (checkbox, select, etc) |
|
274
|
|
|
$type = isset( $settings[ $tab ][$section][ $key ]['type'] ) ? $settings[ $tab ][$section][ $key ]['type'] : false; |
|
275
|
|
|
|
|
276
|
|
|
if ( $type ) { |
|
277
|
|
|
// Field type specific filter |
|
278
|
|
|
$input[$key] = apply_filters( 'wpinv_settings_sanitize_' . $type, $value, $key ); |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
// General filter |
|
282
|
|
|
$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key ); |
|
283
|
|
|
|
|
284
|
|
|
// Key specific filter. |
|
285
|
|
|
$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] ); |
|
286
|
|
|
} |
|
287
|
|
|
|
|
288
|
|
|
// Loop through the whitelist and unset any that are empty for the tab being saved |
|
289
|
|
|
$main_settings = $section == 'main' ? $settings[ $tab ] : array(); // Check for extensions that aren't using new sections |
|
290
|
|
|
$section_settings = ! empty( $settings[ $tab ][ $section ] ) ? $settings[ $tab ][ $section ] : array(); |
|
291
|
|
|
|
|
292
|
|
|
$found_settings = array_merge( $main_settings, $section_settings ); |
|
293
|
|
|
|
|
294
|
|
|
if ( ! empty( $found_settings ) ) { |
|
295
|
|
|
foreach ( $found_settings as $key => $value ) { |
|
296
|
|
|
|
|
297
|
|
|
// settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work |
|
298
|
|
|
if ( is_numeric( $key ) ) { |
|
299
|
|
|
$key = $value['id']; |
|
300
|
|
|
} |
|
301
|
|
|
|
|
302
|
|
|
if ( ! isset( $input[ $key ] ) && isset( $wpinv_options[ $key ] ) ) { |
|
303
|
|
|
unset( $wpinv_options[ $key ] ); |
|
304
|
|
|
} |
|
305
|
|
|
} |
|
306
|
|
|
} |
|
307
|
|
|
|
|
308
|
|
|
// Merge our new settings with the existing |
|
309
|
|
|
$output = array_merge( $wpinv_options, $input ); |
|
310
|
|
|
|
|
311
|
|
|
add_settings_error( 'wpinv-notices', '', __( 'Settings updated.', 'invoicing' ), 'updated' ); |
|
312
|
|
|
|
|
313
|
|
|
return $output; |
|
314
|
|
|
} |
|
315
|
|
|
|
|
316
|
|
|
function wpinv_settings_sanitize_misc_accounting( $input ) { |
|
317
|
|
|
|
|
318
|
|
|
if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
319
|
|
|
return $input; |
|
320
|
|
|
} |
|
321
|
|
|
|
|
322
|
|
|
if( ! empty( $input['enable_sequential'] ) && !wpinv_get_option( 'enable_sequential' ) ) { |
|
323
|
|
|
// Shows an admin notice about upgrading previous order numbers |
|
324
|
|
|
getpaid_session()->set( 'upgrade_sequential', '1' ); |
|
325
|
|
|
} |
|
326
|
|
|
|
|
327
|
|
|
return $input; |
|
328
|
|
|
} |
|
329
|
|
|
add_filter( 'wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting' ); |
|
330
|
|
|
|
|
331
|
|
|
function wpinv_settings_sanitize_tax_rates( $input ) { |
|
332
|
|
|
if( ! wpinv_current_user_can_manage_invoicing() ) { |
|
333
|
|
|
return $input; |
|
334
|
|
|
} |
|
335
|
|
|
|
|
336
|
|
|
$new_rates = ! empty( $_POST['tax_rates'] ) ? array_values( $_POST['tax_rates'] ) : array(); |
|
337
|
|
|
$tax_rates = array(); |
|
338
|
|
|
|
|
339
|
|
|
foreach ( $new_rates as $rate ) { |
|
340
|
|
|
|
|
341
|
|
|
if ( ! empty( $rate['country'] ) ) { |
|
342
|
|
|
$rate['rate'] = wpinv_sanitize_amount( $rate['rate'] ); |
|
343
|
|
|
$rate['name'] = sanitize_text_field( $rate['name'] ); |
|
344
|
|
|
$rate['state'] = sanitize_text_field( $rate['state'] ); |
|
345
|
|
|
$rate['country'] = sanitize_text_field( $rate['country'] ); |
|
346
|
|
|
$tax_rates[] = $rate; |
|
347
|
|
|
} |
|
348
|
|
|
|
|
349
|
|
|
} |
|
350
|
|
|
|
|
351
|
|
|
update_option( 'wpinv_tax_rates', $tax_rates ); |
|
352
|
|
|
|
|
353
|
|
|
return $input; |
|
354
|
|
|
} |
|
355
|
|
|
add_filter( 'wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates' ); |
|
356
|
|
|
|
|
357
|
|
|
function wpinv_sanitize_text_field( $input ) { |
|
358
|
|
|
return trim( $input ); |
|
359
|
|
|
} |
|
360
|
|
|
add_filter( 'wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field' ); |
|
361
|
|
|
|
|
362
|
|
|
function wpinv_get_settings_tabs() { |
|
363
|
|
|
$tabs = array(); |
|
364
|
|
|
$tabs['general'] = __( 'General', 'invoicing' ); |
|
365
|
|
|
$tabs['gateways'] = __( 'Payment Gateways', 'invoicing' ); |
|
366
|
|
|
$tabs['taxes'] = __( 'Taxes', 'invoicing' ); |
|
367
|
|
|
$tabs['emails'] = __( 'Emails', 'invoicing' ); |
|
368
|
|
|
$tabs['privacy'] = __( 'Privacy', 'invoicing' ); |
|
369
|
|
|
$tabs['misc'] = __( 'Misc', 'invoicing' ); |
|
370
|
|
|
$tabs['tools'] = __( 'Tools', 'invoicing' ); |
|
371
|
|
|
|
|
372
|
|
|
return apply_filters( 'wpinv_settings_tabs', $tabs ); |
|
373
|
|
|
} |
|
374
|
|
|
|
|
375
|
|
|
function wpinv_get_settings_tab_sections( $tab = false ) { |
|
376
|
|
|
$tabs = false; |
|
377
|
|
|
$sections = wpinv_get_registered_settings_sections(); |
|
378
|
|
|
|
|
379
|
|
|
if( $tab && ! empty( $sections[ $tab ] ) ) { |
|
380
|
|
|
$tabs = $sections[ $tab ]; |
|
381
|
|
|
} else if ( $tab ) { |
|
382
|
|
|
$tabs = false; |
|
383
|
|
|
} |
|
384
|
|
|
|
|
385
|
|
|
return $tabs; |
|
386
|
|
|
} |
|
387
|
|
|
|
|
388
|
|
|
function wpinv_get_registered_settings_sections() { |
|
389
|
|
|
static $sections = false; |
|
390
|
|
|
|
|
391
|
|
|
if ( false !== $sections ) { |
|
392
|
|
|
return $sections; |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
$sections = array( |
|
396
|
|
|
'general' => apply_filters( 'wpinv_settings_sections_general', array( |
|
397
|
|
|
'main' => __( 'General Settings', 'invoicing' ), |
|
398
|
|
|
'currency_section' => __( 'Currency Settings', 'invoicing' ), |
|
399
|
|
|
'labels' => __( 'Label Texts', 'invoicing' ), |
|
400
|
|
|
) ), |
|
401
|
|
|
'gateways' => apply_filters( 'wpinv_settings_sections_gateways', array( |
|
402
|
|
|
'main' => __( 'Gateway Settings', 'invoicing' ), |
|
403
|
|
|
) ), |
|
404
|
|
|
'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array( |
|
405
|
|
|
'main' => __( 'Tax Settings', 'invoicing' ), |
|
406
|
|
|
'rates' => __( 'Tax Rates', 'invoicing' ), |
|
407
|
|
|
) ), |
|
408
|
|
|
'emails' => apply_filters( 'wpinv_settings_sections_emails', array( |
|
409
|
|
|
'main' => __( 'Email Settings', 'invoicing' ), |
|
410
|
|
|
) ), |
|
411
|
|
|
'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array( |
|
412
|
|
|
'main' => __( 'Privacy policy', 'invoicing' ), |
|
413
|
|
|
) ), |
|
414
|
|
|
'misc' => apply_filters( 'wpinv_settings_sections_misc', array( |
|
415
|
|
|
'main' => __( 'Miscellaneous', 'invoicing' ), |
|
416
|
|
|
'custom-css' => __( 'Custom CSS', 'invoicing' ), |
|
417
|
|
|
) ), |
|
418
|
|
|
'tools' => apply_filters( 'wpinv_settings_sections_tools', array( |
|
419
|
|
|
'main' => __( 'Diagnostic Tools', 'invoicing' ), |
|
420
|
|
|
) ), |
|
421
|
|
|
); |
|
422
|
|
|
|
|
423
|
|
|
$sections = apply_filters( 'wpinv_settings_sections', $sections ); |
|
424
|
|
|
|
|
425
|
|
|
return $sections; |
|
426
|
|
|
} |
|
427
|
|
|
|
|
428
|
|
|
function wpinv_get_pages( $with_slug = false, $default_label = NULL ) { |
|
429
|
|
|
$pages_options = array(); |
|
430
|
|
|
|
|
431
|
|
|
if( $default_label !== NULL && $default_label !== false ) { |
|
432
|
|
|
$pages_options = array( '' => $default_label ); // Blank option |
|
433
|
|
|
} |
|
434
|
|
|
|
|
435
|
|
|
$pages = get_pages(); |
|
436
|
|
|
if ( $pages ) { |
|
437
|
|
|
foreach ( $pages as $page ) { |
|
438
|
|
|
$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
439
|
|
|
$pages_options[ $page->ID ] = $title; |
|
440
|
|
|
} |
|
441
|
|
|
} |
|
442
|
|
|
|
|
443
|
|
|
return $pages_options; |
|
444
|
|
|
} |
|
445
|
|
|
|
|
446
|
|
|
function wpinv_header_callback( $args ) { |
|
447
|
|
|
if ( !empty( $args['desc'] ) ) { |
|
448
|
|
|
echo $args['desc']; |
|
449
|
|
|
} |
|
450
|
|
|
} |
|
451
|
|
|
|
|
452
|
|
|
function wpinv_hidden_callback( $args ) { |
|
453
|
|
|
global $wpinv_options; |
|
454
|
|
|
|
|
455
|
|
|
if ( isset( $args['set_value'] ) ) { |
|
456
|
|
|
$value = $args['set_value']; |
|
457
|
|
|
} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
458
|
|
|
$value = $wpinv_options[ $args['id'] ]; |
|
459
|
|
|
} else { |
|
460
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
461
|
|
|
} |
|
462
|
|
|
|
|
463
|
|
|
if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
464
|
|
|
$args['readonly'] = true; |
|
465
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
466
|
|
|
$name = ''; |
|
467
|
|
|
} else { |
|
468
|
|
|
$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
469
|
|
|
} |
|
470
|
|
|
|
|
471
|
|
|
$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
472
|
|
|
|
|
473
|
|
|
echo $html; |
|
474
|
|
|
} |
|
475
|
|
|
|
|
476
|
|
|
/** |
|
477
|
|
|
* Displays a checkbox settings callback. |
|
478
|
|
|
*/ |
|
479
|
|
|
function wpinv_checkbox_callback( $args ) { |
|
480
|
|
|
|
|
481
|
|
|
$std = isset( $args['std'] ) ? $args['std'] : ''; |
|
482
|
|
|
$std = wpinv_get_option( $args['id'], $std ); |
|
483
|
|
|
$id = esc_attr( $args['id'] ); |
|
484
|
|
|
|
|
485
|
|
|
getpaid_hidden_field( "wpinv_settings[$id]", '0' ); |
|
486
|
|
|
?> |
|
487
|
|
|
<fieldset> |
|
488
|
|
|
<label> |
|
489
|
|
|
<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox"> |
|
490
|
|
|
<?php echo wp_kses_post( $args['desc'] ); ?> |
|
491
|
|
|
</label> |
|
492
|
|
|
</fieldset> |
|
493
|
|
|
<?php |
|
494
|
|
|
} |
|
495
|
|
|
|
|
496
|
|
|
function wpinv_multicheck_callback( $args ) { |
|
497
|
|
|
|
|
498
|
|
|
global $wpinv_options; |
|
499
|
|
|
|
|
500
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
501
|
|
|
$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
502
|
|
|
|
|
503
|
|
|
if ( ! empty( $args['options'] ) ) { |
|
504
|
|
|
|
|
505
|
|
|
$std = isset( $args['std'] ) ? $args['std'] : array(); |
|
506
|
|
|
$value = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std; |
|
507
|
|
|
|
|
508
|
|
|
echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
509
|
|
|
foreach( $args['options'] as $key => $option ): |
|
510
|
|
|
$sanitize_key = wpinv_sanitize_key( $key ); |
|
511
|
|
|
if ( in_array( $sanitize_key, $value ) ) { |
|
512
|
|
|
$enabled = $sanitize_key; |
|
513
|
|
|
} else { |
|
514
|
|
|
$enabled = NULL; |
|
515
|
|
|
} |
|
516
|
|
|
echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
517
|
|
|
echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
518
|
|
|
endforeach; |
|
519
|
|
|
echo '</div>'; |
|
520
|
|
|
echo '<p class="description">' . $args['desc'] . '</p>'; |
|
521
|
|
|
} |
|
522
|
|
|
} |
|
523
|
|
|
|
|
524
|
|
|
function wpinv_payment_icons_callback( $args ) { |
|
525
|
|
|
global $wpinv_options; |
|
526
|
|
|
|
|
527
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
528
|
|
|
|
|
529
|
|
|
if ( ! empty( $args['options'] ) ) { |
|
530
|
|
|
foreach( $args['options'] as $key => $option ) { |
|
531
|
|
|
$sanitize_key = wpinv_sanitize_key( $key ); |
|
532
|
|
|
|
|
533
|
|
|
if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
534
|
|
|
$enabled = $option; |
|
535
|
|
|
} else { |
|
536
|
|
|
$enabled = NULL; |
|
537
|
|
|
} |
|
538
|
|
|
|
|
539
|
|
|
echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
540
|
|
|
|
|
541
|
|
|
echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
542
|
|
|
|
|
543
|
|
|
if ( wpinv_string_is_image_url( $key ) ) { |
|
544
|
|
|
echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
545
|
|
|
} else { |
|
546
|
|
|
$card = strtolower( str_replace( ' ', '', $option ) ); |
|
547
|
|
|
|
|
548
|
|
|
if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
549
|
|
|
$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
550
|
|
|
} else { |
|
551
|
|
|
$image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
|
|
|
|
|
552
|
|
|
$content_dir = WP_CONTENT_DIR; |
|
553
|
|
|
|
|
554
|
|
|
if ( function_exists( 'wp_normalize_path' ) ) { |
|
555
|
|
|
// Replaces backslashes with forward slashes for Windows systems |
|
556
|
|
|
$image = wp_normalize_path( $image ); |
|
557
|
|
|
$content_dir = wp_normalize_path( $content_dir ); |
|
558
|
|
|
} |
|
559
|
|
|
|
|
560
|
|
|
$image = str_replace( $content_dir, content_url(), $image ); |
|
561
|
|
|
} |
|
562
|
|
|
|
|
563
|
|
|
echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
564
|
|
|
} |
|
565
|
|
|
echo $option . '</label>'; |
|
566
|
|
|
} |
|
567
|
|
|
echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
568
|
|
|
} |
|
569
|
|
|
} |
|
570
|
|
|
|
|
571
|
|
|
/** |
|
572
|
|
|
* Displays a radio settings field. |
|
573
|
|
|
*/ |
|
574
|
|
|
function wpinv_radio_callback( $args ) { |
|
575
|
|
|
|
|
576
|
|
|
$std = isset( $args['std'] ) ? $args['std'] : ''; |
|
577
|
|
|
$std = wpinv_get_option( $args['id'], $std ); |
|
578
|
|
|
?> |
|
579
|
|
|
<fieldset> |
|
580
|
|
|
<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;"> |
|
581
|
|
|
<?php foreach( $args['options'] as $key => $option ) : ?> |
|
582
|
|
|
<li> |
|
583
|
|
|
<label> |
|
584
|
|
|
<input name="wpinv_settings[<?php echo esc_attr( $args['id'] ); ?>]" <?php checked( $std, $key ); ?> value="<?php echo esc_attr( $key ); ?>" type="radio"> |
|
585
|
|
|
<?php echo wp_kses_post( $option ); ?> |
|
586
|
|
|
</label> |
|
587
|
|
|
</li> |
|
588
|
|
|
<?php endforeach; ?> |
|
589
|
|
|
</ul> |
|
590
|
|
|
</fieldset> |
|
591
|
|
|
<?php |
|
592
|
|
|
getpaid_settings_description_callback( $args ); |
|
593
|
|
|
} |
|
594
|
|
|
|
|
595
|
|
|
/** |
|
596
|
|
|
* Displays a description if available. |
|
597
|
|
|
*/ |
|
598
|
|
|
function getpaid_settings_description_callback( $args ) { |
|
599
|
|
|
|
|
600
|
|
|
if ( ! empty( $args['desc'] ) ) { |
|
601
|
|
|
$description = wp_kses_post( $args['desc'] ); |
|
602
|
|
|
echo "<p class='description'>$description</p>"; |
|
603
|
|
|
} |
|
604
|
|
|
|
|
605
|
|
|
} |
|
606
|
|
|
|
|
607
|
|
|
function wpinv_gateways_callback( $args ) { |
|
608
|
|
|
global $wpinv_options; |
|
609
|
|
|
|
|
610
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
611
|
|
|
|
|
612
|
|
|
foreach ( $args['options'] as $key => $option ) : |
|
613
|
|
|
$sanitize_key = wpinv_sanitize_key( $key ); |
|
614
|
|
|
|
|
615
|
|
|
if ( isset( $wpinv_options['gateways'][ $key ] ) ) |
|
616
|
|
|
$enabled = '1'; |
|
617
|
|
|
else |
|
618
|
|
|
$enabled = null; |
|
619
|
|
|
|
|
620
|
|
|
echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
|
621
|
|
|
echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
|
622
|
|
|
endforeach; |
|
623
|
|
|
} |
|
624
|
|
|
|
|
625
|
|
|
function wpinv_gateway_select_callback($args) { |
|
626
|
|
|
global $wpinv_options; |
|
627
|
|
|
|
|
628
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
629
|
|
|
$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
630
|
|
|
|
|
631
|
|
|
echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
632
|
|
|
|
|
633
|
|
|
foreach ( $args['options'] as $key => $option ) : |
|
634
|
|
|
if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
635
|
|
|
$selected = selected( $key, $args['selected'], false ); |
|
636
|
|
|
} else { |
|
637
|
|
|
$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : ''; |
|
638
|
|
|
} |
|
639
|
|
|
echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
640
|
|
|
endforeach; |
|
641
|
|
|
|
|
642
|
|
|
echo '</select>'; |
|
643
|
|
|
echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
644
|
|
|
} |
|
645
|
|
|
|
|
646
|
|
|
function wpinv_text_callback( $args ) { |
|
647
|
|
|
global $wpinv_options; |
|
648
|
|
|
|
|
649
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
650
|
|
|
|
|
651
|
|
|
if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
652
|
|
|
$value = $wpinv_options[ $args['id'] ]; |
|
653
|
|
|
} else { |
|
654
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
655
|
|
|
} |
|
656
|
|
|
|
|
657
|
|
|
if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
658
|
|
|
$args['readonly'] = true; |
|
659
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
660
|
|
|
$name = ''; |
|
661
|
|
|
} else { |
|
662
|
|
|
$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
663
|
|
|
} |
|
664
|
|
|
$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
665
|
|
|
|
|
666
|
|
|
$readonly = $args['readonly'] === true ? ' readonly="readonly"' : ''; |
|
667
|
|
|
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
668
|
|
|
$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>'; |
|
669
|
|
|
$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
670
|
|
|
|
|
671
|
|
|
echo $html; |
|
672
|
|
|
} |
|
673
|
|
|
|
|
674
|
|
|
function wpinv_number_callback( $args ) { |
|
675
|
|
|
global $wpinv_options; |
|
676
|
|
|
|
|
677
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
678
|
|
|
|
|
679
|
|
|
if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
680
|
|
|
$value = $wpinv_options[ $args['id'] ]; |
|
681
|
|
|
} else { |
|
682
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
683
|
|
|
} |
|
684
|
|
|
|
|
685
|
|
|
if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
686
|
|
|
$args['readonly'] = true; |
|
687
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
688
|
|
|
$name = ''; |
|
689
|
|
|
} else { |
|
690
|
|
|
$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
691
|
|
|
} |
|
692
|
|
|
|
|
693
|
|
|
$max = isset( $args['max'] ) ? $args['max'] : 999999; |
|
694
|
|
|
$min = isset( $args['min'] ) ? $args['min'] : 0; |
|
695
|
|
|
$step = isset( $args['step'] ) ? $args['step'] : 1; |
|
696
|
|
|
$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
697
|
|
|
|
|
698
|
|
|
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
699
|
|
|
$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
700
|
|
|
$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
701
|
|
|
|
|
702
|
|
|
echo $html; |
|
703
|
|
|
} |
|
704
|
|
|
|
|
705
|
|
|
function wpinv_textarea_callback( $args ) { |
|
706
|
|
|
global $wpinv_options; |
|
707
|
|
|
|
|
708
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
709
|
|
|
|
|
710
|
|
|
if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
711
|
|
|
$value = $wpinv_options[ $args['id'] ]; |
|
712
|
|
|
} else { |
|
713
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
714
|
|
|
} |
|
715
|
|
|
|
|
716
|
|
|
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
717
|
|
|
$class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
|
718
|
|
|
|
|
719
|
|
|
$html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
720
|
|
|
$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
721
|
|
|
|
|
722
|
|
|
echo $html; |
|
723
|
|
|
} |
|
724
|
|
|
|
|
725
|
|
|
function wpinv_password_callback( $args ) { |
|
726
|
|
|
global $wpinv_options; |
|
727
|
|
|
|
|
728
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
729
|
|
|
|
|
730
|
|
|
if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
731
|
|
|
$value = $wpinv_options[ $args['id'] ]; |
|
732
|
|
|
} else { |
|
733
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
734
|
|
|
} |
|
735
|
|
|
|
|
736
|
|
|
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
737
|
|
|
$html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
738
|
|
|
$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
739
|
|
|
|
|
740
|
|
|
echo $html; |
|
741
|
|
|
} |
|
742
|
|
|
|
|
743
|
|
|
function wpinv_missing_callback($args) { |
|
744
|
|
|
printf( |
|
745
|
|
|
__( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
746
|
|
|
'<strong>' . $args['id'] . '</strong>' |
|
747
|
|
|
); |
|
748
|
|
|
} |
|
749
|
|
|
|
|
750
|
|
|
function wpinv_select_callback($args) { |
|
751
|
|
|
global $wpinv_options; |
|
752
|
|
|
|
|
753
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
754
|
|
|
|
|
755
|
|
|
if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
756
|
|
|
$value = $wpinv_options[ $args['id'] ]; |
|
757
|
|
|
} else { |
|
758
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
759
|
|
|
} |
|
760
|
|
|
|
|
761
|
|
|
if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
762
|
|
|
$value = $args['selected']; |
|
763
|
|
|
} |
|
764
|
|
|
|
|
765
|
|
|
if ( isset( $args['placeholder'] ) ) { |
|
766
|
|
|
$placeholder = $args['placeholder']; |
|
767
|
|
|
} else { |
|
768
|
|
|
$placeholder = ''; |
|
769
|
|
|
} |
|
770
|
|
|
|
|
771
|
|
|
if( !empty( $args['onchange'] ) ) { |
|
772
|
|
|
$onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"'; |
|
773
|
|
|
} else { |
|
774
|
|
|
$onchange = ''; |
|
775
|
|
|
} |
|
776
|
|
|
|
|
777
|
|
|
$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
778
|
|
|
|
|
779
|
|
|
$html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />'; |
|
780
|
|
|
|
|
781
|
|
|
foreach ( $args['options'] as $option => $name ) { |
|
782
|
|
|
$selected = selected( $option, $value, false ); |
|
783
|
|
|
$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
784
|
|
|
} |
|
785
|
|
|
|
|
786
|
|
|
$html .= '</select>'; |
|
787
|
|
|
$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
788
|
|
|
|
|
789
|
|
|
echo $html; |
|
790
|
|
|
} |
|
791
|
|
|
|
|
792
|
|
|
function wpinv_color_select_callback( $args ) { |
|
793
|
|
|
global $wpinv_options; |
|
794
|
|
|
|
|
795
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
796
|
|
|
|
|
797
|
|
|
if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
798
|
|
|
$value = $wpinv_options[ $args['id'] ]; |
|
799
|
|
|
} else { |
|
800
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
801
|
|
|
} |
|
802
|
|
|
|
|
803
|
|
|
$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
804
|
|
|
|
|
805
|
|
|
foreach ( $args['options'] as $option => $color ) { |
|
806
|
|
|
$selected = selected( $option, $value, false ); |
|
807
|
|
|
$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
808
|
|
|
} |
|
809
|
|
|
|
|
810
|
|
|
$html .= '</select>'; |
|
811
|
|
|
$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
812
|
|
|
|
|
813
|
|
|
echo $html; |
|
814
|
|
|
} |
|
815
|
|
|
|
|
816
|
|
|
function wpinv_rich_editor_callback( $args ) { |
|
817
|
|
|
global $wpinv_options, $wp_version; |
|
818
|
|
|
|
|
819
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
820
|
|
|
|
|
821
|
|
|
if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
822
|
|
|
$value = $wpinv_options[ $args['id'] ]; |
|
823
|
|
|
|
|
824
|
|
|
if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
825
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
826
|
|
|
} |
|
827
|
|
|
} else { |
|
828
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
829
|
|
|
} |
|
830
|
|
|
|
|
831
|
|
|
$rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
832
|
|
|
|
|
833
|
|
|
$html = '<div class="getpaid-settings-editor-input">'; |
|
834
|
|
|
if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
835
|
|
|
ob_start(); |
|
836
|
|
|
wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) ); |
|
837
|
|
|
$html .= ob_get_clean(); |
|
838
|
|
|
} else { |
|
839
|
|
|
$html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
840
|
|
|
} |
|
841
|
|
|
|
|
842
|
|
|
$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
843
|
|
|
|
|
844
|
|
|
echo $html; |
|
845
|
|
|
} |
|
846
|
|
|
|
|
847
|
|
|
function wpinv_upload_callback( $args ) { |
|
848
|
|
|
global $wpinv_options; |
|
849
|
|
|
|
|
850
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
851
|
|
|
|
|
852
|
|
|
if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
853
|
|
|
$value = $wpinv_options[$args['id']]; |
|
854
|
|
|
} else { |
|
855
|
|
|
$value = isset($args['std']) ? $args['std'] : ''; |
|
856
|
|
|
} |
|
857
|
|
|
|
|
858
|
|
|
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
859
|
|
|
$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
860
|
|
|
$html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
861
|
|
|
$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
862
|
|
|
|
|
863
|
|
|
echo $html; |
|
864
|
|
|
} |
|
865
|
|
|
|
|
866
|
|
|
function wpinv_color_callback( $args ) { |
|
867
|
|
|
global $wpinv_options; |
|
868
|
|
|
|
|
869
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
870
|
|
|
|
|
871
|
|
|
if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
872
|
|
|
$value = $wpinv_options[ $args['id'] ]; |
|
873
|
|
|
} else { |
|
874
|
|
|
$value = isset( $args['std'] ) ? $args['std'] : ''; |
|
875
|
|
|
} |
|
876
|
|
|
|
|
877
|
|
|
$default = isset( $args['std'] ) ? $args['std'] : ''; |
|
878
|
|
|
|
|
879
|
|
|
$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />'; |
|
880
|
|
|
$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
881
|
|
|
|
|
882
|
|
|
echo $html; |
|
883
|
|
|
} |
|
884
|
|
|
|
|
885
|
|
|
function wpinv_country_states_callback($args) { |
|
886
|
|
|
global $wpinv_options; |
|
887
|
|
|
|
|
888
|
|
|
$sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
889
|
|
|
|
|
890
|
|
|
if ( isset( $args['placeholder'] ) ) { |
|
891
|
|
|
$placeholder = $args['placeholder']; |
|
892
|
|
|
} else { |
|
893
|
|
|
$placeholder = ''; |
|
894
|
|
|
} |
|
895
|
|
|
|
|
896
|
|
|
$states = wpinv_get_country_states(); |
|
897
|
|
|
|
|
898
|
|
|
$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
899
|
|
|
$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
900
|
|
|
|
|
901
|
|
|
foreach ( $states as $option => $name ) { |
|
902
|
|
|
$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
903
|
|
|
$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
904
|
|
|
} |
|
905
|
|
|
|
|
906
|
|
|
$html .= '</select>'; |
|
907
|
|
|
$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
908
|
|
|
|
|
909
|
|
|
echo $html; |
|
910
|
|
|
} |
|
911
|
|
|
|
|
912
|
|
|
function wpinv_tax_rates_callback($args) { |
|
913
|
|
|
$rates = GetPaid_Tax::get_all_tax_rates(); |
|
914
|
|
|
ob_start(); ?> |
|
915
|
|
|
</td><tr> |
|
916
|
|
|
<td colspan="2" class="wpinv_tax_tdbox"> |
|
917
|
|
|
<p><?php echo $args['desc']; ?></p> |
|
918
|
|
|
<table id="wpinv_tax_rates" class="wp-list-table widefat fixed posts"> |
|
919
|
|
|
<thead> |
|
920
|
|
|
<tr> |
|
921
|
|
|
<th scope="col" class="wpinv_tax_country"><?php _e( 'Country', 'invoicing' ); ?></th> |
|
922
|
|
|
<th scope="col" class="wpinv_tax_state"><?php _e( 'State / Province', 'invoicing' ); ?></th> |
|
923
|
|
|
<th scope="col" class="wpinv_tax_global" title="<?php esc_attr_e( 'Apply rate to whole country, regardless of state / province', 'invoicing' ); ?>"><?php _e( 'Country Wide', 'invoicing' ); ?></th> |
|
924
|
|
|
<th scope="col" class="wpinv_tax_rate"><?php _e( 'Rate %', 'invoicing' ); ?></th> |
|
925
|
|
|
<th scope="col" class="wpinv_tax_name"><?php _e( 'Tax Name', 'invoicing' ); ?></th> |
|
926
|
|
|
<th scope="col" class="wpinv_tax_action"><?php _e( 'Remove', 'invoicing' ); ?></th> |
|
927
|
|
|
</tr> |
|
928
|
|
|
</thead> |
|
929
|
|
|
<tbody> |
|
930
|
|
|
<?php if( !empty( $rates ) ) : ?> |
|
931
|
|
|
<?php foreach( $rates as $key => $rate ) : ?> |
|
932
|
|
|
<?php |
|
933
|
|
|
$sanitized_key = wpinv_sanitize_key( $key ); |
|
934
|
|
|
?> |
|
935
|
|
|
<tr> |
|
936
|
|
|
<td class="wpinv_tax_country"> |
|
937
|
|
|
<?php |
|
938
|
|
|
echo wpinv_html_select( array( |
|
939
|
|
|
'options' => wpinv_get_country_list( true ), |
|
940
|
|
|
'name' => 'tax_rates[' . $sanitized_key . '][country]', |
|
941
|
|
|
'id' => 'tax_rates[' . $sanitized_key . '][country]', |
|
942
|
|
|
'selected' => $rate['country'], |
|
943
|
|
|
'show_option_all' => false, |
|
944
|
|
|
'show_option_none' => false, |
|
945
|
|
|
'class' => 'wpinv-tax-country wpi_select2', |
|
946
|
|
|
'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
947
|
|
|
) ); |
|
948
|
|
|
?> |
|
949
|
|
|
</td> |
|
950
|
|
|
<td class="wpinv_tax_state"> |
|
951
|
|
|
<?php |
|
952
|
|
|
$states = wpinv_get_country_states( $rate['country'] ); |
|
953
|
|
|
if( !empty( $states ) ) { |
|
954
|
|
|
echo wpinv_html_select( array( |
|
955
|
|
|
'options' => array_merge( array( '' => '' ), $states ), |
|
956
|
|
|
'name' => 'tax_rates[' . $sanitized_key . '][state]', |
|
957
|
|
|
'id' => 'tax_rates[' . $sanitized_key . '][state]', |
|
958
|
|
|
'selected' => $rate['state'], |
|
959
|
|
|
'show_option_all' => false, |
|
960
|
|
|
'show_option_none' => false, |
|
961
|
|
|
'class' => 'wpi_select2', |
|
962
|
|
|
'placeholder' => __( 'Choose a state', 'invoicing' ) |
|
963
|
|
|
) ); |
|
964
|
|
|
} else { |
|
965
|
|
|
echo wpinv_html_text( array( |
|
966
|
|
|
'name' => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'], |
|
967
|
|
|
'value' => ! empty( $rate['state'] ) ? $rate['state'] : '', |
|
968
|
|
|
'id' => 'tax_rates[' . $sanitized_key . '][state]', |
|
969
|
|
|
) ); |
|
970
|
|
|
} |
|
971
|
|
|
?> |
|
972
|
|
|
</td> |
|
973
|
|
|
<td class="wpinv_tax_global"> |
|
974
|
|
|
<input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked( true, ! empty( $rate['global'] ) ); ?>/> |
|
975
|
|
|
<label for="tax_rates[<?php echo $sanitized_key; ?>][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label> |
|
976
|
|
|
</td> |
|
977
|
|
|
<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[<?php echo $sanitized_key; ?>][rate]" value="<?php echo esc_html( $rate['rate'] ); ?>"/></td> |
|
978
|
|
|
<td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[<?php echo $sanitized_key; ?>][name]" value="<?php echo esc_html( $rate['name'] ); ?>"/></td> |
|
979
|
|
|
<td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td> |
|
980
|
|
|
</tr> |
|
981
|
|
|
<?php endforeach; ?> |
|
982
|
|
|
<?php else : ?> |
|
983
|
|
|
<tr> |
|
984
|
|
|
<td class="wpinv_tax_country"> |
|
985
|
|
|
<?php |
|
986
|
|
|
echo wpinv_html_select( array( |
|
987
|
|
|
'options' => wpinv_get_country_list( true ), |
|
988
|
|
|
'name' => 'tax_rates[0][country]', |
|
989
|
|
|
'show_option_all' => false, |
|
990
|
|
|
'show_option_none' => false, |
|
991
|
|
|
'class' => 'wpinv-tax-country wpi_select2', |
|
992
|
|
|
'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
993
|
|
|
) ); ?> |
|
994
|
|
|
</td> |
|
995
|
|
|
<td class="wpinv_tax_state"> |
|
996
|
|
|
<?php echo wpinv_html_text( array( |
|
997
|
|
|
'name' => 'tax_rates[0][state]' |
|
998
|
|
|
) ); ?> |
|
999
|
|
|
</td> |
|
1000
|
|
|
<td class="wpinv_tax_global"> |
|
1001
|
|
|
<input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/> |
|
1002
|
|
|
<label for="tax_rates[0][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label> |
|
1003
|
|
|
</td> |
|
1004
|
|
|
<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[0][rate]" placeholder="<?php echo (float)wpinv_get_option( 'tax_rate', 0 ) ;?>" value="<?php echo (float)wpinv_get_option( 'tax_rate', 0 ) ;?>"/></td> |
|
1005
|
|
|
<td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[0][name]" /></td> |
|
1006
|
|
|
<td><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td> |
|
1007
|
|
|
</tr> |
|
1008
|
|
|
<?php endif; ?> |
|
1009
|
|
|
</tbody> |
|
1010
|
|
|
<tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span></td></tr></tfoot> |
|
1011
|
|
|
</table> |
|
1012
|
|
|
<?php |
|
1013
|
|
|
echo ob_get_clean(); |
|
1014
|
|
|
} |
|
1015
|
|
|
|
|
1016
|
|
|
function wpinv_tools_callback($args) { |
|
1017
|
|
|
global $wpinv_options; |
|
1018
|
|
|
ob_start(); ?> |
|
1019
|
|
|
</td><tr> |
|
1020
|
|
|
<td colspan="2" class="wpinv_tools_tdbox"> |
|
1021
|
|
|
<?php if ( $args['desc'] ) { ?><p><?php echo $args['desc']; ?></p><?php } ?> |
|
1022
|
|
|
<?php do_action( 'wpinv_tools_before' ); ?> |
|
1023
|
|
|
<table id="wpinv_tools_table" class="wp-list-table widefat fixed posts"> |
|
1024
|
|
|
<thead> |
|
1025
|
|
|
<tr> |
|
1026
|
|
|
<th scope="col" class="wpinv-th-tool"><?php _e( 'Tool', 'invoicing' ); ?></th> |
|
1027
|
|
|
<th scope="col" class="wpinv-th-desc"><?php _e( 'Description', 'invoicing' ); ?></th> |
|
1028
|
|
|
<th scope="col" class="wpinv-th-action"><?php _e( 'Action', 'invoicing' ); ?></th> |
|
1029
|
|
|
</tr> |
|
1030
|
|
|
</thead> |
|
1031
|
|
|
<?php do_action( 'wpinv_tools_row' ); ?> |
|
1032
|
|
|
<tbody> |
|
1033
|
|
|
</tbody> |
|
1034
|
|
|
</table> |
|
1035
|
|
|
<?php do_action( 'wpinv_tools_after' ); ?> |
|
1036
|
|
|
<?php |
|
1037
|
|
|
echo ob_get_clean(); |
|
1038
|
|
|
} |
|
1039
|
|
|
|
|
1040
|
|
|
function wpinv_descriptive_text_callback( $args ) { |
|
1041
|
|
|
echo wp_kses_post( $args['desc'] ); |
|
1042
|
|
|
} |
|
1043
|
|
|
|
|
1044
|
|
|
function wpinv_hook_callback( $args ) { |
|
1045
|
|
|
do_action( 'wpinv_' . $args['id'], $args ); |
|
1046
|
|
|
} |
|
1047
|
|
|
|
|
1048
|
|
|
function wpinv_set_settings_cap() { |
|
1049
|
|
|
return wpinv_get_capability(); |
|
1050
|
|
|
} |
|
1051
|
|
|
add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
|
1052
|
|
|
|
|
1053
|
|
|
function wpinv_settings_sanitize_input( $value, $key ) { |
|
1054
|
|
|
if ( $key == 'tax_rate' || $key == 'eu_fallback_rate' ) { |
|
1055
|
|
|
$value = wpinv_sanitize_amount( $value, 4 ); |
|
|
|
|
|
|
1056
|
|
|
$value = $value >= 100 ? 99 : $value; |
|
1057
|
|
|
} |
|
1058
|
|
|
|
|
1059
|
|
|
return $value; |
|
1060
|
|
|
} |
|
1061
|
|
|
add_filter( 'wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2 ); |
|
1062
|
|
|
|
|
1063
|
|
|
function wpinv_on_update_settings( $old_value, $value, $option ) { |
|
1064
|
|
|
$old = !empty( $old_value['remove_data_on_unistall'] ) ? 1 : ''; |
|
1065
|
|
|
$new = !empty( $value['remove_data_on_unistall'] ) ? 1 : ''; |
|
1066
|
|
|
|
|
1067
|
|
|
if ( $old != $new ) { |
|
1068
|
|
|
update_option( 'wpinv_remove_data_on_invoice_unistall', $new ); |
|
1069
|
|
|
} |
|
1070
|
|
|
} |
|
1071
|
|
|
add_action( 'update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3 ); |
|
1072
|
|
|
add_action( 'wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1073
|
|
|
add_action( 'wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1074
|
|
|
add_action( 'wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1075
|
|
|
add_action( 'wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1076
|
|
|
add_action( 'wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1077
|
|
|
add_action( 'wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1078
|
|
|
add_action( 'wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1079
|
|
|
add_action( 'wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1080
|
|
|
add_action( 'wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1081
|
|
|
add_action( 'wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2 ); |
|
1082
|
|
|
|
|
1083
|
|
|
function wpinv_settings_tab_bottom_emails( $active_tab, $section ) { |
|
1084
|
|
|
?> |
|
1085
|
|
|
<div class="wpinv-email-wc-row "> |
|
1086
|
|
|
<div class="wpinv-email-wc-td"> |
|
1087
|
|
|
<h3 class="wpinv-email-wc-title"><?php echo apply_filters( 'wpinv_settings_email_wildcards_title', __( 'Wildcards For Emails', 'invoicing' ) ); ?></h3> |
|
1088
|
|
|
<p class="wpinv-email-wc-description"> |
|
1089
|
|
|
<?php |
|
1090
|
|
|
$description = __( 'The following wildcards can be used in email subjects, heading and content:<br> |
|
1091
|
|
|
<strong>{site_title} :</strong> Site Title<br> |
|
1092
|
|
|
<strong>{name} :</strong> Customer\'s full name<br> |
|
1093
|
|
|
<strong>{first_name} :</strong> Customer\'s first name<br> |
|
1094
|
|
|
<strong>{last_name} :</strong> Customer\'s last name<br> |
|
1095
|
|
|
<strong>{email} :</strong> Customer\'s email address<br> |
|
1096
|
|
|
<strong>{invoice_number} :</strong> The invoice number<br> |
|
1097
|
|
|
<strong>{invoice_total} :</strong> The invoice total<br> |
|
1098
|
|
|
<strong>{invoice_link} :</strong> The invoice link<br> |
|
1099
|
|
|
<strong>{invoice_pay_link} :</strong> The payment link<br> |
|
1100
|
|
|
<strong>{invoice_date} :</strong> The date the invoice was created<br> |
|
1101
|
|
|
<strong>{invoice_due_date} :</strong> The date the invoice is due<br> |
|
1102
|
|
|
<strong>{date} :</strong> Today\'s date.<br> |
|
1103
|
|
|
<strong>{is_was} :</strong> If due date of invoice is past, displays "was" otherwise displays "is"<br> |
|
1104
|
|
|
<strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing' ); |
|
1105
|
|
|
echo apply_filters('wpinv_settings_email_wildcards_description', $description, $active_tab, $section); |
|
1106
|
|
|
?> |
|
1107
|
|
|
</p> |
|
1108
|
|
|
</div> |
|
1109
|
|
|
</div> |
|
1110
|
|
|
<?php |
|
1111
|
|
|
} |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.