PluginProbe
Email Log / trunk
Email Log vtrunk
2.63 2.4.8 2.4.9 2.6 2.61 2.62 trunk 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.8.1 0.9 0.9.1 0.9.2 1.1 1.5 1.5.1 1.5.2 1.5.3 1.5.4 All 61 releases
email-log / include / Core / UI / Component / DashboardWidget.php

DashboardWidget.php in Email Log trunk, at include/Core/UI/Component/DashboardWidget.php

68 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace EmailLog\Core\UI\Component;
2
3 use EmailLog\Core\Loadie;
4
5 defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
6
7 /*
8 * Widget that displays email log information in dashboard.
9 *
10 * @since 2.2.0
11 */
12 class DashboardWidget implements Loadie {
13
14 /**
15 * Setup hooks.
16 *
17 * @inheritdoc
18 */
19 public function load() {
20 add_action( 'wp_dashboard_setup', array( $this, 'register' ) );
21 }
22
23 /**
24 * Adds the dashboard widget to display Email Log activity.
25 */
26 public function register() {
27 wp_add_dashboard_widget(
28 'email_log_dashboard_widget',
29 __( 'Email Log Summary', 'email-log' ),
30 array( $this, 'render' )
31 );
32 }
33
34 /**
35 * Outputs the contents on the Dashboard Widget.
36 */
37 public function render() {
38 $email_log = email_log();
39 $logs_count = $email_log->table_manager->get_logs_count();
40 ?>
41
42 <p>
43 <?php esc_html_e( 'Total number of emails logged' , 'email-log' ); ?>: <strong><?php echo number_format( absint( $logs_count ), 0, ',', ',' ); ?></strong>
44 </p>
45
46 <?php
47 /**
48 * Triggered just after printing the content of the dashboard widget.
49 * Use this hook to add custom messages to the dashboard widget.
50 *
51 * @since 2.4.0
52 */
53 do_action( 'el_inside_dashboard_widget' );
54 ?>
55
56 <ul class="subsubsub" style="float: none">
57 <li><?php
58 /* translators: %s email logs page link */
59 \EmailLog\Core\EmailLog::wp_kses_wf(sprintf(__( '<a href="%s">View Logs</a>', 'email-log' ), 'admin.php?page=email-log' )); ?> <span style="color: #ddd"> | </span></li>
60 <li><?php
61 /* translators: %s settings page link */
62 \EmailLog\Core\EmailLog::wp_kses_wf(sprintf(__( '<a href="%s">Settings</a>', 'email-log' ), 'admin.php?page=email-log-settings' )); ?> <span style="color: #ddd"> | </span></li>
63 </ul>
64
65 <?php
66 }
67 }
68