Version Description
Added a Dashboard Widget that display summary information about email logs.
Download this release
Release Info
Developer | sudar |
Plugin | Email Log |
Version | 2.2.0 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.2.0
- email-log.php +1 -1
- include/Addon/API/EDDUpdater.php +19 -0
- include/Addon/AddonList.php +1 -1
- include/Core/DB/TableManager.php +16 -3
- include/Core/EmailLog.php +1 -1
- include/Core/UI/Component/DashboardWidget.php +54 -0
- include/Core/UI/UILoader.php +1 -0
- languages/email-log.pot +29 -3
- readme.txt +9 -2
email-log.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Logs every email sent through WordPress
|
6 |
* Donate Link: http://sudarmuthu.com/if-you-wanna-thank-me
|
7 |
* Author: Sudar
|
8 |
-
* Version: 2.
|
9 |
* Author URI: http://sudarmuthu.com/
|
10 |
* Text Domain: email-log
|
11 |
* Domain Path: languages/
|
5 |
* Description: Logs every email sent through WordPress
|
6 |
* Donate Link: http://sudarmuthu.com/if-you-wanna-thank-me
|
7 |
* Author: Sudar
|
8 |
+
* Version: 2.2.0
|
9 |
* Author URI: http://sudarmuthu.com/
|
10 |
* Text Domain: email-log
|
11 |
* Domain Path: languages/
|
include/Addon/API/EDDUpdater.php
CHANGED
@@ -36,6 +36,25 @@ class EDDUpdater extends \EDD_SL_Plugin_Updater {
|
|
36 |
parent::__construct( $_api_url, $_plugin_file, $_api_data );
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* Get add-on slug.
|
41 |
*
|
36 |
parent::__construct( $_api_url, $_plugin_file, $_api_data );
|
37 |
}
|
38 |
|
39 |
+
/**
|
40 |
+
* Overridden to disable `check_update` on the add-ons that are not installed.
|
41 |
+
*
|
42 |
+
* @inheritdoc
|
43 |
+
*
|
44 |
+
* @since 2.2.0
|
45 |
+
*/
|
46 |
+
public function init() {
|
47 |
+
parent::init();
|
48 |
+
|
49 |
+
$installed_plugins = array_keys( get_plugins() );
|
50 |
+
|
51 |
+
if ( in_array( $this->addon_slug, $installed_plugins, true ) ) {
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
|
55 |
+
remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
56 |
+
}
|
57 |
+
|
58 |
/**
|
59 |
* Get add-on slug.
|
60 |
*
|
include/Addon/AddonList.php
CHANGED
@@ -188,7 +188,7 @@ class AddonList {
|
|
188 |
* @return string API URL.
|
189 |
*/
|
190 |
protected function get_api_url() {
|
191 |
-
return $this->store_url . '/
|
192 |
}
|
193 |
|
194 |
/**
|
188 |
* @return string API URL.
|
189 |
*/
|
190 |
protected function get_api_url() {
|
191 |
+
return $this->store_url . '/json/products.json';
|
192 |
}
|
193 |
|
194 |
/**
|
include/Core/DB/TableManager.php
CHANGED
@@ -145,7 +145,7 @@ class TableManager implements Loadie {
|
|
145 |
global $wpdb;
|
146 |
$table_name = $this->get_log_table_name();
|
147 |
|
148 |
-
$query
|
149 |
$deleted_rows_count = $wpdb->query( $query );
|
150 |
|
151 |
return $deleted_rows_count;
|
@@ -195,7 +195,7 @@ class TableManager implements Loadie {
|
|
195 |
|
196 |
if ( isset( $request['s'] ) && $request['s'] !== '' ) {
|
197 |
$search_term = trim( esc_sql( $request['s'] ) );
|
198 |
-
$query_cond
|
199 |
}
|
200 |
|
201 |
if ( isset( $request['d'] ) && $request['d'] !== '' ) {
|
@@ -221,7 +221,7 @@ class TableManager implements Loadie {
|
|
221 |
|
222 |
// Adjust the query to take pagination into account.
|
223 |
if ( ! empty( $current_page_no ) && ! empty( $per_page ) ) {
|
224 |
-
$offset
|
225 |
$query_cond .= ' LIMIT ' . (int) $offset . ',' . (int) $per_page;
|
226 |
}
|
227 |
|
@@ -264,4 +264,17 @@ class TableManager implements Loadie {
|
|
264 |
add_option( self::DB_OPTION_NAME, self::DB_VERSION );
|
265 |
}
|
266 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
}
|
145 |
global $wpdb;
|
146 |
$table_name = $this->get_log_table_name();
|
147 |
|
148 |
+
$query = $wpdb->prepare( "DELETE FROM {$table_name} WHERE sent_date < DATE_SUB( CURDATE(), INTERVAL %d DAY )", $interval_in_days );
|
149 |
$deleted_rows_count = $wpdb->query( $query );
|
150 |
|
151 |
return $deleted_rows_count;
|
195 |
|
196 |
if ( isset( $request['s'] ) && $request['s'] !== '' ) {
|
197 |
$search_term = trim( esc_sql( $request['s'] ) );
|
198 |
+
$query_cond .= " WHERE ( to_email LIKE '%$search_term%' OR subject LIKE '%$search_term%' ) ";
|
199 |
}
|
200 |
|
201 |
if ( isset( $request['d'] ) && $request['d'] !== '' ) {
|
221 |
|
222 |
// Adjust the query to take pagination into account.
|
223 |
if ( ! empty( $current_page_no ) && ! empty( $per_page ) ) {
|
224 |
+
$offset = ( $current_page_no - 1 ) * $per_page;
|
225 |
$query_cond .= ' LIMIT ' . (int) $offset . ',' . (int) $per_page;
|
226 |
}
|
227 |
|
264 |
add_option( self::DB_OPTION_NAME, self::DB_VERSION );
|
265 |
}
|
266 |
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Get the total number of email logs.
|
270 |
+
*
|
271 |
+
* @return int Total email log count
|
272 |
+
*/
|
273 |
+
public function get_logs_count() {
|
274 |
+
global $wpdb;
|
275 |
+
|
276 |
+
$query = 'SELECT count(*) FROM ' . $this->get_log_table_name();
|
277 |
+
|
278 |
+
return $wpdb->get_var( $query );
|
279 |
+
}
|
280 |
}
|
include/Core/EmailLog.php
CHANGED
@@ -16,7 +16,7 @@ class EmailLog {
|
|
16 |
* @since Genesis
|
17 |
* @var string
|
18 |
*/
|
19 |
-
const VERSION = '2.
|
20 |
|
21 |
/**
|
22 |
* Email Log Store URL.
|
16 |
* @since Genesis
|
17 |
* @var string
|
18 |
*/
|
19 |
+
const VERSION = '2.2.0';
|
20 |
|
21 |
/**
|
22 |
* Email Log Store URL.
|
include/Core/UI/Component/DashboardWidget.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 absint( $logs_count ); ?></strong>
|
44 |
+
</p>
|
45 |
+
|
46 |
+
<ul class="subsubsub" style="float: none">
|
47 |
+
<li><?php printf( __( '<a href="%s">Email Logs</a>', 'email-log' ), 'admin.php?page=email-log' ); ?> <span style="color: #ddd"> | </span></li>
|
48 |
+
<li><?php printf( __( '<a href="%s">Settings</a>', 'email-log' ), 'admin.php?page=email-log-settings' ); ?> <span style="color: #ddd"> | </span></li>
|
49 |
+
<li><?php printf( __( '<a href="%s">Addons</a>', 'email-log' ), 'admin.php?page=email-log-addons' ); ?></li>
|
50 |
+
</ul>
|
51 |
+
|
52 |
+
<?php
|
53 |
+
}
|
54 |
+
}
|
include/Core/UI/UILoader.php
CHANGED
@@ -54,6 +54,7 @@ class UILoader implements Loadie {
|
|
54 |
protected function initialize_components() {
|
55 |
$this->components['admin_ui_enhancer'] = new Component\AdminUIEnhancer();
|
56 |
$this->components['core_settings'] = new Setting\CoreSetting();
|
|
|
57 |
}
|
58 |
|
59 |
/**
|
54 |
protected function initialize_components() {
|
55 |
$this->components['admin_ui_enhancer'] = new Component\AdminUIEnhancer();
|
56 |
$this->components['core_settings'] = new Setting\CoreSetting();
|
57 |
+
$this->components['dashboard_widget'] = new Component\DashboardWidget();
|
58 |
}
|
59 |
|
60 |
/**
|
languages/email-log.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the Email Log package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Email Log 2.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/email-log\n"
|
7 |
-
"POT-Creation-Date: 2017-09
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -275,6 +275,20 @@ msgstr ""
|
|
275 |
msgid "by"
|
276 |
msgstr ""
|
277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
#: dist/include/Core/UI/ListTable/LogListTable.php:49
|
279 |
#: include/Core/UI/ListTable/LogListTable.php:49
|
280 |
msgid "Additional fields are available in Pro add-on. "
|
@@ -401,7 +415,7 @@ msgstr ""
|
|
401 |
msgid "Support"
|
402 |
msgstr ""
|
403 |
|
404 |
-
#. #-#-#-#-# email-log.pot (Email Log 2.
|
405 |
#. Plugin Name of the plugin/theme
|
406 |
#: dist/include/Core/UI/Page/LogListPage.php:57
|
407 |
#: dist/include/Core/UI/Page/LogListPage.php:58
|
@@ -510,6 +524,18 @@ msgstr ""
|
|
510 |
msgid "Error"
|
511 |
msgstr ""
|
512 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
#: tmp_addon/AutoDeleteLogsSetting.php:15
|
514 |
msgid "Auto Delete Logs Add-on Settings"
|
515 |
msgstr ""
|
2 |
# This file is distributed under the same license as the Email Log package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Email Log 2.2.0\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/email-log\n"
|
7 |
+
"POT-Creation-Date: 2017-10-09 14:20:46+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
275 |
msgid "by"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: dist/include/Core/UI/Component/DashboardWidget.php:29
|
279 |
+
#: include/Core/UI/Component/DashboardWidget.php:29
|
280 |
+
msgid "Email Logs Summary"
|
281 |
+
msgstr ""
|
282 |
+
|
283 |
+
#: dist/include/Core/UI/Component/DashboardWidget.php:43
|
284 |
+
#: include/Core/UI/Component/DashboardWidget.php:43
|
285 |
+
msgid "Total number of emails logged"
|
286 |
+
msgstr ""
|
287 |
+
|
288 |
+
#: dist/include/Core/UI/Component/DashboardWidget.php:47
|
289 |
+
msgid "<a href=\"%s\">Click here</a> to view Email Logs."
|
290 |
+
msgstr ""
|
291 |
+
|
292 |
#: dist/include/Core/UI/ListTable/LogListTable.php:49
|
293 |
#: include/Core/UI/ListTable/LogListTable.php:49
|
294 |
msgid "Additional fields are available in Pro add-on. "
|
415 |
msgid "Support"
|
416 |
msgstr ""
|
417 |
|
418 |
+
#. #-#-#-#-# email-log.pot (Email Log 2.2.0) #-#-#-#-#
|
419 |
#. Plugin Name of the plugin/theme
|
420 |
#: dist/include/Core/UI/Page/LogListPage.php:57
|
421 |
#: dist/include/Core/UI/Page/LogListPage.php:58
|
524 |
msgid "Error"
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: include/Core/UI/Component/DashboardWidget.php:47
|
528 |
+
msgid "<a href=\"%s\">Email Logs</a>"
|
529 |
+
msgstr ""
|
530 |
+
|
531 |
+
#: include/Core/UI/Component/DashboardWidget.php:48
|
532 |
+
msgid "<a href=\"%s\">Settings</a>"
|
533 |
+
msgstr ""
|
534 |
+
|
535 |
+
#: include/Core/UI/Component/DashboardWidget.php:49
|
536 |
+
msgid "<a href=\"%s\">Addons</a>"
|
537 |
+
msgstr ""
|
538 |
+
|
539 |
#: tmp_addon/AutoDeleteLogsSetting.php:15
|
540 |
msgid "Auto Delete Logs Add-on Settings"
|
541 |
msgstr ""
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: sudar
|
|
3 |
Tags: email, log, log email, resend email, multisite
|
4 |
Requires PHP: 5.3
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
Log and view all outgoing emails from WordPress. Works with WordPress Multisite as well.
|
10 |
|
@@ -115,6 +115,10 @@ Meanwhile, I have added a hack to handle this condition in v1.7.3 of my plugin.
|
|
115 |
This Readme file was generated using <a href = 'http://sudarmuthu.com/wordpress/wp-readme'>wp-readme</a>, which generates readme files for WordPress Plugins.
|
116 |
== Changelog ==
|
117 |
|
|
|
|
|
|
|
|
|
118 |
= v2.1.0 - (2017-09-21) =
|
119 |
- New: GUI option to choose the user roles that can access email logs.
|
120 |
- New: GUI option to delete email log table when the plugin is uninstalled.
|
@@ -270,6 +274,9 @@ This Readme file was generated using <a href = 'http://sudarmuthu.com/wordpress/
|
|
270 |
|
271 |
== Upgrade Notice ==
|
272 |
|
|
|
|
|
|
|
273 |
= 2.1.0 =
|
274 |
GUI option to choose who can access email logs and performance improvements.
|
275 |
|
3 |
Tags: email, log, log email, resend email, multisite
|
4 |
Requires PHP: 5.3
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 2.2.0
|
8 |
|
9 |
Log and view all outgoing emails from WordPress. Works with WordPress Multisite as well.
|
10 |
|
115 |
This Readme file was generated using <a href = 'http://sudarmuthu.com/wordpress/wp-readme'>wp-readme</a>, which generates readme files for WordPress Plugins.
|
116 |
== Changelog ==
|
117 |
|
118 |
+
= v2.2.0 - (2017-10-09) =
|
119 |
+
- New: Dashboard Widget that display summary about email logs.
|
120 |
+
- Tweak: Performance improvements in add-on license code.
|
121 |
+
|
122 |
= v2.1.0 - (2017-09-21) =
|
123 |
- New: GUI option to choose the user roles that can access email logs.
|
124 |
- New: GUI option to delete email log table when the plugin is uninstalled.
|
274 |
|
275 |
== Upgrade Notice ==
|
276 |
|
277 |
+
= 2.2.0 =
|
278 |
+
Added a Dashboard Widget that display summary information about email logs.
|
279 |
+
|
280 |
= 2.1.0 =
|
281 |
GUI option to choose who can access email logs and performance improvements.
|
282 |
|