|
7 | 7 | */ |
8 | 8 |
|
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | | - exit; |
| 10 | + exit; |
11 | 11 | } |
12 | 12 |
|
13 | 13 | use MSKD\Admin\Admin; |
|
22 | 22 | */ |
23 | 23 | class MSKD_Admin { |
24 | 24 |
|
25 | | - /** |
26 | | - * Plugin pages prefix |
27 | | - */ |
28 | | - const PAGE_PREFIX = 'mskd-'; |
29 | | - |
30 | | - /** |
31 | | - * Subscriber ID used to identify one-time emails (not associated with any subscriber) |
32 | | - */ |
33 | | - const ONE_TIME_EMAIL_SUBSCRIBER_ID = 0; |
34 | | - |
35 | | - /** |
36 | | - * The new Admin instance |
37 | | - * |
38 | | - * @var Admin |
39 | | - */ |
40 | | - private Admin $admin; |
41 | | - |
42 | | - /** |
43 | | - * Constructor - initialize the new Admin class |
44 | | - */ |
45 | | - public function __construct() { |
46 | | - $this->admin = new Admin(); |
47 | | - } |
48 | | - |
49 | | - /** |
50 | | - * Initialize admin hooks |
51 | | - * Delegates to the new Admin class |
52 | | - */ |
53 | | - public function init(): void { |
54 | | - $this->admin->init(); |
55 | | - } |
56 | | - |
57 | | - /** |
58 | | - * Get preserved form data for one-time email |
59 | | - * |
60 | | - * @return array |
61 | | - */ |
62 | | - public function get_one_time_email_form_data(): array { |
63 | | - return $this->admin->get_one_time_email_form_data(); |
64 | | - } |
65 | | - |
66 | | - /** |
67 | | - * Register admin menu and submenus |
68 | | - * Delegates to the new Admin class |
69 | | - */ |
70 | | - public function register_menu(): void { |
71 | | - $this->admin->register_menu(); |
72 | | - } |
73 | | - |
74 | | - /** |
75 | | - * Enqueue admin assets |
76 | | - * Delegates to the new Admin class |
77 | | - * |
78 | | - * @param string $hook The current admin page hook. |
79 | | - */ |
80 | | - public function enqueue_assets( string $hook ): void { |
81 | | - $this->admin->enqueue_assets( $hook ); |
82 | | - } |
83 | | - |
84 | | - /** |
85 | | - * Show WP-Cron warning notice |
86 | | - * Delegates to the new Admin class |
87 | | - */ |
88 | | - public function show_cron_notice(): void { |
89 | | - $this->admin->show_cron_notice(); |
90 | | - } |
91 | | - |
92 | | - /** |
93 | | - * Show share notice |
94 | | - * Delegates to the new Admin class |
95 | | - */ |
96 | | - public function show_share_notice(): void { |
97 | | - $this->admin->show_share_notice(); |
98 | | - } |
99 | | - |
100 | | - /** |
101 | | - * Handle admin actions (add, edit, delete) |
102 | | - * Delegates to the new Admin class |
103 | | - */ |
104 | | - public function handle_actions(): void { |
105 | | - $this->admin->handle_actions(); |
106 | | - } |
107 | | - |
108 | | - /** |
109 | | - * Render Dashboard page |
110 | | - * Delegates to the new Admin class |
111 | | - */ |
112 | | - public function render_dashboard(): void { |
113 | | - $this->admin->render_dashboard(); |
114 | | - } |
115 | | - |
116 | | - /** |
117 | | - * Render Subscribers page |
118 | | - * Delegates to the new Admin class |
119 | | - */ |
120 | | - public function render_subscribers(): void { |
121 | | - $this->admin->render_subscribers(); |
122 | | - } |
123 | | - |
124 | | - /** |
125 | | - * Render Lists page |
126 | | - * Delegates to the new Admin class |
127 | | - */ |
128 | | - public function render_lists(): void { |
129 | | - $this->admin->render_lists(); |
130 | | - } |
131 | | - |
132 | | - /** |
133 | | - * Render Compose page |
134 | | - * Delegates to the new Admin class |
135 | | - */ |
136 | | - public function render_compose(): void { |
137 | | - $this->admin->render_compose(); |
138 | | - } |
139 | | - |
140 | | - /** |
141 | | - * Render Queue page |
142 | | - * Delegates to the new Admin class |
143 | | - */ |
144 | | - public function render_queue(): void { |
145 | | - $this->admin->render_queue(); |
146 | | - } |
147 | | - |
148 | | - /** |
149 | | - * Render Settings page |
150 | | - * Delegates to the new Admin class |
151 | | - */ |
152 | | - public function render_settings(): void { |
153 | | - $this->admin->render_settings(); |
154 | | - } |
155 | | - |
156 | | - /** |
157 | | - * Render One-Time Email page |
158 | | - * Delegates to the new Admin class |
159 | | - */ |
160 | | - public function render_one_time_email(): void { |
161 | | - $this->admin->render_one_time_email(); |
162 | | - } |
163 | | - |
164 | | - /** |
165 | | - * AJAX handler to dismiss share notice |
166 | | - * Delegates to the new Admin class |
167 | | - */ |
168 | | - public function ajax_dismiss_share_notice(): void { |
169 | | - $this->admin->ajax_dismiss_share_notice(); |
170 | | - } |
171 | | - |
172 | | - /** |
173 | | - * AJAX handler for SMTP test |
174 | | - * Delegates to the new Admin class |
175 | | - */ |
176 | | - public function ajax_test_smtp(): void { |
177 | | - $this->admin->ajax_test_smtp(); |
178 | | - } |
179 | | - |
180 | | - /** |
181 | | - * AJAX handler: Truncate subscribers table |
182 | | - * Delegates to the new Admin class |
183 | | - */ |
184 | | - public function ajax_truncate_subscribers(): void { |
185 | | - $this->admin->ajax_truncate_subscribers(); |
186 | | - } |
187 | | - |
188 | | - /** |
189 | | - * AJAX handler: Truncate lists table |
190 | | - * Delegates to the new Admin class |
191 | | - */ |
192 | | - public function ajax_truncate_lists(): void { |
193 | | - $this->admin->ajax_truncate_lists(); |
194 | | - } |
195 | | - |
196 | | - /** |
197 | | - * AJAX handler: Truncate queue table |
198 | | - * Delegates to the new Admin class |
199 | | - */ |
200 | | - public function ajax_truncate_queue(): void { |
201 | | - $this->admin->ajax_truncate_queue(); |
202 | | - } |
| 25 | + /** |
| 26 | + * Plugin pages prefix |
| 27 | + */ |
| 28 | + const PAGE_PREFIX = 'mskd-'; |
| 29 | + |
| 30 | + /** |
| 31 | + * Subscriber ID used to identify one-time emails (not associated with any subscriber) |
| 32 | + */ |
| 33 | + const ONE_TIME_EMAIL_SUBSCRIBER_ID = 0; |
| 34 | + |
| 35 | + /** |
| 36 | + * The new Admin instance |
| 37 | + * |
| 38 | + * @var Admin |
| 39 | + */ |
| 40 | + private Admin $admin; |
| 41 | + |
| 42 | + /** |
| 43 | + * Constructor - initialize the new Admin class |
| 44 | + */ |
| 45 | + public function __construct() { |
| 46 | + $this->admin = new Admin(); |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * Initialize admin hooks |
| 51 | + * Delegates to the new Admin class |
| 52 | + */ |
| 53 | + public function init(): void { |
| 54 | + $this->admin->init(); |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * Get preserved form data for one-time email |
| 59 | + * |
| 60 | + * @return array |
| 61 | + */ |
| 62 | + public function get_one_time_email_form_data(): array { |
| 63 | + return $this->admin->get_one_time_email_form_data(); |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * Register admin menu and submenus |
| 68 | + * Delegates to the new Admin class |
| 69 | + */ |
| 70 | + public function register_menu(): void { |
| 71 | + $this->admin->register_menu(); |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * Enqueue admin assets |
| 76 | + * Delegates to the new Admin class |
| 77 | + * |
| 78 | + * @param string $hook The current admin page hook. |
| 79 | + */ |
| 80 | + public function enqueue_assets( string $hook ): void { |
| 81 | + $this->admin->enqueue_assets( $hook ); |
| 82 | + } |
| 83 | + |
| 84 | + /** |
| 85 | + * Show WP-Cron warning notice |
| 86 | + * Delegates to the new Admin class |
| 87 | + */ |
| 88 | + public function show_cron_notice(): void { |
| 89 | + $this->admin->show_cron_notice(); |
| 90 | + } |
| 91 | + |
| 92 | + /** |
| 93 | + * Show share notice |
| 94 | + * Delegates to the new Admin class |
| 95 | + */ |
| 96 | + public function show_share_notice(): void { |
| 97 | + $this->admin->show_share_notice(); |
| 98 | + } |
| 99 | + |
| 100 | + /** |
| 101 | + * Handle admin actions (add, edit, delete) |
| 102 | + * Delegates to the new Admin class |
| 103 | + */ |
| 104 | + public function handle_actions(): void { |
| 105 | + $this->admin->handle_actions(); |
| 106 | + } |
| 107 | + |
| 108 | + /** |
| 109 | + * Render Dashboard page |
| 110 | + * Delegates to the new Admin class |
| 111 | + */ |
| 112 | + public function render_dashboard(): void { |
| 113 | + $this->admin->render_dashboard(); |
| 114 | + } |
| 115 | + |
| 116 | + /** |
| 117 | + * Render Subscribers page |
| 118 | + * Delegates to the new Admin class |
| 119 | + */ |
| 120 | + public function render_subscribers(): void { |
| 121 | + $this->admin->render_subscribers(); |
| 122 | + } |
| 123 | + |
| 124 | + /** |
| 125 | + * Render Lists page |
| 126 | + * Delegates to the new Admin class |
| 127 | + */ |
| 128 | + public function render_lists(): void { |
| 129 | + $this->admin->render_lists(); |
| 130 | + } |
| 131 | + |
| 132 | + /** |
| 133 | + * Render Compose page |
| 134 | + * Delegates to the new Admin class |
| 135 | + */ |
| 136 | + public function render_compose(): void { |
| 137 | + $this->admin->render_compose(); |
| 138 | + } |
| 139 | + |
| 140 | + /** |
| 141 | + * Render Queue page |
| 142 | + * Delegates to the new Admin class |
| 143 | + */ |
| 144 | + public function render_queue(): void { |
| 145 | + $this->admin->render_queue(); |
| 146 | + } |
| 147 | + |
| 148 | + /** |
| 149 | + * Render Settings page |
| 150 | + * Delegates to the new Admin class |
| 151 | + */ |
| 152 | + public function render_settings(): void { |
| 153 | + $this->admin->render_settings(); |
| 154 | + } |
| 155 | + |
| 156 | + /** |
| 157 | + * Render One-Time Email page |
| 158 | + * Delegates to the new Admin class |
| 159 | + */ |
| 160 | + public function render_one_time_email(): void { |
| 161 | + $this->admin->render_one_time_email(); |
| 162 | + } |
| 163 | + |
| 164 | + /** |
| 165 | + * AJAX handler to dismiss share notice |
| 166 | + * Delegates to the new Admin class |
| 167 | + */ |
| 168 | + public function ajax_dismiss_share_notice(): void { |
| 169 | + $this->admin->ajax_dismiss_share_notice(); |
| 170 | + } |
| 171 | + |
| 172 | + /** |
| 173 | + * AJAX handler for SMTP test |
| 174 | + * Delegates to the new Admin class |
| 175 | + */ |
| 176 | + public function ajax_test_smtp(): void { |
| 177 | + $this->admin->ajax_test_smtp(); |
| 178 | + } |
| 179 | + |
| 180 | + /** |
| 181 | + * AJAX handler: Truncate subscribers table |
| 182 | + * Delegates to the new Admin class |
| 183 | + */ |
| 184 | + public function ajax_truncate_subscribers(): void { |
| 185 | + $this->admin->ajax_truncate_subscribers(); |
| 186 | + } |
| 187 | + |
| 188 | + /** |
| 189 | + * AJAX handler: Truncate lists table |
| 190 | + * Delegates to the new Admin class |
| 191 | + */ |
| 192 | + public function ajax_truncate_lists(): void { |
| 193 | + $this->admin->ajax_truncate_lists(); |
| 194 | + } |
| 195 | + |
| 196 | + /** |
| 197 | + * AJAX handler: Truncate queue table |
| 198 | + * Delegates to the new Admin class |
| 199 | + */ |
| 200 | + public function ajax_truncate_queue(): void { |
| 201 | + $this->admin->ajax_truncate_queue(); |
| 202 | + } |
203 | 203 | } |
0 commit comments