1 | <?php |
||
19 | abstract class WordPoints_Hook_Extension implements WordPoints_Hook_SettingsI { |
||
20 | |||
21 | /** |
||
22 | * The unique slug for identifying this extension. |
||
23 | * |
||
24 | * @since 1.0.0 |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $slug; |
||
29 | |||
30 | /** |
||
31 | * The validator for the current reaction. |
||
32 | * |
||
33 | * @since 1.0.0 |
||
34 | * |
||
35 | * @var WordPoints_Hook_Reaction_Validator |
||
36 | */ |
||
37 | protected $validator; |
||
38 | |||
39 | /** |
||
40 | * The args for the current event. |
||
41 | * |
||
42 | * @since 1.0.0 |
||
43 | * |
||
44 | * @var WordPoints_Hook_Event_Args |
||
45 | */ |
||
46 | protected $event_args; |
||
47 | |||
48 | /** |
||
49 | * Get the slug of this extension. |
||
50 | * |
||
51 | * @since 1.0.0 |
||
52 | * |
||
53 | * @return string The extension's slug. |
||
54 | */ |
||
55 | public function get_slug() { |
||
58 | |||
59 | /** |
||
60 | * @since 1.0.0 |
||
61 | */ |
||
62 | public function validate_settings( |
||
81 | |||
82 | /** |
||
83 | * @since 1.0.0 |
||
84 | */ |
||
85 | public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) { |
||
93 | |||
94 | /** |
||
95 | * Check whether this hook firing should hit the target. |
||
96 | * |
||
97 | * @since 1.0.0 |
||
98 | * |
||
99 | * @param WordPoints_Hook_Reaction_Validator $reaction The reaction. |
||
100 | * @param WordPoints_Hook_Event_Args $event_args The event args. |
||
101 | * |
||
102 | * @return bool Whether the target should be hit by this hook firing. |
||
103 | */ |
||
104 | abstract public function should_hit( |
||
108 | |||
109 | /** |
||
110 | * After a reaction has hit the target. |
||
111 | * |
||
112 | * @since 1.0.0 |
||
113 | * |
||
114 | * @param WordPoints_Hook_Reaction_Validator $reaction The reaction. |
||
115 | * @param WordPoints_Hook_Event_Args $event_args The event args. |
||
116 | */ |
||
117 | public function after_hit( |
||
121 | |||
122 | /** |
||
123 | * Get the data the scripts need for the UI. |
||
124 | * |
||
125 | * @since 1.0.0 |
||
126 | * |
||
127 | * @return array Any data that needs to be present for the scripts in the UI. |
||
128 | */ |
||
129 | public function get_ui_script_data() { |
||
132 | } |
||
133 | |||
135 |