1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
<?php // phpcs:ignoreFile
namespace AutomateWoo;
/** * @class Tool_Abstract * @since 2.4.5 */ abstract class Tool_Abstract {
/** @var string - this must directly correspond to the filename */ public $id;
/** @var string */ public $title;
/** @var string */ public $description;
/** @var string */ public $additional_description;
/** @var bool */ public $is_background_processed = false;
/** * @return int */ function get_id() { return $this->id; }
/** * @param $args * @return bool|\WP_Error */ abstract function process( $args );
/** * @param $args */ abstract function display_confirmation_screen( $args );
/** * @return Fields\Field[] */ function get_form_fields() { return []; }
/** * @param array $args will be already sanitized * @return bool|\WP_Error */ function validate_process( $args ) { return true; }
/** * @param array $args * @return array */ function sanitize_args( $args ) { if ( ! $args ) { return []; }
if ( isset( $args['workflow'] ) ) { $args['workflow'] = absint( $args[ 'workflow' ] ); }
if ( isset( $args['date_from'] ) ) { $args['date_from'] = Clean::string( $args['date_from'] ); }
if ( isset( $args['date_to'] ) ) { $args['date_to'] = Clean::string( $args['date_to'] ); }
return $args; }
}
|