PluginProbe
DecaLog / 3.0.2
DecaLog v3.0.2
3.0.2 3.1.0 3.10.0 3.2.0 3.3.0 3.4.0 3.4.1 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.6.3 3.7.0 3.7.1 3.8.0 3.9.0 3.9.1 4.0.0 4.1.0 4.2.0 4.3.0 4.3.1 4.4.0 4.5.0 All 75 releases
decalog / includes / features / class-inlinehelp.php

class-inlinehelp.php in DecaLog 3.0.2, at includes/features/class-inlinehelp.php

516 lines 22.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * DecaLog inline help
4 *
5 * Handles all inline help displays.
6 *
7 * @package Features
8 * @author Pierre Lannoy <https://pierre.lannoy.fr/>.
9 * @since 1.2.0
10 */
11
12 namespace Decalog\Plugin\Feature;
13
14 use Decalog\System\Environment;
15 use Decalog\System\L10n;
16 use Decalog\System\Markdown;
17 use Decalog\System\Role;
18
19 /**
20 * Define the inline help functionality.
21 *
22 * Handles all inline help operations.
23 *
24 * @package Features
25 * @author Pierre Lannoy <https://pierre.lannoy.fr/>.
26 * @since 1.2.0
27 */
28 class InlineHelp {
29
30 /**
31 * The current screen.
32 *
33 * @since 1.2.0
34 * @var WP_Screen $screen The current screen.
35 */
36 private $screen;
37
38 /**
39 * The current tab.
40 *
41 * @since 1.2.0
42 * @var null|string $tab The current tab.
43 */
44 private $tab = null;
45
46 /**
47 * The current log id.
48 *
49 * @since 1.2.0
50 * @var null|string $log_id The log id.
51 */
52 private $log_id = null;
53
54 /**
55 * The current event id.
56 *
57 * @since 1.2.0
58 * @var null|string $event_id The event id.
59 */
60 private $event_id = null;
61
62 /**
63 * The current trace id.
64 *
65 * @since 3.0.0
66 * @var null|string $trace_id The trace id.
67 */
68 private $trace_id = null;
69
70 /**
71 * Initialize the class and set its properties.
72 *
73 * @since 1.2.0
74 */
75 public function __construct() {
76 }
77
78 /**
79 * Initialize the screen and query properties.
80 *
81 * @since 1.2.0
82 */
83 private function init() {
84 $this->screen = get_current_screen();
85 if ( ! ( $this->tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING ) ) ) {
86 $this->tab = filter_input( INPUT_POST, 'tab', FILTER_SANITIZE_STRING );
87 }
88 if ( ! ( $this->log_id = filter_input( INPUT_GET, 'logid', FILTER_SANITIZE_STRING ) ) ) {
89 $this->log_id = filter_input( INPUT_POST, 'logid', FILTER_SANITIZE_STRING );
90 }
91 if ( ! ( $this->event_id = filter_input( INPUT_GET, 'eventid', FILTER_SANITIZE_STRING ) ) ) {
92 $this->event_id = filter_input( INPUT_POST, 'eventid', FILTER_SANITIZE_STRING );
93 }
94 if ( ! ( $this->trace_id = filter_input( INPUT_GET, 'traceid', FILTER_SANITIZE_STRING ) ) ) {
95 $this->trace_id = filter_input( INPUT_POST, 'traceid', FILTER_SANITIZE_STRING );
96 }
97 }
98
99 /**
100 * Displays the sidebar in inline help.
101 *
102 * @since 1.2.0
103 */
104 private function set_sidebar() {
105 $content = '<p><strong>' . esc_html__( 'For more help:', 'decalog' ) . '</strong></p>';
106 $content .= '<p><a href="https://wordpress.org/support/plugin/decalog/">' . esc_html__( 'User support', 'decalog' ) . '</a>' . L10n::get_language_markup( [ 'en' ] ) . '</p>';
107 $content .= '<br/><p><strong>' . __( 'See also:', 'decalog' ) . '</strong></p>';
108 $content .= '<p><a href="https://perfops.one/">' . esc_html__( 'Official website', 'decalog' ) . '</a>' . L10n::get_language_markup( [ 'en' ] ) . '</p>';
109 $content .= '<p><a href="https://github.com/Pierre-Lannoy/wp-decalog">' . esc_html__( 'GitHub repository', 'decalog' ) . '</a>' . L10n::get_language_markup( [ 'en' ] ) . '</p>';
110 $this->screen->set_help_sidebar( $content );
111 }
112
113 /**
114 * Get the level content.
115 *
116 * @return string The content to display about levels and severity.
117 * @since 1.2.0
118 */
119 private function get_levels_content() {
120 $content = '<p>' . sprintf( esc_html__( 'The severity of an event is indicated by a "level". %s uses the following levels classification:', 'decalog' ), DECALOG_PRODUCT_NAME ) . '</p>';
121 foreach ( array_reverse( EventTypes::$level_names ) as $name ) {
122 $icon = '<img style="width:18px;float:left;padding-right:6px;" src="' . EventTypes::$icons[ strtolower( $name ) ] . '" />';
123 $content .= '<p>' . $icon . '<strong>' . ucwords( strtolower( $name ) ) . '</strong> &mdash; ' . EventTypes::$level_texts[ strtolower( $name ) ] . '</p>';
124 }
125 return $content;
126 }
127
128 /**
129 * Get the loggers of a specific class.
130 *
131 * @param string $class The class of loggers ( 'alerting', 'debugging', 'logging').
132 * @return string The content to display about this class of loggers.
133 * @since 1.2.0
134 */
135 private function get_loggers( $class ) {
136 $handlers = new HandlerTypes();
137 $content = '';
138 foreach ( $handlers->get_for_class( $class ) as $handler ) {
139 $icon = '<img style="width:18px;float:left;padding-right:6px;" src="' . $handler['icon'] . '" />';
140 $content .= '<p>' . $icon . '<strong>' . $handler['name'] . '</strong> &mdash; ' . $handler['help'] . '</p>';
141 }
142 return $content;
143 }
144
145 /**
146 * Get the admin rights content.
147 *
148 * @return string The content to display about admin rights.
149 * @since 1.2.0
150 */
151 private function get_admin_rights_content() {
152 $content = '';
153 $content = '<p>' . esc_html__( 'Because your site takes part in a sites network, admin ability to view and configure logs differ as follows:', 'decalog' ) . '</p>';
154 $content .= '<p><strong>' . esc_html_x( 'Network Admin', 'WordPress multisite', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'Can set loggers, can view all items in all WordPress logs.', 'decalog' ) . ( Role::SUPER_ADMIN === Role::admin_type() ? ' <strong><em>' . esc_html__( 'That\'s your current role.', 'decalog' ) . '</em></strong>' : '' ) . '</p>';
155 $content .= '<p><strong>' . esc_html_x( 'Sites Admin', 'WordPress multisite', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'Can\'t set loggers, can only view items regarding their own sites in all authorized WordPress logs.', 'decalog' ) . ( Role::LOCAL_ADMIN === Role::admin_type() ? ' <strong><em>' . esc_html__( 'That\'s your current role.', 'decalog' ) . '</em></strong>' : '' ) . '</p>';
156 return $content;
157 }
158
159 /**
160 * Displays inline help for loggers tab.
161 *
162 * @since 1.2.0
163 */
164 private function set_contextual_settings_loggers() {
165 $tabs = [];
166 // Overview.
167 $content = '<p>' . sprintf( esc_html__( 'This screen allows you to set the %s loggers.', 'decalog' ), DECALOG_PRODUCT_NAME ) . '</p>';
168 $content .= '<p>' . esc_html__( 'A logger is a recorder of events, traces or metrics. It can filter them (accept or refuse to record them based on settings) then store them or send them to external services.', 'decalog' );
169 $content .= ' ' . esc_html__( 'You can set as many loggers as you want. All the set loggers will receive all events, traces or metrics (depending of their types) and, regarding their own settings, will enrich them and record them or not.', 'decalog' ) . '</p>';
170 $content .= '<p>' . esc_html__( 'Loggers are classified in six main categories: alerting, debugging, crash analytics, events logging, monitoring and tracing. You can find details on these categories on the corresponding tabs of this help.', 'decalog' ) . '</p>';
171 $tabs[] = [
172 'title' => esc_html__( 'Overview', 'decalog' ),
173 'id' => 'decalog-contextual-settings-loggers-overview',
174 'content' => $content,
175 ];
176 // Alerting.
177 $content = '<p>' . esc_html__( 'These loggers allow you to send event-based alerts:', 'decalog' ) . '</p>';
178 $tabs[] = [
179 'title' => esc_html__( 'Alerting', 'decalog' ),
180 'id' => 'decalog-contextual-settings-loggers-alerting',
181 'content' => $content . $this->get_loggers( 'alerting' ),
182 ];
183 // Debugging.
184 $content = '<p>' . esc_html__( 'These loggers can help you to debug your site:', 'decalog' ) . '</p>';
185 $tabs[] = [
186 'title' => esc_html__( 'Debugging', 'decalog' ),
187 'id' => 'decalog-contextual-settings-loggers-debugging',
188 'content' => $content . $this->get_loggers( 'debugging' ),
189 ];
190 // Crash.
191 $content = '<p>' . esc_html__( 'These loggers capture crashes and send reports for crash analytics purpose:', 'decalog' ) . '</p>';
192 $tabs[] = [
193 'title' => esc_html__( 'Crash Analytics', 'decalog' ),
194 'id' => 'decalog-contextual-settings-loggers-analytics',
195 'content' => $content . $this->get_loggers( 'analytics' ),
196 ];
197 // Logging.
198 $content = '<p>' . esc_html__( 'These loggers capture events for logging purpose:', 'decalog' ) . '</p>';
199 $tabs[] = [
200 'title' => esc_html__( 'Events Logging', 'decalog' ),
201 'id' => 'decalog-contextual-settings-loggers-logging',
202 'content' => $content . $this->get_loggers( 'logging' ),
203 ];
204 // Monitoring.
205 $content = '<p>' . esc_html__( 'These loggers collect metrics', 'decalog' ) . '</p>';
206 $tabs[] = [
207 'title' => esc_html__( 'Monitoring', 'decalog' ),
208 'id' => 'decalog-contextual-settings-loggers-monitoring',
209 'content' => $content . $this->get_loggers( 'metrics' ),
210 ];
211 // Tracing.
212 $content = '<p>' . esc_html__( 'These loggers capture traces:', 'decalog' ) . '</p>';
213 $tabs[] = [
214 'title' => esc_html__( 'Tracing', 'decalog' ),
215 'id' => 'decalog-contextual-settings-loggers-tracing',
216 'content' => $content . $this->get_loggers( 'tracing' ),
217 ];
218
219 // Admin Rights.
220 if ( Role::SUPER_ADMIN === Role::admin_type() || Role::LOCAL_ADMIN === Role::admin_type() ) {
221 $tabs[] = [
222 'title' => esc_html__( 'Admin rights', 'decalog' ),
223 'id' => 'decalog-contextual-settings-loggers-rights',
224 'content' => $this->get_admin_rights_content(),
225 ];
226 }
227 // Levels.
228 $tabs[] = [
229 'title' => esc_html__( 'Events levels', 'decalog' ),
230 'id' => 'decalog-contextual-settings-loggers-levels',
231 'content' => $this->get_levels_content(),
232 ];
233 foreach ( $tabs as $tab ) {
234 $this->screen->add_help_tab( $tab );
235 }
236 $this->set_sidebar();
237 }
238
239 /**
240 * Displays inline help for listeners tab.
241 *
242 * @since 1.2.0
243 */
244 private function set_contextual_settings_listeners() {
245 $tabs = [];
246 // Overview.
247 $content = '<p>' . sprintf( esc_html__( 'This screen allows you to set the way %s uses listeners.', 'decalog' ), DECALOG_PRODUCT_NAME ) . '</p>';
248 $content .= '<p>' . esc_html__( 'A listener, as its name suggests, listen to a specific component (a "source") of your WordPress instance.', 'decalog' );
249 $content .= ' ' . sprintf( esc_html__( 'You can choose to tell %s to activate all the available listeners, or you can manually select the sources to listen.', 'decalog' ), DECALOG_PRODUCT_NAME ) . '</p>';
250 $tabs[] = [
251 'title' => esc_html__( 'Overview', 'decalog' ),
252 'id' => 'decalog-contextual-settings-listeners-overview',
253 'content' => $content,
254 ];
255 // Admin Rights.
256 if ( Role::SUPER_ADMIN === Role::admin_type() || Role::LOCAL_ADMIN === Role::admin_type() ) {
257 $tabs[] = [
258 'title' => esc_html__( 'Admin rights', 'decalog' ),
259 'id' => 'decalog-contextual-settings-listeners-rights',
260 'content' => $this->get_admin_rights_content(),
261 ];
262 }
263 foreach ( $tabs as $tab ) {
264 $this->screen->add_help_tab( $tab );
265 }
266 $this->set_sidebar();
267 }
268
269 /**
270 * Displays inline help for options tab.
271 *
272 * @since 1.2.0
273 */
274 private function set_contextual_settings_options() {
275 $tabs = [];
276 // Overview.
277 $content = '<p>' . sprintf( esc_html__( 'This screen allows you to set misc options of %s.', 'decalog' ), DECALOG_PRODUCT_NAME ) . '</p>';
278 if ( Environment::is_wordpress_multisite() ) {
279 $content .= '<p><em>' . esc_html__( 'Note these options are global. They are set for all loggers, for all sites in your network.', 'decalog' ) . '</em></p>';
280 } else {
281 $content .= '<p><em>' . esc_html__( 'Note these options are global. They are set for all loggers.', 'decalog' ) . '</em></p>';
282 }
283 $tabs[] = [
284 'title' => esc_html__( 'Overview', 'decalog' ),
285 'id' => 'decalog-contextual-settings-options-overview',
286 'content' => $content,
287 ];
288 // Admin Rights.
289 if ( Role::SUPER_ADMIN === Role::admin_type() || Role::LOCAL_ADMIN === Role::admin_type() ) {
290 $tabs[] = [
291 'title' => esc_html__( 'Admin rights', 'decalog' ),
292 'id' => 'decalog-contextual-settings-options-rights',
293 'content' => $this->get_admin_rights_content(),
294 ];
295 }
296
297 foreach ( $tabs as $tab ) {
298 $this->screen->add_help_tab( $tab );
299 }
300 $this->set_sidebar();
301 }
302
303 /**
304 * Displays inline help for settings pages.
305 *
306 * @since 1.2.0
307 */
308 public function set_contextual_settings() {
309 $this->init();
310 if ( ! isset( $this->tab ) ) {
311 $this->set_contextual_settings_loggers();
312 return;
313 }
314 switch ( strtolower( $this->tab ) ) {
315 case 'loggers':
316 $this->set_contextual_settings_loggers();
317 break;
318 case 'listeners':
319 $this->set_contextual_settings_listeners();
320 break;
321 case 'misc':
322 $this->set_contextual_settings_options();
323 break;
324 }
325 }
326
327 /**
328 * Displays inline help for main viewer page.
329 *
330 * @since 1.2.0
331 */
332 private function set_contextual_viewer_main() {
333 $tabs = [];
334 // Overview.
335 if ( false !== strpos( $this->screen->id, 'page_decalog-viewer' ) ) {
336 $content = '<p>' . esc_html__( 'This screen displays the list of events belonging to a specific WordPress logger. This list is sorted with the most recent event at the top.', 'decalog' ) . '</p>';
337 $content .= '<p>' . esc_html__( 'To move forward or backward in time, use the navigation buttons at the top or bottom right of this list.', 'decalog' ) . '</p>';
338 $content .= '<p>' . esc_html__( 'You can restrict the display of events according to their severity levels. To do so, use the three links at the top left of the list.', 'decalog' ) . '</p>';
339 $content .= '<p>' . esc_html__( 'You can change the events log being viewed (if you have set more than one WordPress logger) with the selector at the top left of the list (don\'t forget to click on the "apply" button).', 'decalog' ) . '</p>';
340 $content .= '<p>' . esc_html__( 'To filter the displayed events, use the small blue funnel next to the filterable items. These filters are cumulative, you can activate simultaneously several filters.', 'decalog' ) . '<br/>';
341 $content .= '<em>' . esc_html__( 'Note these filters are effective even on pseudonymized or obfuscated fields.', 'decalog' ) . '</em></p>';
342 $tabs[] = [
343 'title' => esc_html__( 'Overview', 'decalog' ),
344 'id' => 'decalog-contextual-viewer-main-overview',
345 'content' => $content,
346 ];
347 }
348 if ( false !== strpos( $this->screen->id, 'page_decalog-tviewer' ) ) {
349 $content = '<p>' . esc_html__( 'This screen displays the list of traces belonging to a specific WordPress logger. This list is sorted with the most recent trace at the top.', 'decalog' ) . '</p>';
350 $content .= '<p>' . esc_html__( 'To move forward or backward in time, use the navigation buttons at the top or bottom right of this list.', 'decalog' ) . '</p>';
351 $content .= '<p>' . esc_html__( 'You can change the traces log being viewed (if you have set more than one WordPress logger) with the selector at the top left of the list (don\'t forget to click on the "apply" button).', 'decalog' ) . '</p>';
352 $content .= '<p>' . esc_html__( 'To filter the displayed traces, use the small blue funnel next to the filterable items. These filters are cumulative, you can activate simultaneously several filters.', 'decalog' ) . '<br/>';
353 $content .= '<em>' . esc_html__( 'Note these filters are effective even on pseudonymized or obfuscated fields.', 'decalog' ) . '</em></p>';
354 $tabs[] = [
355 'title' => esc_html__( 'Overview', 'decalog' ),
356 'id' => 'decalog-contextual-viewer-main-overview',
357 'content' => $content,
358 ];
359 }
360 // Admin Rights.
361 if ( Role::SUPER_ADMIN === Role::admin_type() || Role::LOCAL_ADMIN === Role::admin_type() ) {
362 $tabs[] = [
363 'title' => esc_html__( 'Admin rights', 'decalog' ),
364 'id' => 'decalog-contextual-viewer-main-rights',
365 'content' => $this->get_admin_rights_content(),
366 ];
367 }
368 // Levels.
369 if ( false !== strpos( $this->screen->id, 'page_decalog-viewer' ) ) {
370 $tabs[] = [
371 'title' => esc_html__( 'Events levels', 'decalog' ),
372 'id' => 'decalog-contextual-viewer-main-levels',
373 'content' => $this->get_levels_content(),
374 ];
375 }
376 foreach ( $tabs as $tab ) {
377 $this->screen->add_help_tab( $tab );
378 }
379 $this->set_sidebar();
380 }
381
382 /**
383 * Displays inline help for event screen.
384 *
385 * @since 1.2.0
386 */
387 private function set_contextual_viewer_event() {
388 $tabs = [];
389 // Overview.
390 $content = '<p>' . esc_html__( 'This screen displays the details of a specific event.', 'decalog' ) . ' ' . esc_html__( 'It consists of four to six boxes, depending on your settings, which give specific details of the event:', 'decalog' ) . '</p>';
391 $content .= '<p><strong>' . esc_html__( 'Event', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'General information about the event.', 'decalog' ) . '</p>';
392 $content .= '<p><strong>' . esc_html__( 'Content', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'Event code and message.', 'decalog' ) . '</p>';
393 $content .= '<p><strong>WordPress</strong> &mdash; ' . esc_html__( 'User and site where the event occurs.', 'decalog' ) . '</p>';
394 $content .= '<p><strong>' . esc_html__( 'HTTP request', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'The detail of the request that led to this event.', 'decalog' ) . '</p>';
395 $content .= '<p><strong>' . esc_html__( 'PHP introspection', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'The code location where this event was generated.', 'decalog' ) . '</p>';
396 /* translators: like in the sentence "PHP backtrace" or "WordPress backtrace" */
397 $content .= '<p><strong>' . sprintf( esc_html__( '%s backtrace', 'decalog' ), 'PHP' ) . ' / ' . sprintf( esc_html__( '%s backtrace', 'decalog' ), 'WordPress' ) . '</strong> &mdash; ' . esc_html__( 'Two different views of the same information: the backtrace of the call that led to this event.', 'decalog' ) . '</p>';
398 $tabs[] = [
399 'title' => esc_html__( 'Overview', 'decalog' ),
400 'id' => 'decalog-contextual-viewer-event-overview',
401 'content' => $content,
402 ];
403 // Layout.
404 $content = '<p>' . esc_html__( 'You can use the following controls to arrange the screen to suit your usage preferences:', 'decalog' ) . '</p>';
405 $content .= '<p><strong>' . esc_html__( 'Screen Options', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'Use the Screen Options tab to choose which boxes to show.', 'decalog' ) . '</p>';
406 $content .= '<p><strong>' . esc_html__( 'Drag and Drop', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.', 'decalog' ) . '</p>';
407 $content .= '<p><strong>' . esc_html__( 'Box Controls', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'Click the title bar of the box to expand or collapse it.', 'decalog' ) . '</p>';
408 $tabs[] = [
409 'title' => esc_html__( 'Layout', 'decalog' ),
410 'id' => 'decalog-contextual-viewer-event-layout',
411 'content' => $content,
412 ];
413 // Levels.
414 $tabs[] = [
415 'title' => esc_html__( 'Events levels', 'decalog' ),
416 'id' => 'decalog-contextual-viewer-event-levels',
417 'content' => $this->get_levels_content(),
418 ];
419 foreach ( $tabs as $tab ) {
420 $this->screen->add_help_tab( $tab );
421 }
422 $this->set_sidebar();
423 }
424
425 /**
426 * Displays inline help for event screen.
427 *
428 * @since 3.0.0
429 */
430 private function set_contextual_viewer_trace() {
431 $tabs = [];
432 // Overview.
433 $content = '<p>' . esc_html__( 'This screen displays the details of a specific trace.', 'decalog' ) . ' ' . esc_html__( 'It consists of three boxes which give specific details of the trace:', 'decalog' ) . '</p>';
434 $content .= '<p><strong>' . esc_html__( 'Trace', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'General information about the trace.', 'decalog' ) . '</p>';
435 $content .= '<p><strong>WordPress</strong> &mdash; ' . esc_html__( 'User and site where the trace has been captured.', 'decalog' ) . '</p>';
436 $content .= '<p><strong>' . esc_html__( 'Spans', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'Spans composing the trace in a timeline. Note: the alternative grey/white graduations correspond to 250 ms.', 'decalog' ) . '</p>';
437 $tabs[] = [
438 'title' => esc_html__( 'Overview', 'decalog' ),
439 'id' => 'decalog-contextual-viewer-trace-overview',
440 'content' => $content,
441 ];
442 // Layout.
443 $content = '<p>' . esc_html__( 'You can use the following controls to arrange the screen to suit your usage preferences:', 'decalog' ) . '</p>';
444 $content .= '<p><strong>' . esc_html__( 'Screen Options', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'Use the Screen Options tab to choose which boxes to show.', 'decalog' ) . '</p>';
445 $content .= '<p><strong>' . esc_html__( 'Drag and Drop', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.', 'decalog' ) . '</p>';
446 $content .= '<p><strong>' . esc_html__( 'Box Controls', 'decalog' ) . '</strong> &mdash; ' . esc_html__( 'Click the title bar of the box to expand or collapse it.', 'decalog' ) . '</p>';
447 $tabs[] = [
448 'title' => esc_html__( 'Layout', 'decalog' ),
449 'id' => 'decalog-contextual-viewer-trace-layout',
450 'content' => $content,
451 ];
452 foreach ( $tabs as $tab ) {
453 $this->screen->add_help_tab( $tab );
454 }
455 $this->set_sidebar();
456 }
457
458 /**
459 * Displays inline help for viewer pages.
460 *
461 * @since 1.2.0
462 */
463 public function set_contextual_viewer() {
464 $this->init();
465 if ( isset( $this->event_id ) ) {
466 $this->set_contextual_viewer_event();
467 return;
468 }
469 if ( isset( $this->trace_id ) ) {
470 $this->set_contextual_viewer_trace();
471 return;
472 }
473 $this->set_contextual_viewer_main();
474 }
475
476 /**
477 * Get the logging description.
478 *
479 * @param array $attributes 'style' => 'markdown', 'html'.
480 * 'mode' => 'raw', 'clean'.
481 * @return string The output of the shortcode, ready to print.
482 * @since 1.0.0
483 */
484 public function sc_get_logging( $attributes ) {
485 $md = new Markdown();
486 return $md->get_shortcode( 'LOGGING.md', $attributes );
487 }
488
489 /**
490 * Get the monitoring description.
491 *
492 * @param array $attributes 'style' => 'markdown', 'html'.
493 * 'mode' => 'raw', 'clean'.
494 * @return string The output of the shortcode, ready to print.
495 * @since 1.0.0
496 */
497 public function sc_get_monitoring( $attributes ) {
498 $md = new Markdown();
499 return $md->get_shortcode( 'MONITORING.md', $attributes );
500 }
501
502 /**
503 * Get the tracing description.
504 *
505 * @param array $attributes 'style' => 'markdown', 'html'.
506 * 'mode' => 'raw', 'clean'.
507 * @return string The output of the shortcode, ready to print.
508 * @since 1.0.0
509 */
510 public function sc_get_tracing( $attributes ) {
511 $md = new Markdown();
512 return $md->get_shortcode( 'TRACING.md', $attributes );
513 }
514
515 }
516