|
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 Logs 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 _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 printf( __( '<a href="%s">Email Logs</a>', 'email-log' ), 'admin.php?page=email-log' ); ?> <span style="color: #ddd"> | </span></li> |
|
58
|
|
|
<li><?php printf( __( '<a href="%s">Settings</a>', 'email-log' ), 'admin.php?page=email-log-settings' ); ?> <span style="color: #ddd"> | </span></li> |
|
59
|
|
|
<li><?php printf( __( '<a href="%s">Addons</a>', 'email-log' ), 'admin.php?page=email-log-addons' ); ?></li> |
|
60
|
|
|
</ul> |
|
61
|
|
|
|
|
62
|
|
|
<?php |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|