Repository navigation
Expand file tree
/
Copy pathclass-alert-type.php
More file actions
87 lines (77 loc) · 1.63 KB
/
Copy pathclass-alert-type.php
File metadata and controls
87 lines (77 loc) · 1.63 KB
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
<?php
/**
* Alert Type abstract class.
*
* Used to register new Alert types.
*
* @package WP_Stream
*/
namespace WP_Stream;
/**
* Class Alert_Type
*
* @package WP_Stream
*/
abstract class Alert_Type {
/**
* Holds instance of plugin object
*
* @var Plugin
*/
public $plugin;
/**
* Unique identifier.
*
* @var string
*/
public string $slug = '';
/**
* Whether this type can be selected when creating a new alert.
*
* Existing alerts of a non-creatable type still fire and remain editable.
*
* @var bool
*/
public bool $creatable = true;
/**
* Class constructor.
*
* @param Plugin $plugin Plugin object.
*/
public function __construct( Plugin $plugin ) {
$this->plugin = $plugin;
}
/**
* Alert recipients about the new record
*
* @param int $record_id Record ID.
* @param array $recordarr Record details.
* @param array $options Alert options.
*/
abstract public function alert( $record_id, $recordarr, $options );
/**
* Display settings form for configuration of individual alerts
*
* @param Alert $alert Alert currently being worked on.
*/
public function display_fields( $alert ) {
// Implementation optional, but recommended.
}
/**
* Process settings form for configuration of individual alerts
*
* @param Alert $alert Alert currently being worked on.
*/
public function save_fields( $alert ) {
// Implementation optional, but recommended.
}
/**
* Allow connectors to determine if their dependencies are satisfied or not
*
* @return bool
*/
public function is_dependency_satisfied() {
// Implementation optional, but recommended.
return true;
}
}