Email Log - Version 1.8

Version Description

Added support for resending emails through addon

Download this release

Release Info

Developer sudar
Plugin Icon 128x128 Email Log
Version 1.8
Comparing to
See all releases

Code changes from version 1.7.5 to 1.8

email-log.php CHANGED
@@ -1,34 +1,31 @@
1
  <?php
2
  /**
3
- Plugin Name: Email Log
4
- Plugin URI: http://sudarmuthu.com/wordpress/email-log
5
- Description: Logs every email sent through WordPress
6
- Donate Link: http://sudarmuthu.com/if-you-wanna-thank-me
7
- Author: Sudar
8
- Version: 1.7.5
9
- Author URI: http://sudarmuthu.com/
10
- Text Domain: email-log
11
- Domain Path: languages/
12
-
13
- === RELEASE NOTES ===
14
- Check readme file for full release notes
15
- */
16
-
17
- /** Copyright 2009 Sudar Muthu (email : sudar@sudarmuthu.com)
18
-
19
- This program is free software; you can redistribute it and/or modify
20
- it under the terms of the GNU General Public License, version 2, as
21
- published by the Free Software Foundation.
22
-
23
- This program is distributed in the hope that it will be useful,
24
- but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- GNU General Public License for more details.
27
-
28
- You should have received a copy of the GNU General Public License
29
- along with this program; if not, write to the Free Software
30
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31
- */
32
 
33
  /**
34
  * Plugin Root File
@@ -36,319 +33,333 @@ Check readme file for full release notes
36
  * @since 1.7.2
37
  */
38
  if ( ! defined( 'EMAIL_LOG_PLUGIN_FILE' ) ) {
39
- define( 'EMAIL_LOG_PLUGIN_FILE', __FILE__ );
40
  }
41
 
42
  // handle installation and table creation
43
- require_once dirname( __FILE__ ) . '/include/install.php';
44
 
45
  /**
46
  * The main Plugin class
47
  */
48
  class EmailLog {
 
49
 
50
  private $admin_screen;
51
 
52
- const VERSION = '1.7.5';
53
- const FILTER_NAME = 'wp_mail_log';
54
- const PAGE_SLUG = 'email-log';
55
- const DELETE_LOG_NONCE_FIELD = 'sm-delete-email-log-nonce';
56
- const DELETE_LOG_ACTION = 'sm-delete-email-log';
57
-
58
- // DB stuff
59
- const TABLE_NAME = 'email_log'; /* Database table name */
60
- const DB_OPTION_NAME = 'email-log-db'; /* Database option name */
61
- const DB_VERSION = '0.1'; /* Database version */
62
-
63
- // JS Stuff
64
- const JS_HANDLE = 'email-log';
65
-
66
- //hooks
67
- const HOOK_LOG_COLUMNS = 'email_log_manage_log_columns';
68
- const HOOK_LOG_DISPLAY_COLUMNS = 'email_log_display_log_columns';
69
-
70
- /**
71
- * Initialize the plugin by registering the hooks
72
- */
73
- function __construct() {
74
- // Load localization domain
75
- $this->translations = dirname(plugin_basename(__FILE__)) . '/languages/' ;
76
- load_plugin_textdomain( 'email-log', false, $this->translations );
77
-
78
- // Register hooks
79
- add_action( 'admin_menu', array( $this, 'register_settings_page' ) );
80
-
81
- // Register Filter
82
- add_filter( 'wp_mail', array( $this, 'log_email' ) );
83
- add_filter( 'set-screen-option', array( $this, 'save_screen_options' ), 10, 3 );
84
- add_filter( 'plugin_row_meta', array( $this, 'add_plugin_links' ), 10, 2 );
85
-
86
- $plugin = plugin_basename(__FILE__);
87
- add_filter( "plugin_action_links_$plugin", array( $this, 'add_action_links' ) );
88
-
89
- //Add our ajax call
90
- add_action( 'wp_ajax_display_content', array( $this, 'display_content_callback' ) );
91
- }
92
-
93
- /**
94
- * Adds additional links in the Plugin listing. Based on http://zourbuth.com/archives/751/creating-additional-wordpress-plugin-links-row-meta/
95
- */
96
- function add_plugin_links($links, $file) {
97
- $plugin = plugin_basename(__FILE__);
98
-
99
- if ($file == $plugin) // only for this plugin
100
- return array_merge( $links,
101
- array( '<a href="http://sudarmuthu.com/wordpress/email-log/pro-addons" target="_blank">' . __('Buy Addons', 'email-log') . '</a>' )
102
- );
103
- return $links;
104
- }
105
-
106
- /**
107
- * Register the settings page
108
- */
109
- function register_settings_page() {
110
- //Save the handle to your admin page - you'll need it to create a WP_Screen object
111
- $this->admin_page = add_submenu_page( 'tools.php', __('Email Log', 'email-log'), __('Email Log', 'email-log'), 'manage_options', self::PAGE_SLUG , array( &$this, 'display_logs') );
112
-
113
- add_action("load-{$this->admin_page}",array(&$this,'create_settings_panel'));
114
-
115
- // enqueue JavaScript
116
- add_action( 'admin_print_scripts-' . $this->admin_page, array( $this, 'include_js' ) );
117
- }
118
-
119
- /**
120
- * Display email logs
121
- */
122
- function display_logs() {
123
-
124
- $this->logs_table->prepare_items( $this->get_per_page() );
 
 
 
 
 
 
125
  ?>
126
- <div class="wrap">
127
- <h2><?php _e('Email Logs', 'email-log');?></h2>
128
- <?php
129
- if ( isset( $this->logs_deleted ) && $this->logs_deleted != '' ) {
130
- $logs_deleted = intval( $this->logs_deleted );
131
-
132
- if ( $logs_deleted > 0 ) {
133
- echo "<div class = 'updated'><p>" . sprintf( _n( '1 email log deleted.', '%s email logs deleted', $logs_deleted, 'email-log' ), $logs_deleted ) . "</p></div>";
134
- } else {
135
- echo "<div class = 'updated'><p>" . __( 'There was some problem in deleting the email logs' , 'email-log') . "</p></div>";
136
- }
137
- unset($this->logs_deleted);
138
- }
139
  ?>
140
- <form id="email-logs-search" method="get">
141
- <input type="hidden" name="page" value="<?php echo self::PAGE_SLUG; ?>" >
142
  <?php
143
- $this->logs_table->search_box( __('Search Logs', 'email-log'), 'search_id' );
144
  ?>
145
- </form>
146
 
147
- <form id="email-logs-filter" method="get">
148
- <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
149
  <?php
150
- wp_nonce_field( self::DELETE_LOG_ACTION, self::DELETE_LOG_NONCE_FIELD );
151
- $this->logs_table->display();
152
  ?>
153
- </form>
154
- </div>
155
  <?php
156
- // Display credits in Footer
157
- add_action( 'in_admin_footer', array(&$this, 'add_footer_links'));
158
- }
 
 
 
159
 
160
- /**
161
- * Add settings Panel
162
- */
 
 
 
 
163
  function create_settings_panel() {
164
 
165
  /**
166
  * Create the WP_Screen object against your admin page handle
167
  * This ensures we're working with the right admin page
168
  */
169
- $this->admin_screen = WP_Screen::get($this->admin_page);
170
 
171
  /**
172
  * Content specified inline
173
  */
174
  $this->admin_screen->add_help_tab(
175
  array(
176
- 'title' => __('About Plugin', 'email-log'),
177
  'id' => 'about_tab',
178
- 'content' => '<p>' . __('Email Log WordPress Plugin, allows you to log all emails that are sent through WordPress.', 'email-log') . '</p>',
179
- 'callback' => false
180
  )
181
  );
182
 
183
- // Add help sidebar
184
  $this->admin_screen->set_help_sidebar(
185
- '<p><strong>' . __('More information', 'email-log') . '</strong></p>' .
186
- '<p><a href = "http://sudarmuthu.com/wordpress/email-log">' . __('Plugin Homepage/support', 'email-log') . '</a></p>' .
187
- '<p><a href = "http://sudarmuthu.com/blog">' . __("Plugin author's blog", 'email-log') . '</a></p>' .
188
- '<p><a href = "http://sudarmuthu.com/wordpress/">' . __("Other Plugin's by Author", 'email-log') . '</a></p>'
189
- );
190
 
191
- // Add screen options
192
  $this->admin_screen->add_option(
193
  'per_page',
194
  array(
195
- 'label' => __('Entries per page', 'email-log'),
196
  'default' => 20,
197
- 'option' => 'per_page'
198
  )
199
  );
200
 
201
- if(!class_exists('WP_List_Table')){
202
- require_once( ABSPATH . WPINC . '/class-wp-list-table.php' );
203
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
 
205
- if (!class_exists( 'Email_Log_List_Table' ) ) {
206
- require_once dirname( __FILE__ ) . '/include/class-email-log-list-table.php';
207
- }
208
 
209
- //Prepare Table of elements
210
- $this->logs_table = new Email_Log_List_Table();
211
  }
212
 
213
- /**
214
- * Include JavaScript displaying email content.
215
- *
216
- * @since 1.7.5
217
- */
218
- function include_js() {
219
- wp_enqueue_script( self::JS_HANDLE, plugins_url( '/js/email-log.js', __FILE__ ), array( 'jquery' ), self::VERSION, TRUE );
220
- }
221
-
222
- /**
223
- * AJAX callback for displaying email content
224
- *
225
- * @since 1.6
226
- */
227
- function display_content_callback() {
228
- global $wpdb;
229
-
230
- $table_name = $wpdb->prefix . self::TABLE_NAME;
231
- $email_id = absint( $_POST['email_id'] );
232
-
233
- // Select the matching item from the database
234
- $query = $wpdb->prepare( "SELECT * FROM " . $table_name . " WHERE id = %d", $email_id );
235
- $content = $wpdb->get_results( $query );
236
-
237
- // Write the message content to the screen
238
- echo $content[0]->message;
239
-
240
- die(); // this is required to return a proper result
241
- }
242
-
243
- /**
244
- * Save Screen option.
245
- */
246
- function save_screen_options( $status, $option, $value ) {
247
- if ( 'per_page' == $option ) {
248
- return $value;
249
- } else {
250
- return $status;
251
- }
252
- }
253
-
254
- /**
255
- * Get the per page option
256
- *
257
- * @static
258
- * @access public
259
- * @return int $per_page Number of logs a user wanted to be displayed in a page
260
- *
261
- */
262
- public static function get_per_page() {
263
- $screen = get_current_screen();
264
- $option = $screen->get_option('per_page', 'option');
265
-
266
- $per_page = get_user_meta(get_current_user_id(), $option, TRUE);
267
-
268
- if ( empty ( $per_page) || $per_page < 1 ) {
269
- $per_page = $screen->get_option( 'per_page', 'default' );
270
- }
271
-
272
- return $per_page;
273
- }
274
-
275
- /**
276
- * hook to add action links
277
- *
278
- * @param <type> $links
279
- * @return <type>
280
- */
281
- function add_action_links( $links ) {
282
- // Add a link to this plugin's settings page
283
- $settings_link = '<a href="tools.php?page=email-log">' . __("Log", 'email-log') . '</a>';
284
- array_unshift( $links, $settings_link );
285
- return $links;
286
- }
287
-
288
- /**
289
- * Adds Footer links. Based on http://striderweb.com/nerdaphernalia/2008/06/give-your-wordpress-plugin-credit/
290
- */
291
- function add_footer_links() {
292
- $plugin_data = get_plugin_data( __FILE__ );
293
- printf('%1$s ' . __("plugin", 'email-log') .' | ' . __("Version", 'email-log') . ' %2$s | '. __('by', 'email-log') . ' %3$s<br />', $plugin_data['Title'], $plugin_data['Version'], $plugin_data['Author']);
294
- }
295
-
296
- /**
297
- * Log email to database
298
- *
299
- * @global object $wpdb
300
- * @param array $mail_info Information about email
301
- * @return array Information about email
302
- */
303
- function log_email($mail_info) {
304
- global $wpdb;
305
-
306
- $attachment_present = (count ($mail_info['attachments']) > 0) ? "true" : "false";
307
-
308
- // return filtered array
309
- $mail_info = apply_filters(self::FILTER_NAME, $mail_info);
310
- $table_name = $wpdb->prefix . self::TABLE_NAME;
311
-
312
- if ( isset( $mail_info['message'] ) ) {
313
- $message = $mail_info['message'];
314
- } else {
315
- // wpmandrill plugin is changing "message" key to "html". See https://github.com/sudar/email-log/issues/20
316
- // Ideally this should be fixed in wpmandrill, but I am including this hack here till it is fixed by them.
317
- if ( isset( $mail_info['html'] ) ) {
318
- $message = $mail_info['html'];
319
- } else {
320
- $message = '';
321
- }
322
- }
323
-
324
- // Log into the database
325
- $wpdb->insert( $table_name, array(
326
- 'to_email' => is_array($mail_info['to']) ? $mail_info['to'][0] : $mail_info['to'],
327
- 'subject' => $mail_info['subject'],
328
- 'message' => $message,
329
- 'headers' => is_array($mail_info['headers']) ? implode("\n", $mail_info['headers']) : $mail_info['headers'],
330
- 'attachments' => $attachment_present,
331
- 'sent_date' => current_time('mysql')
332
- ));
333
-
334
- return $mail_info;
335
- }
336
-
337
- /**
338
- * Check whether a key is present. If present returns the value, else returns the default value
339
- *
340
- * @param <array> $array - Array whose key has to be checked
341
- * @param <string> $key - key that has to be checked
342
- * @param <string> $default - the default value that has to be used, if the key is not found (optional)
343
- *
344
- * @return <mixed> If present returns the value, else returns the default value
345
- * @author Sudar
346
- */
347
- private function array_get($array, $key, $default = NULL) {
348
- return isset($array[$key]) ? $array[$key] : $default;
349
- }
350
  }
351
 
352
- // Start this plugin once all other plugins are fully loaded
353
- add_action( 'init', 'EmailLog' ); function EmailLog() { global $EmailLog; $EmailLog = new EmailLog(); }
 
 
 
 
 
 
354
  ?>
1
  <?php
2
  /**
3
+ * Plugin Name: Email Log
4
+ * Plugin URI: http://sudarmuthu.com/wordpress/email-log
5
+ * Description: Logs every email sent through WordPress
6
+ * Donate Link: http://sudarmuthu.com/if-you-wanna-thank-me
7
+ * Author: Sudar
8
+ * Version: 1.8
9
+ * Author URI: http://sudarmuthu.com/
10
+ * Text Domain: email-log
11
+ * Domain Path: languages/
12
+ * === RELEASE NOTES ===
13
+ * Check readme file for full release notes
14
+ */
15
+
16
+ /**
17
+ * Copyright 2009 Sudar Muthu (email : sudar@sudarmuthu.com)
18
+ * This program is free software; you can redistribute it and/or modify
19
+ * it under the terms of the GNU General Public License, version 2, as
20
+ * published by the Free Software Foundation.
21
+ * This program is distributed in the hope that it will be useful,
22
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ * GNU General Public License for more details.
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program; if not, write to the Free Software
27
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
+ */
 
 
 
29
 
30
  /**
31
  * Plugin Root File
33
  * @since 1.7.2
34
  */
35
  if ( ! defined( 'EMAIL_LOG_PLUGIN_FILE' ) ) {
36
+ define( 'EMAIL_LOG_PLUGIN_FILE', __FILE__ );
37
  }
38
 
39
  // handle installation and table creation
40
+ require_once plugin_dir_path( __FILE__ ) . 'include/install.php';
41
 
42
  /**
43
  * The main Plugin class
44
  */
45
  class EmailLog {
46
+ public $include_path;
47
 
48
  private $admin_screen;
49
 
50
+ const VERSION = '1.8';
51
+ const FILTER_NAME = 'wp_mail_log';
52
+ const PAGE_SLUG = 'email-log';
53
+ const DELETE_LOG_NONCE_FIELD = 'sm-delete-email-log-nonce';
54
+ const DELETE_LOG_ACTION = 'sm-delete-email-log';
55
+
56
+ // DB stuff
57
+ const TABLE_NAME = 'email_log'; /* Database table name */
58
+ const DB_OPTION_NAME = 'email-log-db'; /* Database option name */
59
+ const DB_VERSION = '0.1'; /* Database version */
60
+
61
+ // JS Stuff
62
+ const JS_HANDLE = 'email-log';
63
+
64
+ //hooks
65
+ const HOOK_LOG_COLUMNS = 'email_log_manage_log_columns';
66
+ const HOOK_LOG_DISPLAY_COLUMNS = 'email_log_display_log_columns';
67
+
68
+ /**
69
+ * Initialize the plugin by registering the hooks
70
+ */
71
+ function __construct() {
72
+ $this->include_path = plugin_dir_path( __FILE__ );
73
+
74
+ // Load localization domain
75
+ $this->translations = dirname( plugin_basename( __FILE__ ) ) . '/languages/' ;
76
+ load_plugin_textdomain( 'email-log', false, $this->translations );
77
+
78
+ // Register hooks
79
+ add_action( 'admin_menu', array( $this, 'register_settings_page' ) );
80
+
81
+ // Register Filter
82
+ add_filter( 'wp_mail', array( $this, 'log_email' ) );
83
+ add_filter( 'set-screen-option', array( $this, 'save_screen_options' ), 10, 3 );
84
+ add_filter( 'plugin_row_meta', array( $this, 'add_plugin_links' ), 10, 2 );
85
+
86
+ $plugin = plugin_basename( __FILE__ );
87
+ add_filter( "plugin_action_links_$plugin", array( $this, 'add_action_links' ) );
88
+
89
+ //Add our ajax call
90
+ add_action( 'wp_ajax_display_content', array( $this, 'display_content_callback' ) );
91
+ }
92
+
93
+ /**
94
+ * Adds additional links in the Plugin listing. Based on http://zourbuth.com/archives/751/creating-additional-wordpress-plugin-links-row-meta/
95
+ *
96
+ * @param unknown $links
97
+ * @param unknown $file
98
+ * @return unknown
99
+ */
100
+ function add_plugin_links( $links, $file ) {
101
+ $plugin = plugin_basename( __FILE__ );
102
+
103
+ if ( $file == $plugin ) {
104
+ // only for this plugin
105
+ return array_merge( $links,
106
+ array( '<a href="http://sudarmuthu.com/wordpress/email-log/pro-addons" target="_blank">' . __( 'Buy Addons', 'email-log' ) . '</a>' )
107
+ );
108
+ }
109
+ return $links;
110
+ }
111
+
112
+ /**
113
+ * Register the settings page
114
+ */
115
+ function register_settings_page() {
116
+ //Save the handle to your admin page - you'll need it to create a WP_Screen object
117
+ $this->admin_page = add_submenu_page( 'tools.php', __( 'Email Log', 'email-log' ), __( 'Email Log', 'email-log' ), 'manage_options', self::PAGE_SLUG , array( $this, 'display_logs' ) );
118
+
119
+ add_action( "load-{$this->admin_page}", array( $this, 'create_settings_panel' ) );
120
+ }
121
+
122
+ /**
123
+ * Display email logs
124
+ */
125
+ function display_logs() {
126
+ add_thickbox();
127
+
128
+ $this->logs_table->prepare_items( $this->get_per_page() );
129
  ?>
130
+ <div class="wrap">
131
+ <h2><?php _e( 'Email Logs', 'email-log' );?></h2>
132
+ <?php
133
+ if ( isset( $this->logs_deleted ) && $this->logs_deleted != '' ) {
134
+ $logs_deleted = intval( $this->logs_deleted );
135
+
136
+ if ( $logs_deleted > 0 ) {
137
+ echo '<div class="updated"><p>' . sprintf( _n( '1 email log deleted.', '%s email logs deleted', $logs_deleted, 'email-log' ), $logs_deleted ) . '</p></div>';
138
+ } else {
139
+ echo '<div class="updated"><p>' . __( 'There was some problem in deleting the email logs' , 'email-log' ) . '</p></div>';
140
+ }
141
+ unset( $this->logs_deleted );
142
+ }
143
  ?>
144
+ <form id="email-logs-search" method="get">
145
+ <input type="hidden" name="page" value="<?php echo self::PAGE_SLUG; ?>" >
146
  <?php
147
+ $this->logs_table->search_box( __( 'Search Logs', 'email-log' ), 'search_id' );
148
  ?>
149
+ </form>
150
 
151
+ <form id="email-logs-filter" method="get">
152
+ <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
153
  <?php
154
+ wp_nonce_field( self::DELETE_LOG_ACTION, self::DELETE_LOG_NONCE_FIELD );
155
+ $this->logs_table->display();
156
  ?>
157
+ </form>
158
+ </div>
159
  <?php
160
+ /**
161
+ * Action to add additional content to email log admin footer.
162
+ *
163
+ * @since 1.8
164
+ */
165
+ do_action( 'el_admin_footer' );
166
 
167
+ // Display credits in Footer
168
+ add_action( 'in_admin_footer', array( $this, 'add_footer_links' ) );
169
+ }
170
+
171
+ /**
172
+ * Add settings Panel
173
+ */
174
  function create_settings_panel() {
175
 
176
  /**
177
  * Create the WP_Screen object against your admin page handle
178
  * This ensures we're working with the right admin page
179
  */
180
+ $this->admin_screen = WP_Screen::get( $this->admin_page );
181
 
182
  /**
183
  * Content specified inline
184
  */
185
  $this->admin_screen->add_help_tab(
186
  array(
187
+ 'title' => __( 'About Plugin', 'email-log' ),
188
  'id' => 'about_tab',
189
+ 'content' => '<p>' . __( 'Email Log WordPress Plugin, allows you to log all emails that are sent through WordPress.', 'email-log' ) . '</p>',
190
+ 'callback' => false,
191
  )
192
  );
193
 
194
+ // Add help sidebar
195
  $this->admin_screen->set_help_sidebar(
196
+ '<p><strong>' . __( 'More information', 'email-log' ) . '</strong></p>' .
197
+ '<p><a href = "http://sudarmuthu.com/wordpress/email-log">' . __( 'Plugin Homepage/support', 'email-log' ) . '</a></p>' .
198
+ '<p><a href = "http://sudarmuthu.com/blog">' . __( "Plugin author's blog", 'email-log' ) . '</a></p>' .
199
+ '<p><a href = "http://sudarmuthu.com/wordpress/">' . __( "Other Plugin's by Author", 'email-log' ) . '</a></p>'
200
+ );
201
 
202
+ // Add screen options
203
  $this->admin_screen->add_option(
204
  'per_page',
205
  array(
206
+ 'label' => __( 'Entries per page', 'email-log' ),
207
  'default' => 20,
208
+ 'option' => 'per_page',
209
  )
210
  );
211
 
212
+ if ( ! class_exists( 'WP_List_Table' ) ) {
213
+ require_once ABSPATH . WPINC . '/class-wp-list-table.php';
214
+ }
215
+
216
+ if ( ! class_exists( 'Email_Log_List_Table' ) ) {
217
+ require_once $this->include_path . 'include/class-email-log-list-table.php';
218
+ }
219
+
220
+ //Prepare Table of elements
221
+ $this->logs_table = new Email_Log_List_Table();
222
+ }
223
+
224
+ /**
225
+ * AJAX callback for displaying email content
226
+ *
227
+ * @since 1.6
228
+ */
229
+ function display_content_callback() {
230
+ global $wpdb;
231
+
232
+ $table_name = $wpdb->prefix . self::TABLE_NAME;
233
+ $email_id = absint( $_GET['email_id'] );
234
+
235
+ $query = $wpdb->prepare( 'SELECT * FROM ' . $table_name . ' WHERE id = %d', $email_id );
236
+ $content = $wpdb->get_results( $query );
237
 
238
+ echo wpautop( $content[0]->message );
 
 
239
 
240
+ die(); // this is required to return a proper result
 
241
  }
242
 
243
+ /**
244
+ * Save Screen option.
245
+ *
246
+ * @param unknown $status
247
+ * @param unknown $option
248
+ * @param unknown $value
249
+ * @return unknown
250
+ */
251
+ function save_screen_options( $status, $option, $value ) {
252
+ if ( 'per_page' == $option ) {
253
+ return $value;
254
+ } else {
255
+ return $status;
256
+ }
257
+ }
258
+
259
+ /**
260
+ * Get the per page option
261
+ *
262
+ * @static
263
+ * @access public
264
+ *
265
+ * @return int $per_page Number of logs a user wanted to be displayed in a page
266
+ */
267
+ public static function get_per_page() {
268
+ $screen = get_current_screen();
269
+ $option = $screen->get_option( 'per_page', 'option' );
270
+
271
+ $per_page = get_user_meta( get_current_user_id(), $option, true );
272
+
273
+ if ( empty( $per_page ) || $per_page < 1 ) {
274
+ $per_page = $screen->get_option( 'per_page', 'default' );
275
+ }
276
+
277
+ return $per_page;
278
+ }
279
+
280
+ /**
281
+ * hook to add action links
282
+ *
283
+ * @param <type> $links
284
+ * @return <type>
285
+ */
286
+ function add_action_links( $links ) {
287
+ // Add a link to this plugin's settings page
288
+ $settings_link = '<a href="tools.php?page=email-log">' . __( 'Log', 'email-log' ) . '</a>';
289
+ array_unshift( $links, $settings_link );
290
+ return $links;
291
+ }
292
+
293
+ /**
294
+ * Adds Footer links. Based on http://striderweb.com/nerdaphernalia/2008/06/give-your-wordpress-plugin-credit/
295
+ */
296
+ function add_footer_links() {
297
+ $plugin_data = get_plugin_data( __FILE__ );
298
+ printf( '%1$s ' . __( 'plugin', 'email-log' ) . ' | ' . __( 'Version', 'email-log' ) . ' %2$s | ' . __( 'by', 'email-log' ) . ' %3$s<br />', $plugin_data['Title'], $plugin_data['Version'], $plugin_data['Author'] );
299
+ }
300
+
301
+ /**
302
+ * Log email to database
303
+ *
304
+ * @global object $wpdb
305
+ * @param array $mail_info Information about email
306
+ * @return array Information about email
307
+ */
308
+ function log_email( $mail_info ) {
309
+ global $wpdb;
310
+
311
+ $attachment_present = ( count( $mail_info['attachments'] ) > 0 ) ? 'true' : 'false';
312
+
313
+ // return filtered array
314
+ $mail_info = apply_filters( self::FILTER_NAME, $mail_info );
315
+ $table_name = $wpdb->prefix . self::TABLE_NAME;
316
+
317
+ if ( isset( $mail_info['message'] ) ) {
318
+ $message = $mail_info['message'];
319
+ } else {
320
+ // wpmandrill plugin is changing "message" key to "html". See https://github.com/sudar/email-log/issues/20
321
+ // Ideally this should be fixed in wpmandrill, but I am including this hack here till it is fixed by them.
322
+ if ( isset( $mail_info['html'] ) ) {
323
+ $message = $mail_info['html'];
324
+ } else {
325
+ $message = '';
326
+ }
327
+ }
328
+
329
+ // Log into the database
330
+ $wpdb->insert( $table_name, array(
331
+ 'to_email' => is_array( $mail_info['to'] ) ? $mail_info['to'][0] : $mail_info['to'],
332
+ 'subject' => $mail_info['subject'],
333
+ 'message' => $message,
334
+ 'headers' => is_array( $mail_info['headers'] ) ? implode( "\n", $mail_info['headers'] ) : $mail_info['headers'],
335
+ 'attachments' => $attachment_present,
336
+ 'sent_date' => current_time( 'mysql' ),
337
+ ) );
338
+
339
+ return $mail_info;
340
+ }
341
+
342
+ /**
343
+ * Check whether a key is present.
344
+ *
345
+ * If present returns the value, else returns the default value
346
+ *
347
+ * @param array $array Array whose key has to be checked
348
+ * @param string $key Key that has to be checked
349
+ * @param string $default The default value that has to be used, if the key is not found (optional)
350
+ * @return mixed If present returns the value, else returns the default value
351
+ */
352
+ private function array_get( $array, $key, $default = null ) {
353
+ return isset( $array[ $key ] ) ? $array[ $key ] : $default;
354
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  }
356
 
357
+ /**
358
+ * Start this plugin once all other plugins are fully loaded
359
+ */
360
+ function email_log() {
361
+ global $EmailLog;
362
+ $EmailLog = new EmailLog();
363
+ }
364
+ add_action( 'init', 'email_log' );
365
  ?>
include/class-email-header-parser.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Email Header Parser.
4
+ *
5
+ * @author Sudar
6
+ * @package EmailLog
7
+ */
8
+
9
+ defined( 'ABSPATH' ) || exit; // Exit if accessed directly
10
+
11
+ /**
12
+ * Class Email Header Parser.
13
+ *
14
+ * @since 1.0
15
+ */
16
+ class Email_Header_Parser {
17
+
18
+ /**
19
+ * Join email headers.
20
+ *
21
+ * @since 1.0
22
+ *
23
+ * @param array $data Headers to be joined.
24
+ * @return string Joined headers.
25
+ */
26
+ public function join_headers( $data ) {
27
+ $headers = '';
28
+
29
+ if ( ! empty( $data['from'] ) ) {
30
+ $headers .= 'From: ' . $data['from'] . "\r\n";
31
+ }
32
+
33
+ if ( ! empty( $data['cc'] ) ) {
34
+ $headers .= 'CC: ' . $data['cc'] . "\r\n";
35
+ }
36
+
37
+ if ( ! empty( $data['bcc'] ) ) {
38
+ $headers .= 'BCC: ' . $data['bcc'] . "\r\n";
39
+ }
40
+
41
+ if ( ! empty( $data['reply_to'] ) ) {
42
+ $headers .= 'Reply-to: ' . $data['reply_to'] . "\r\n";
43
+ }
44
+
45
+ if ( ! empty( $data['content_type'] ) ) {
46
+ $headers .= 'Content-type: ' . $data['content_type'] . "\r\n";
47
+ }
48
+
49
+ return $headers;
50
+ }
51
+
52
+ /**
53
+ * Return parsed headers.
54
+ *
55
+ * @param string $headers Headers to parse
56
+ * @return array Parsed Headers.
57
+ */
58
+ public function parse_headers( $headers ) {
59
+ return $this->parse( $headers );
60
+ }
61
+
62
+ /**
63
+ * Parse Headers.
64
+ *
65
+ * @access private
66
+ *
67
+ * @param string $headers Headers to be parsed.
68
+ * @return array Parsed headers
69
+ */
70
+ private function parse( $headers ) {
71
+ $data = array();
72
+ $arr_headers = explode( "\n", $headers );
73
+
74
+ foreach ( $arr_headers as $header ) {
75
+ $split_header = explode( ':', $header );
76
+ $value = $this->parse_header_line( $split_header );
77
+
78
+ if ( trim( $value ) != '' ) {
79
+ switch ( strtolower( $split_header[0] ) ) {
80
+ case 'from':
81
+ $data['from'] = $value;
82
+ break;
83
+
84
+ case 'cc':
85
+ $data['cc'] = $value;
86
+ break;
87
+
88
+ case 'bcc':
89
+ $data['bcc'] = $value;
90
+ break;
91
+
92
+ case 'reply-to':
93
+ $data['reply-to'] = $value;
94
+ break;
95
+
96
+ case 'content-type':
97
+ $data['content-type'] = $value;
98
+ break;
99
+ }
100
+ }
101
+ }
102
+
103
+ return $data;
104
+ }
105
+
106
+ /**
107
+ * Parse individual header line.
108
+ *
109
+ * @since 1.0
110
+ * @access private
111
+ * @param array $header Header line to be parsed
112
+ * @return string Parsed value
113
+ */
114
+ private function parse_header_line( $header ) {
115
+ $value = '';
116
+ if ( count( $header ) == 2 ) {
117
+ if ( is_array( $header[1] ) ) {
118
+ $value = trim( implode( ',', array_map( 'trim', $header[1] ) ) );
119
+ } else {
120
+ $value = trim( $header[1] );
121
+ }
122
+ }
123
+
124
+ return $value;
125
+ }
126
+ }
include/class-email-log-list-table.php CHANGED
@@ -1,284 +1,333 @@
1
  <?php
2
  /**
3
- * Table to display Email Logs
4
  *
5
  * Based on Custom List Table Example by Matt Van Andel
6
  *
7
- * @package Email Log
8
  * @author Sudar
 
9
  */
10
  class Email_Log_List_Table extends WP_List_Table {
11
 
12
- /**
13
- * Set up a constructor that references the parent constructor. We
14
- * use the parent reference to set some default configs.
15
- */
16
- function __construct(){
17
- global $status, $page;
18
-
19
- //Set parent defaults
20
- parent::__construct( array(
21
- 'singular' => 'email-log', //singular name of the listed records
22
- 'plural' => 'email-logs', //plural name of the listed records
23
- 'ajax' => false //does this table support ajax?
24
- ) );
25
- }
26
 
27
  /**
28
  * Add extra markup in the toolbars before or after the list
29
- *
30
- * @param string $which, helps you decide if you add the markup after (bottom) or before (top) the list
31
  */
32
  function extra_tablenav( $which ) {
33
- if ( $which == "top" ){
34
  //The code that goes before the table is here
35
- echo '<span id = "el-pro-msg">';
36
- _e('More fields are available in Pro addon. ', 'email-log');
37
- echo '<a href = "http://sudarmuthu.com/out/buy-email-log-more-fields-addon" style = "color:red">';
38
- _e('Buy Now', 'email-log');
39
- echo '</a>';
40
- echo '</span>';
41
  }
42
 
43
- if ( $which == "bottom" ){
44
  //The code that goes after the table is there
45
- echo '<p>&nbsp;</p>';
46
- echo '<p>&nbsp;</p>';
47
-
48
- echo '<p>';
49
- _e('The following are the list of pro addons that are currently available for purchase.', 'email-log');
50
- echo '</p>';
51
-
52
- echo '<ul style="list-style:disc; padding-left:35px">';
53
-
54
- echo '<li>';
55
- echo '<strong>', __('Email Log - Forward Email', 'email-log'), '</strong>', ' - ';
56
- echo __('This addon allows you to send a copy of all emails send from WordPress to another email address', 'email-log');
57
- echo ' <a href = "http://sudarmuthu.com/wordpress/email-log/pro-addons#forward-email-addon">', __('More Info', 'email-log'), '</a>.';
58
- echo ' <a href = "http://sudarmuthu.com/out/buy-email-log-forward-email-addon">', __('Buy now', 'email-log'), '</a>';
59
- echo '</li>';
60
-
61
- echo '<li>';
62
- echo '<strong>', __('Email Log - More fields', 'email-log'), '</strong>', ' - ';
63
- echo __('Adds more fields (From, CC, BCC, Reply To, Attachment) to the logs page.', 'email-log');
64
- echo ' <a href = "http://sudarmuthu.com/wordpress/email-log/pro-addons#more-fields-addon">', __('More Info', 'email-log'), '</a>.';
65
- echo ' <a href = "http://sudarmuthu.com/out/buy-email-log-more-fields-addon">', __('Buy now', 'email-log'), '</a>';
66
- echo '</li>';
67
-
68
- echo '</ul>';
 
 
 
 
 
 
 
69
  }
70
  }
71
 
72
- /**
73
- * Return the list of column and title names
74
- *
75
- * @see WP_List_Table::::single_row_columns()
76
- * @return array An associative array containing column information: 'slugs'=>'Visible Titles'
77
- */
78
- function get_columns(){
79
- $columns = array(
80
- 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
81
- 'sent_date' => __('Sent at', 'email-log'),
82
- 'to' => __('To', 'email-log'),
83
- 'subject' => __('Subject', 'email-log')
84
- );
85
-
86
- return apply_filters( EmailLog::HOOK_LOG_COLUMNS, $columns );
87
- }
88
-
89
- /**
90
- * Return the list of columns
91
- *
92
- * @return array An associative array containing all the columns that should be sortable: 'slugs'=>array('data_values',bool)
93
- */
94
- function get_sortable_columns() {
95
- $sortable_columns = array(
96
- 'sent_date' => array('sent_date',TRUE), //true means it's already sorted
97
- 'to' => array('to_email',FALSE),
98
- 'subject' => array('subject',FALSE)
99
- );
100
- return $sortable_columns;
101
- }
102
-
103
- /**
104
- * Return values for default columns
105
- */
106
- function column_default( $item, $column_name ){
107
- do_action( EmailLog::HOOK_LOG_DISPLAY_COLUMNS, $column_name, $item );
108
- }
109
-
110
- /**
111
- * Display sent date column
112
- */
113
- function column_sent_date($item) {
114
-
115
- //Build row actions
116
- $actions = array(
117
- 'delete' => sprintf( '<a href="?page=%s&action=%s&%s=%s&%s=%s">%s</a>',
118
- $_REQUEST['page'],
119
- 'delete',
120
- $this->_args['singular'],
121
- $item->id,
122
- EmailLog::DELETE_LOG_NONCE_FIELD,
123
- wp_create_nonce( EmailLog::DELETE_LOG_ACTION ),
124
- __( 'Delete', 'email-log' )
125
- ),
126
- );
127
-
128
- $email_date = mysql2date(
129
- sprintf( __( '%s @ %s', 'email-log' ), get_option( 'date_format', 'F j, Y' ), get_option( 'time_format', 'g:i A' ) ),
130
- $item->sent_date
131
- );
132
-
133
- return sprintf('%1$s <span style="color:silver">[<a href="#" class="email_content" id="email_content_%2$s">%3$s</a>] (id:%4$s)</span>%5$s',
134
- /*$1%s*/ $email_date,
135
- /*$2%s*/ $item->id,
136
- /*$3%s*/ __('View Content', 'email-log' ),
137
- /*$4%s*/ $item->id,
138
- /*$5%s*/ $this->row_actions($actions)
139
- );
140
- }
141
-
142
- /**
143
- * To field
144
- */
145
- function column_to( $item ) {
146
- return stripslashes( $item->to_email );
147
- }
148
-
149
- /**
150
- * Subject field
151
- */
152
- function column_subject( $item ) {
153
- return stripslashes( $item->subject );
154
- }
155
-
156
- /**
157
- * Markup for action column
158
- */
159
- function column_cb($item){
160
- return sprintf(
161
- '<input type="checkbox" name="%1$s[]" value="%2$s" />',
162
- /*$1%s*/ $this->_args['singular'],
163
- /*$2%s*/ $item->id
164
- );
165
- }
166
-
167
- /**
168
- * Specify the list of bulk actions
169
- *
170
- * @return array An associative array containing all the bulk actions: 'slugs'=>'Visible Titles'
171
- */
172
- function get_bulk_actions() {
173
- $actions = array(
174
- 'delete' => __( 'Delete', 'email-log' ),
175
- 'delete-all' => __( 'Delete All Logs', 'email-log' )
176
- );
177
- return $actions;
178
- }
179
-
180
- /**
181
- * Handle bulk actions
182
- *
183
- * @see $this->prepare_items()
184
- */
185
- function process_bulk_action() {
186
- global $wpdb;
187
- global $EmailLog;
188
-
189
- if( 'delete' === $this->current_action() ) {
190
- // delete a list of logs by id
191
-
192
- $nouce = $_REQUEST[EmailLog::DELETE_LOG_NONCE_FIELD ];
193
- if ( wp_verify_nonce( $nouce, EmailLog::DELETE_LOG_ACTION ) ) {
194
-
195
- $ids = $_GET[$this->_args['singular']];
196
-
197
- if ( is_array( $ids ) ) {
198
- $selected_ids = implode( ',', $ids );
199
- } else {
200
- $selected_ids = $ids;
201
- }
202
-
203
- // Can't use wpdb->prepare for the below query. If used it results in this bug
204
- // https://github.com/sudar/email-log/issues/13
205
-
206
- $selected_ids = esc_sql( $selected_ids );
207
-
208
- $table_name = $wpdb->prefix . EmailLog::TABLE_NAME;
209
- $EmailLog->logs_deleted = $wpdb->query( "DELETE FROM $table_name where id IN ( $selected_ids )" );
210
- } else {
211
- wp_die( 'Cheating, Huh? ');
212
- }
213
- } else if( 'delete-all' === $this->current_action() ) {
214
- // delete all logs
215
-
216
- $nouce = $_REQUEST[EmailLog::DELETE_LOG_NONCE_FIELD ];
217
- if ( wp_verify_nonce( $nouce, EmailLog::DELETE_LOG_ACTION ) ) {
218
- $table_name = $wpdb->prefix . EmailLog::TABLE_NAME;
219
- $EmailLog->logs_deleted = $wpdb->query( "DELETE FROM $table_name" );
220
- } else {
221
- wp_die( 'Cheating, Huh? ');
222
- }
223
- }
224
- }
225
-
226
- /**
227
- * Prepare data for display.
228
- */
229
- function prepare_items() {
230
- global $wpdb;
231
-
232
- $table_name = $wpdb->prefix . EmailLog::TABLE_NAME;
233
- $this->_column_headers = $this->get_column_info();
234
-
235
- // Handle bulk actions
236
- $this->process_bulk_action();
237
-
238
- // get current page number
239
- $current_page = $this->get_pagenum();
240
-
241
- $query = "SELECT * FROM " . $table_name;
242
-
243
- if ( isset( $_GET['s'] ) ) {
244
- $search_term = trim( esc_sql( $_GET['s'] ) );
245
- $query .= " WHERE to_email LIKE '%$search_term%' OR subject LIKE '%$search_term%' ";
246
- }
247
-
248
- // Ordering parameters
249
- $orderby = !empty( $_GET["orderby"] ) ? esc_sql( $_GET["orderby"] ) : 'sent_date';
250
- $order = !empty( $_GET["order"] ) ? esc_sql( $_GET["order"] ) : 'DESC';
251
-
252
- if(!empty($orderby) & !empty($order)) {
253
- $query .= ' ORDER BY ' . $orderby . ' ' . $order;
254
- }
255
-
256
- // Pagination parameters
257
- $total_items = $wpdb->query( $query ); //return the total number of affected rows
258
-
259
- //adjust the query to take pagination into account
260
- $per_page = EmailLog::get_per_page();
261
- if( !empty( $current_page ) && !empty( $per_page ) ) {
262
- $offset = ($current_page-1) * $per_page;
263
- $query .= ' LIMIT ' . (int)$offset . ',' . (int)$per_page;
264
- }
265
-
266
- // Fetch the items
267
- $this->items = $wpdb->get_results( $query );
268
-
269
- // register pagination options & calculations.
270
- $this->set_pagination_args( array(
271
- 'total_items' => $total_items,
272
- 'per_page' => $per_page,
273
- 'total_pages' => ceil( $total_items/$per_page )
274
- ) );
275
- }
276
-
277
- /**
278
- * If no items are found
279
- */
280
- function no_items() {
281
- _e('Your email log is empty', 'email-log');
282
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  }
284
  ?>
1
  <?php
2
  /**
3
+ * Table to display Email Logs.
4
  *
5
  * Based on Custom List Table Example by Matt Van Andel
6
  *
 
7
  * @author Sudar
8
+ * @package Email Log
9
  */
10
  class Email_Log_List_Table extends WP_List_Table {
11
 
12
+ /**
13
+ * Set up a constructor that references the parent constructor.
14
+ * We use the parent reference to set some default configs.
15
+ */
16
+ function __construct() {
17
+ parent::__construct( array(
18
+ 'singular' => 'email-log', //singular name of the listed records
19
+ 'plural' => 'email-logs', //plural name of the listed records
20
+ 'ajax' => false, //does this table support ajax?
21
+ ) );
22
+ }
 
 
 
23
 
24
  /**
25
  * Add extra markup in the toolbars before or after the list
26
+ *
27
+ * @param string $which Add the markup after (bottom) or before (top) the list
28
  */
29
  function extra_tablenav( $which ) {
30
+ if ( 'top' == $which ) {
31
  //The code that goes before the table is here
32
+ echo '<span id = "el-pro-msg">';
33
+ _e( 'More fields are available in Pro addon. ', 'email-log' );
34
+ echo '<a href = "http://sudarmuthu.com/out/buy-email-log-more-fields-addon" style = "color:red">';
35
+ _e( 'Buy Now', 'email-log' );
36
+ echo '</a>';
37
+ echo '</span>';
38
  }
39
 
40
+ if ( 'bottom' == $which ) {
41
  //The code that goes after the table is there
42
+ echo '<p>&nbsp;</p>';
43
+ echo '<p>&nbsp;</p>';
44
+
45
+ echo '<p>';
46
+ _e( 'The following are the list of pro addons that are currently available for purchase.', 'email-log' );
47
+ echo '</p>';
48
+
49
+ echo '<ul style="list-style:disc; padding-left:35px">';
50
+
51
+ echo '<li>';
52
+ echo '<strong>', __( 'Email Log - Resend Email', 'email-log' ), '</strong>', ' - ';
53
+ echo __( 'Adds the ability to resend email from logs.', 'email-log' );
54
+ echo ' <a href = "http://sudarmuthu.com/wordpress/email-log/pro-addons#resend-email-addon">', __( 'More Info', 'email-log' ), '</a>.';
55
+ echo ' <a href = "http://sudarmuthu.com/out/buy-email-log-resend-email-addon">', __( 'Buy now', 'email-log' ), '</a>';
56
+ echo '</li>';
57
+
58
+ echo '<li>';
59
+ echo '<strong>', __( 'Email Log - More fields', 'email-log' ), '</strong>', ' - ';
60
+ echo __( 'Adds more fields (From, CC, BCC, Reply To, Attachment) to the logs page.', 'email-log' );
61
+ echo ' <a href = "http://sudarmuthu.com/wordpress/email-log/pro-addons#more-fields-addon">', __( 'More Info', 'email-log' ), '</a>.';
62
+ echo ' <a href = "http://sudarmuthu.com/out/buy-email-log-more-fields-addon">', __( 'Buy now', 'email-log' ), '</a>';
63
+ echo '</li>';
64
+
65
+ echo '<li>';
66
+ echo '<strong>', __( 'Email Log - Forward Email', 'email-log' ), '</strong>', ' - ';
67
+ echo __( 'This addon allows you to send a copy of all emails send from WordPress to another email address', 'email-log' );
68
+ echo ' <a href = "http://sudarmuthu.com/wordpress/email-log/pro-addons#forward-email-addon">', __( 'More Info', 'email-log' ), '</a>.';
69
+ echo ' <a href = "http://sudarmuthu.com/out/buy-email-log-forward-email-addon">', __( 'Buy now', 'email-log' ), '</a>';
70
+ echo '</li>';
71
+
72
+ echo '</ul>';
73
  }
74
  }
75
 
76
+ /**
77
+ * Return the list of column and title names.
78
+ *
79
+ * @see WP_List_Table::::single_row_columns()
80
+ * @return array An associative array containing column information: 'slugs'=>'Visible Titles'
81
+ */
82
+ function get_columns() {
83
+ $columns = array(
84
+ 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
85
+ 'sent_date' => __( 'Sent at', 'email-log' ),
86
+ 'to' => __( 'To', 'email-log' ),
87
+ 'subject' => __( 'Subject', 'email-log' ),
88
+ );
89
+
90
+ return apply_filters( EmailLog::HOOK_LOG_COLUMNS, $columns );
91
+ }
92
+
93
+ /**
94
+ * Return the list of columns
95
+ *
96
+ * @return array An associative array containing all the columns that should be sortable: 'slugs'=>array('data_values',bool)
97
+ */
98
+ function get_sortable_columns() {
99
+ $sortable_columns = array(
100
+ 'sent_date' => array( 'sent_date', true ), //true means it's already sorted
101
+ 'to' => array( 'to_email', false ),
102
+ 'subject' => array( 'subject', false ),
103
+ );
104
+ return $sortable_columns;
105
+ }
106
+
107
+ /**
108
+ * Return values for default columns
109
+ *
110
+ * @param unknown $item
111
+ * @param unknown $column_name
112
+ */
113
+ function column_default( $item, $column_name ) {
114
+ do_action( EmailLog::HOOK_LOG_DISPLAY_COLUMNS, $column_name, $item );
115
+ }
116
+
117
+ /**
118
+ * Display sent date column.
119
+ *
120
+ * @param object $item Current item object
121
+ * @return string Markup to be displayed for the column
122
+ */
123
+ function column_sent_date( $item ) {
124
+ $email_date = mysql2date(
125
+ sprintf( __( '%s @ %s', 'email-log' ), get_option( 'date_format', 'F j, Y' ), get_option( 'time_format', 'g:i A' ) ),
126
+ $item->sent_date
127
+ );
128
+
129
+ $actions = array();
130
+
131
+ $content_ajax_url = add_query_arg(
132
+ array(
133
+ 'action' => 'display_content',
134
+ 'email_id' => $item->id,
135
+ 'TB_iframe' => 'true',
136
+ 'width' => '600',
137
+ 'height' => '550',
138
+ ),
139
+ 'admin-ajax.php'
140
+ );
141
+
142
+ $actions['view-content'] = sprintf( '<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>',
143
+ esc_url( $content_ajax_url ),
144
+ __( 'Email Content', 'email-log' ),
145
+ __( 'View Content', 'email-log' )
146
+ );
147
+
148
+ $delete_url = add_query_arg(
149
+ array(
150
+ 'page' => $_REQUEST['page'],
151
+ 'action' => 'delete',
152
+ $this->_args['singular'] => $item->id,
153
+ EmailLog::DELETE_LOG_NONCE_FIELD => wp_create_nonce( EmailLog::DELETE_LOG_ACTION ),
154
+ )
155
+ );
156
+
157
+ $actions['delete'] = sprintf( '<a href="%s">%s</a>',
158
+ esc_url( $delete_url ),
159
+ __( 'Delete', 'email-log' )
160
+ );
161
+
162
+ /**
163
+ * This filter can be used to modify the list of row actions that are displayed.
164
+ *
165
+ * @since 1.8
166
+ * @param array $actions List of actions.
167
+ * @param object $item The current log item.
168
+ */
169
+ $actions = apply_filters( 'el_row_actions', $actions, $item );
170
+
171
+ return sprintf( '%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
172
+ /*$1%s*/ $email_date,
173
+ /*$2%s*/ $item->id,
174
+ /*$3%s*/ $this->row_actions( $actions )
175
+ );
176
+ }
177
+
178
+ /**
179
+ * To field
180
+ *
181
+ * @param unknown $item
182
+ * @return unknown
183
+ */
184
+ function column_to( $item ) {
185
+ return stripslashes( $item->to_email );
186
+ }
187
+
188
+ /**
189
+ * Subject field
190
+ *
191
+ * @param unknown $item
192
+ * @return unknown
193
+ */
194
+ function column_subject( $item ) {
195
+ return stripslashes( $item->subject );
196
+ }
197
+
198
+ /**
199
+ * Markup for action column
200
+ *
201
+ * @param unknown $item
202
+ * @return unknown
203
+ */
204
+ function column_cb( $item ) {
205
+ return sprintf(
206
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
207
+ /*$1%s*/ $this->_args['singular'],
208
+ /*$2%s*/ $item->id
209
+ );
210
+ }
211
+
212
+ /**
213
+ * Specify the list of bulk actions
214
+ *
215
+ * @return array An associative array containing all the bulk actions: 'slugs'=>'Visible Titles'
216
+ */
217
+ function get_bulk_actions() {
218
+ $actions = array(
219
+ 'delete' => __( 'Delete', 'email-log' ),
220
+ 'delete-all' => __( 'Delete All Logs', 'email-log' ),
221
+ );
222
+ return $actions;
223
+ }
224
+
225
+ /**
226
+ * Handle bulk actions
227
+ *
228
+ * @see $this->prepare_items()
229
+ */
230
+ function process_bulk_action() {
231
+ global $wpdb;
232
+ global $EmailLog;
233
+
234
+ if ( 'delete' === $this->current_action() ) {
235
+ // delete a list of logs by id
236
+
237
+ $nouce = $_REQUEST[ EmailLog::DELETE_LOG_NONCE_FIELD ];
238
+ if ( wp_verify_nonce( $nouce, EmailLog::DELETE_LOG_ACTION ) ) {
239
+
240
+ $ids = $_GET[ $this->_args['singular'] ];
241
+
242
+ if ( is_array( $ids ) ) {
243
+ $selected_ids = implode( ',', $ids );
244
+ } else {
245
+ $selected_ids = $ids;
246
+ }
247
+
248
+ // Can't use wpdb->prepare for the below query. If used it results in this bug
249
+ // https://github.com/sudar/email-log/issues/13
250
+
251
+ $selected_ids = esc_sql( $selected_ids );
252
+
253
+ $table_name = $wpdb->prefix . EmailLog::TABLE_NAME;
254
+ $EmailLog->logs_deleted = $wpdb->query( "DELETE FROM $table_name where id IN ( $selected_ids )" );
255
+ } else {
256
+ wp_die( 'Cheating, Huh? ' );
257
+ }
258
+ } else if ( 'delete-all' === $this->current_action() ) {
259
+ // delete all logs
260
+
261
+ $nouce = $_REQUEST[ EmailLog::DELETE_LOG_NONCE_FIELD ];
262
+ if ( wp_verify_nonce( $nouce, EmailLog::DELETE_LOG_ACTION ) ) {
263
+ $table_name = $wpdb->prefix . EmailLog::TABLE_NAME;
264
+ $EmailLog->logs_deleted = $wpdb->query( 'DELETE FROM $table_name' );
265
+ } else {
266
+ wp_die( 'Cheating, Huh? ' );
267
+ }
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Prepare data for display.
273
+ */
274
+ function prepare_items() {
275
+ global $wpdb;
276
+
277
+ $table_name = $wpdb->prefix . EmailLog::TABLE_NAME;
278
+ $this->_column_headers = $this->get_column_info();
279
+
280
+ // Handle bulk actions
281
+ $this->process_bulk_action();
282
+
283
+ // get current page number
284
+ $current_page = $this->get_pagenum();
285
+
286
+ $query = 'SELECT * FROM ' . $table_name;
287
+ $count_query = 'SELECT * FROM ' . $table_name;
288
+ $query_cond = '';
289
+
290
+ if ( isset( $_GET['s'] ) ) {
291
+ $search_term = trim( esc_sql( $_GET['s'] ) );
292
+ $query_cond .= " WHERE to_email LIKE '%$search_term%' OR subject LIKE '%$search_term%' ";
293
+ }
294
+
295
+ // Ordering parameters
296
+ $orderby = ! empty( $_GET['orderby'] ) ? esc_sql( $_GET['orderby'] ) : 'sent_date';
297
+ $order = ! empty( $_GET['order'] ) ? esc_sql( $_GET['order'] ) : 'DESC';
298
+
299
+ if ( ! empty( $orderby ) & ! empty( $order ) ) {
300
+ $query_cond .= ' ORDER BY ' . $orderby . ' ' . $order;
301
+ }
302
+
303
+ // find total number of items
304
+ $count_query = $count_query . $query_cond;
305
+ $total_items = $wpdb->get_var( $count_query );
306
+
307
+ // adjust the query to take pagination into account
308
+ $per_page = EmailLog::get_per_page();
309
+ if ( ! empty( $current_page ) && ! empty( $per_page ) ) {
310
+ $offset = ( $current_page - 1 ) * $per_page;
311
+ $query_cond .= ' LIMIT ' . (int) $offset . ',' . (int) $per_page;
312
+ }
313
+
314
+ // Fetch the items
315
+ $query = $query . $query_cond;
316
+ $this->items = $wpdb->get_results( $query );
317
+
318
+ // register pagination options & calculations.
319
+ $this->set_pagination_args( array(
320
+ 'total_items' => $total_items,
321
+ 'per_page' => $per_page,
322
+ 'total_pages' => ceil( $total_items / $per_page ),
323
+ ) );
324
+ }
325
+
326
+ /**
327
+ * If no items are found
328
+ */
329
+ function no_items() {
330
+ _e( 'Your email log is empty', 'email-log' );
331
+ }
332
  }
333
  ?>
include/install.php CHANGED
@@ -6,10 +6,9 @@
6
  * @subpackage Install
7
  * @author Sudar
8
  * @since 1.7
9
- */
10
 
11
- // Exit if accessed directly
12
- if ( ! defined( 'ABSPATH' ) ) exit;
13
 
14
  /**
15
  * Helper class to create and maintain tables
@@ -18,98 +17,100 @@ if ( ! defined( 'ABSPATH' ) ) exit;
18
  */
19
  class Email_Log_Init {
20
 
21
- /**
22
- * Perform activation based on multisite or not
23
- *
24
- * @since 1.7
25
- * @static
26
- * @access public
27
- *
28
- * @global object $wpdb
29
- */
30
- public static function on_activate( $network_wide ) {
31
- global $wpdb;
32
-
33
- if ( is_multisite() && $network_wide ) {
34
- // store the current blog id
35
- $current_blog = $wpdb->blogid;
36
-
37
- // Get all blogs in the network and activate plugin on each one
38
- $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
39
- foreach ( $blog_ids as $blog_id ) {
40
- switch_to_blog( $blog_id );
41
- self::create_emaillog_table();
42
- restore_current_blog();
43
- }
44
- } else {
45
- self::create_emaillog_table();
46
- }
47
- }
48
-
49
- /**
50
- * Create email log table when a new blog is created
51
- *
52
- * @since 1.7
53
- * @static
54
- * @access public
55
- */
56
- public static function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
57
- if ( is_plugin_active_for_network( 'email-log/email-log.php' ) ) {
58
- switch_to_blog( $blog_id );
59
- self::create_emaillog_table();
60
- restore_current_blog();
61
- }
62
- }
63
-
64
- /**
65
- * Delete email log table when a blog is deleted
66
- *
67
- * @since 1.7
68
- * @static
69
- * @access public
70
- *
71
- * @global object $wpdb
72
- * @param array $tables List of tables to be deleted
73
- * @return array $tables Modified list of tables to be deleted
74
- */
75
- public static function on_delete_blog( $tables ) {
76
- global $wpdb;
77
- $tables[] = $wpdb->prefix . EmailLog::TABLE_NAME;
78
- return $tables;
79
- }
80
-
81
- /**
82
- * Create email log table
83
- *
84
- * @since 1.7
85
- * @static
86
- * @access private
87
- *
88
- * @global object $wpdb
89
- */
90
- private static function create_emaillog_table() {
91
- global $wpdb;
92
- $table_name = $wpdb->prefix . EmailLog::TABLE_NAME;
93
-
94
- if( $wpdb->get_var( "show tables like '{$table_name}'" ) != $table_name ) {
95
-
96
- $sql = "CREATE TABLE " . $table_name . " (
97
- id mediumint(9) NOT NULL AUTO_INCREMENT,
98
- to_email VARCHAR(100) NOT NULL,
99
- subject VARCHAR(250) NOT NULL,
100
- message TEXT NOT NULL,
101
- headers TEXT NOT NULL,
102
- attachments TEXT NOT NULL,
103
- sent_date timestamp NOT NULL,
104
- PRIMARY KEY (id)
105
- );";
106
-
107
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
108
- dbDelta( $sql );
109
-
110
- add_option( EmailLog::DB_OPTION_NAME, EmailLog::DB_VERSION );
111
- }
112
- }
 
 
113
  }
114
 
115
  // When the Plugin installed
6
  * @subpackage Install
7
  * @author Sudar
8
  * @since 1.7
9
+ */
10
 
11
+ defined( 'ABSPATH' ) || exit; // Exit if accessed directly
 
12
 
13
  /**
14
  * Helper class to create and maintain tables
17
  */
18
  class Email_Log_Init {
19
 
20
+ /**
21
+ * Perform activation based on multisite or not
22
+ *
23
+ * @since 1.7
24
+ * @static
25
+ * @access public
26
+ *
27
+ * @global object $wpdb
28
+ */
29
+ public static function on_activate( $network_wide ) {
30
+ global $wpdb;
31
+
32
+ if ( is_multisite() && $network_wide ) {
33
+ // store the current blog id
34
+ $current_blog = $wpdb->blogid;
35
+
36
+ // Get all blogs in the network and activate plugin on each one
37
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
38
+ foreach ( $blog_ids as $blog_id ) {
39
+ switch_to_blog( $blog_id );
40
+ self::create_emaillog_table();
41
+ restore_current_blog();
42
+ }
43
+ } else {
44
+ self::create_emaillog_table();
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Create email log table when a new blog is created
50
+ *
51
+ * @since 1.7
52
+ * @static
53
+ * @access public
54
+ */
55
+ public static function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
56
+ if ( is_plugin_active_for_network( 'email-log/email-log.php' ) ) {
57
+ switch_to_blog( $blog_id );
58
+ self::create_emaillog_table();
59
+ restore_current_blog();
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Delete email log table when a blog is deleted
65
+ *
66
+ * @since 1.7
67
+ * @static
68
+ * @access public
69
+ *
70
+ * @global object $wpdb
71
+ * @param array $tables List of tables to be deleted
72
+ * @return array $tables Modified list of tables to be deleted
73
+ */
74
+ public static function on_delete_blog( $tables ) {
75
+ global $wpdb;
76
+ $tables[] = $wpdb->prefix . EmailLog::TABLE_NAME;
77
+ return $tables;
78
+ }
79
+
80
+ /**
81
+ * Create email log table
82
+ *
83
+ * @since 1.7
84
+ * @static
85
+ * @access private
86
+ *
87
+ * @global object $wpdb
88
+ */
89
+ private static function create_emaillog_table() {
90
+ global $wpdb;
91
+
92
+ $table_name = $wpdb->prefix . EmailLog::TABLE_NAME;
93
+ $charset_collate = $wpdb->get_charset_collate();
94
+
95
+ if ( $wpdb->get_var( "show tables like '{$table_name}'" ) != $table_name ) {
96
+
97
+ $sql = 'CREATE TABLE ' . $table_name . ' (
98
+ id mediumint(9) NOT NULL AUTO_INCREMENT,
99
+ to_email VARCHAR(100) NOT NULL,
100
+ subject VARCHAR(250) NOT NULL,
101
+ message TEXT NOT NULL,
102
+ headers TEXT NOT NULL,
103
+ attachments TEXT NOT NULL,
104
+ sent_date timestamp NOT NULL,
105
+ PRIMARY KEY (id)
106
+ ) ' . $charset_collate . ' ;';
107
+
108
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
109
+ dbDelta( $sql );
110
+
111
+ add_option( EmailLog::DB_OPTION_NAME, EmailLog::DB_VERSION );
112
+ }
113
+ }
114
  }
115
 
116
  // When the Plugin installed
languages/email-log.pot CHANGED
@@ -1,156 +1,179 @@
1
- # Copyright (C) 2014 Email Log
2
  # This file is distributed under the same license as the Email Log package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Email Log 1.7.5\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/email-log\n"
7
- "POT-Creation-Date: 2014-09-24 06:48:43+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: email-log.php:101
16
  msgid "Buy Addons"
17
  msgstr ""
18
 
19
- #: email-log.php:111
 
 
20
  msgid "Email Log"
21
  msgstr ""
22
 
23
- #: email-log.php:127
24
  msgid "Email Logs"
25
  msgstr ""
26
 
27
- #: email-log.php:133
28
  msgid "1 email log deleted."
29
  msgid_plural "%s email logs deleted"
30
  msgstr[0] ""
31
  msgstr[1] ""
32
 
33
- #: email-log.php:135
34
  msgid "There was some problem in deleting the email logs"
35
  msgstr ""
36
 
37
- #: email-log.php:143
38
  msgid "Search Logs"
39
  msgstr ""
40
 
41
- #: email-log.php:176 tmp_addon/email-log-forward-email.php:152
42
  msgid "About Plugin"
43
  msgstr ""
44
 
45
- #: email-log.php:178 tmp_addon/email-log-forward-email.php:154
46
- msgid "Email Log WordPress Plugin, allows you to log all emails that are sent through WordPress."
 
 
47
  msgstr ""
48
 
49
- #: email-log.php:185 tmp_addon/email-log-forward-email.php:162
50
  msgid "More information"
51
  msgstr ""
52
 
53
- #: email-log.php:186 tmp_addon/email-log-forward-email.php:163
54
  msgid "Plugin Homepage/support"
55
  msgstr ""
56
 
57
- #: email-log.php:187 tmp_addon/email-log-forward-email.php:164
58
  msgid "Plugin author's blog"
59
  msgstr ""
60
 
61
- #: email-log.php:188 tmp_addon/email-log-forward-email.php:165
62
  msgid "Other Plugin's by Author"
63
  msgstr ""
64
 
65
- #: email-log.php:195
66
  msgid "Entries per page"
67
  msgstr ""
68
 
69
- #: email-log.php:283
70
  msgid "Log"
71
  msgstr ""
72
 
73
- #: email-log.php:293
74
  msgid "plugin"
75
  msgstr ""
76
 
77
- #: email-log.php:293
78
  msgid "Version"
79
  msgstr ""
80
 
81
- #: email-log.php:293
82
  msgid "by"
83
  msgstr ""
84
 
85
- #: include/class-email-log-list-table.php:36
86
  msgid "More fields are available in Pro addon. "
87
  msgstr ""
88
 
89
- #: include/class-email-log-list-table.php:38
90
  msgid "Buy Now"
91
  msgstr ""
92
 
93
- #: include/class-email-log-list-table.php:49
94
- msgid "The following are the list of pro addons that are currently available for purchase."
 
 
95
  msgstr ""
96
 
97
- #: include/class-email-log-list-table.php:55
98
- msgid "Email Log - Forward Email"
99
  msgstr ""
100
 
101
- #: include/class-email-log-list-table.php:56
102
- msgid "This addon allows you to send a copy of all emails send from WordPress to another email address"
103
  msgstr ""
104
 
105
- #: include/class-email-log-list-table.php:57
106
- #: include/class-email-log-list-table.php:64
 
107
  msgid "More Info"
108
  msgstr ""
109
 
110
- #: include/class-email-log-list-table.php:58
111
- #: include/class-email-log-list-table.php:65
 
112
  msgid "Buy now"
113
  msgstr ""
114
 
115
- #: include/class-email-log-list-table.php:62
116
  msgid "Email Log - More fields"
117
  msgstr ""
118
 
119
- #: include/class-email-log-list-table.php:63
120
- msgid "Adds more fields (From, CC, BCC, Reply To, Attachment) to the logs page."
 
121
  msgstr ""
122
 
123
- #: include/class-email-log-list-table.php:81
 
 
 
 
 
 
 
 
 
 
124
  msgid "Sent at"
125
  msgstr ""
126
 
127
- #: include/class-email-log-list-table.php:82
128
  #: tmp_addon/email-log-forward-email.php:180
129
  msgid "To"
130
  msgstr ""
131
 
132
- #: include/class-email-log-list-table.php:83
133
  msgid "Subject"
134
  msgstr ""
135
 
136
- #: include/class-email-log-list-table.php:124
137
- #: include/class-email-log-list-table.php:174
138
- msgid "Delete"
139
  msgstr ""
140
 
141
- #: include/class-email-log-list-table.php:129
142
- msgid "%s @ %s"
143
  msgstr ""
144
 
145
- #: include/class-email-log-list-table.php:136
146
  msgid "View Content"
147
  msgstr ""
148
 
149
- #: include/class-email-log-list-table.php:175
 
 
 
 
 
150
  msgid "Delete All Logs"
151
  msgstr ""
152
 
153
- #: include/class-email-log-list-table.php:281
154
  msgid "Your email log is empty"
155
  msgstr ""
156
 
@@ -169,11 +192,13 @@ msgstr ""
169
 
170
  #: tmp_addon/email-log-forward-email.php:181
171
  #: tmp_addon/email-log-more-fields.php:81
 
172
  msgid "CC"
173
  msgstr ""
174
 
175
  #: tmp_addon/email-log-forward-email.php:182
176
  #: tmp_addon/email-log-more-fields.php:82
 
177
  msgid "BCC"
178
  msgstr ""
179
 
@@ -184,18 +209,42 @@ msgid "Enter multiple email address by separating them using comma"
184
  msgstr ""
185
 
186
  #: tmp_addon/email-log-more-fields.php:80
 
187
  msgid "From"
188
  msgstr ""
189
 
190
  #: tmp_addon/email-log-more-fields.php:83
 
191
  msgid "Reply To"
192
  msgstr ""
193
 
194
  #: tmp_addon/email-log-more-fields.php:84
195
  msgid "Attachment"
196
  msgstr ""
197
- #. Plugin Name of the plugin/theme
198
- msgid "Email Log"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  msgstr ""
200
 
201
  #. Plugin URI of the plugin/theme
1
+ # Copyright (C) 2015 Email Log
2
  # This file is distributed under the same license as the Email Log package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Email Log 1.8\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/email-log\n"
7
+ "POT-Creation-Date: 2015-12-26 13:39:54+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: email-log.php:106
16
  msgid "Buy Addons"
17
  msgstr ""
18
 
19
+ #. #-#-#-#-# email-log.pot (Email Log 1.8) #-#-#-#-#
20
+ #. Plugin Name of the plugin/theme
21
+ #: email-log.php:117
22
  msgid "Email Log"
23
  msgstr ""
24
 
25
+ #: email-log.php:131
26
  msgid "Email Logs"
27
  msgstr ""
28
 
29
+ #: email-log.php:137
30
  msgid "1 email log deleted."
31
  msgid_plural "%s email logs deleted"
32
  msgstr[0] ""
33
  msgstr[1] ""
34
 
35
+ #: email-log.php:139
36
  msgid "There was some problem in deleting the email logs"
37
  msgstr ""
38
 
39
+ #: email-log.php:147
40
  msgid "Search Logs"
41
  msgstr ""
42
 
43
+ #: email-log.php:187 tmp_addon/email-log-forward-email.php:152
44
  msgid "About Plugin"
45
  msgstr ""
46
 
47
+ #: email-log.php:189 tmp_addon/email-log-forward-email.php:154
48
+ msgid ""
49
+ "Email Log WordPress Plugin, allows you to log all emails that are sent "
50
+ "through WordPress."
51
  msgstr ""
52
 
53
+ #: email-log.php:196 tmp_addon/email-log-forward-email.php:162
54
  msgid "More information"
55
  msgstr ""
56
 
57
+ #: email-log.php:197 tmp_addon/email-log-forward-email.php:163
58
  msgid "Plugin Homepage/support"
59
  msgstr ""
60
 
61
+ #: email-log.php:198 tmp_addon/email-log-forward-email.php:164
62
  msgid "Plugin author's blog"
63
  msgstr ""
64
 
65
+ #: email-log.php:199 tmp_addon/email-log-forward-email.php:165
66
  msgid "Other Plugin's by Author"
67
  msgstr ""
68
 
69
+ #: email-log.php:206
70
  msgid "Entries per page"
71
  msgstr ""
72
 
73
+ #: email-log.php:288
74
  msgid "Log"
75
  msgstr ""
76
 
77
+ #: email-log.php:298
78
  msgid "plugin"
79
  msgstr ""
80
 
81
+ #: email-log.php:298
82
  msgid "Version"
83
  msgstr ""
84
 
85
+ #: email-log.php:298
86
  msgid "by"
87
  msgstr ""
88
 
89
+ #: include/class-email-log-list-table.php:33
90
  msgid "More fields are available in Pro addon. "
91
  msgstr ""
92
 
93
+ #: include/class-email-log-list-table.php:35
94
  msgid "Buy Now"
95
  msgstr ""
96
 
97
+ #: include/class-email-log-list-table.php:46
98
+ msgid ""
99
+ "The following are the list of pro addons that are currently available for "
100
+ "purchase."
101
  msgstr ""
102
 
103
+ #: include/class-email-log-list-table.php:52
104
+ msgid "Email Log - Resend Email"
105
  msgstr ""
106
 
107
+ #: include/class-email-log-list-table.php:53
108
+ msgid "Adds the ability to resend email from logs."
109
  msgstr ""
110
 
111
+ #: include/class-email-log-list-table.php:54
112
+ #: include/class-email-log-list-table.php:61
113
+ #: include/class-email-log-list-table.php:68
114
  msgid "More Info"
115
  msgstr ""
116
 
117
+ #: include/class-email-log-list-table.php:55
118
+ #: include/class-email-log-list-table.php:62
119
+ #: include/class-email-log-list-table.php:69
120
  msgid "Buy now"
121
  msgstr ""
122
 
123
+ #: include/class-email-log-list-table.php:59
124
  msgid "Email Log - More fields"
125
  msgstr ""
126
 
127
+ #: include/class-email-log-list-table.php:60
128
+ msgid ""
129
+ "Adds more fields (From, CC, BCC, Reply To, Attachment) to the logs page."
130
  msgstr ""
131
 
132
+ #: include/class-email-log-list-table.php:66
133
+ msgid "Email Log - Forward Email"
134
+ msgstr ""
135
+
136
+ #: include/class-email-log-list-table.php:67
137
+ msgid ""
138
+ "This addon allows you to send a copy of all emails send from WordPress to "
139
+ "another email address"
140
+ msgstr ""
141
+
142
+ #: include/class-email-log-list-table.php:85
143
  msgid "Sent at"
144
  msgstr ""
145
 
146
+ #: include/class-email-log-list-table.php:86
147
  #: tmp_addon/email-log-forward-email.php:180
148
  msgid "To"
149
  msgstr ""
150
 
151
+ #: include/class-email-log-list-table.php:87
152
  msgid "Subject"
153
  msgstr ""
154
 
155
+ #: include/class-email-log-list-table.php:125
156
+ msgid "%s @ %s"
 
157
  msgstr ""
158
 
159
+ #: include/class-email-log-list-table.php:144
160
+ msgid "Email Content"
161
  msgstr ""
162
 
163
+ #: include/class-email-log-list-table.php:145
164
  msgid "View Content"
165
  msgstr ""
166
 
167
+ #: include/class-email-log-list-table.php:159
168
+ #: include/class-email-log-list-table.php:219
169
+ msgid "Delete"
170
+ msgstr ""
171
+
172
+ #: include/class-email-log-list-table.php:220
173
  msgid "Delete All Logs"
174
  msgstr ""
175
 
176
+ #: include/class-email-log-list-table.php:330
177
  msgid "Your email log is empty"
178
  msgstr ""
179
 
192
 
193
  #: tmp_addon/email-log-forward-email.php:181
194
  #: tmp_addon/email-log-more-fields.php:81
195
+ #: tmp_addon/email-log-resend-email.php:50
196
  msgid "CC"
197
  msgstr ""
198
 
199
  #: tmp_addon/email-log-forward-email.php:182
200
  #: tmp_addon/email-log-more-fields.php:82
201
+ #: tmp_addon/email-log-resend-email.php:54
202
  msgid "BCC"
203
  msgstr ""
204
 
209
  msgstr ""
210
 
211
  #: tmp_addon/email-log-more-fields.php:80
212
+ #: tmp_addon/email-log-resend-email.php:46
213
  msgid "From"
214
  msgstr ""
215
 
216
  #: tmp_addon/email-log-more-fields.php:83
217
+ #: tmp_addon/email-log-resend-email.php:58
218
  msgid "Reply To"
219
  msgstr ""
220
 
221
  #: tmp_addon/email-log-more-fields.php:84
222
  msgid "Attachment"
223
  msgstr ""
224
+
225
+ #: tmp_addon/email-log-resend-email.php:27
226
+ msgid "Email Details"
227
+ msgstr ""
228
+
229
+ #: tmp_addon/email-log-resend-email.php:43
230
+ msgid "Additional Details"
231
+ msgstr ""
232
+
233
+ #: tmp_addon/email-log-resend-email.php:62
234
+ msgid "Content Type"
235
+ msgstr ""
236
+
237
+ #: tmp_addon/email-log-resend-email.php:66
238
+ #: tmp_addon/email-log-resend-email.php:85
239
+ msgid "Resend Email"
240
+ msgstr ""
241
+
242
+ #: tmp_addon/email-log-resend-email.php:182
243
+ msgid "Email was successfully resent"
244
+ msgstr ""
245
+
246
+ #: tmp_addon/email-log-resend-email.php:184
247
+ msgid "There was some problem in sending the email"
248
  msgstr ""
249
 
250
  #. Plugin URI of the plugin/theme
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: sudar
3
  Tags: email, log, multisite
4
  Requires at least: 3.3
5
- Tested up to: 4.0
6
- Stable tag: 1.7.5
7
 
8
  Logs every email sent through WordPress. Works with WordPress Multisite as well
9
 
@@ -19,9 +19,9 @@ The logged emails will be stored in a separate table and can be viewed from the
19
 
20
  In the admin interface, all the logged emails can be delete in bulk or can also be selectively deleted based on date, email and subject.
21
 
22
- ### Forward email (Pro addon)
23
 
24
- You can [buy the Forward email pro addon](http://sudarmuthu.com/wordpress/email-log/pro-addons#forward-email-addon), which allows you to send a copy of all the emails send from WordPress, to another email address. The addon allows you to choose whether you want to forward through to, cc or bcc fields. This can be extremely useful when you want to debug by analyzing the emails that are sent from WordPress. The cost of the addon is $15 and you can buy it through [paypal](http://sudarmuthu.com/out/buy-email-log-forward-email-addon).
25
 
26
  ### More Fields (Pro addon)
27
 
@@ -35,6 +35,9 @@ You can [buy the More Fields pro addon](http://sudarmuthu.com/wordpress/email-lo
35
 
36
  The cost of the addon is $15 and you can buy it through [paypal](http://sudarmuthu.com/out/buy-email-log-more-fields-addon).
37
 
 
 
 
38
 
39
  ### Cleaning up db on uninstall
40
 
@@ -118,6 +121,15 @@ wpmandrill plugin has a bug that prevents this plugin from logging the content o
118
  This Readme file was generated using <a href = 'http://sudarmuthu.com/wordpress/wp-readme'>wp-readme</a>, which generates readme files for WordPress Plugins.
119
  == Changelog ==
120
 
 
 
 
 
 
 
 
 
 
121
  = v1.7.5 (2014-09-23) - (Dev time: 1 hour) =
122
  - Tweak: Remove PHP 4.0 compatibility code
123
  - Tweak: Tweak the install code (issue #26)
@@ -225,6 +237,9 @@ This Readme file was generated using <a href = 'http://sudarmuthu.com/wordpress/
225
 
226
  == Upgrade Notice ==
227
 
 
 
 
228
  = 1.7.5 =
229
  Fix a bug in the save user options function
230
 
2
  Contributors: sudar
3
  Tags: email, log, multisite
4
  Requires at least: 3.3
5
+ Tested up to: 4.4
6
+ Stable tag: 1.8
7
 
8
  Logs every email sent through WordPress. Works with WordPress Multisite as well
9
 
19
 
20
  In the admin interface, all the logged emails can be delete in bulk or can also be selectively deleted based on date, email and subject.
21
 
22
+ ### Resend email (Pro addon)
23
 
24
+ You can [buy the Resend email pro addon](http://sudarmuthu.com/wordpress/email-log/pro-addons#resend-email-addon), which allows you to resend the email directly from the email log. The addon allows you to modify the different fields before resending the email. The cost of the addon is $15 and you can buy it through [paypal](http://sudarmuthu.com/out/buy-email-log-resend-email-addon).
25
 
26
  ### More Fields (Pro addon)
27
 
35
 
36
  The cost of the addon is $15 and you can buy it through [paypal](http://sudarmuthu.com/out/buy-email-log-more-fields-addon).
37
 
38
+ ### Forward email (Pro addon)
39
+
40
+ You can [buy the Forward email pro addon](http://sudarmuthu.com/wordpress/email-log/pro-addons#forward-email-addon), which allows you to send a copy of all the emails send from WordPress, to another email address. The addon allows you to choose whether you want to forward through to, cc or bcc fields. This can be extremely useful when you want to debug by analyzing the emails that are sent from WordPress. The cost of the addon is $15 and you can buy it through [paypal](http://sudarmuthu.com/out/buy-email-log-forward-email-addon).
41
 
42
  ### Cleaning up db on uninstall
43
 
121
  This Readme file was generated using <a href = 'http://sudarmuthu.com/wordpress/wp-readme'>wp-readme</a>, which generates readme files for WordPress Plugins.
122
  == Changelog ==
123
 
124
+ = v1.8 (2015-12-26) - (Dev time: 5 hour) =
125
+ - New: Added filters and actions for addons
126
+ - New: Added Resend Email Addon
127
+ - Tweak: Optimize for large number of logs
128
+ - Tweak: Use charset and collate that is defined in wp-config.php file
129
+ - Tweak: Format email content
130
+ - Tweak: Remove PHP4 compatible code
131
+ - Fix: Sanitize the delete email log url
132
+
133
  = v1.7.5 (2014-09-23) - (Dev time: 1 hour) =
134
  - Tweak: Remove PHP 4.0 compatibility code
135
  - Tweak: Tweak the install code (issue #26)
237
 
238
  == Upgrade Notice ==
239
 
240
+ = 1.8 =
241
+ Added support for resending emails through addon
242
+
243
  = 1.7.5 =
244
  Fix a bug in the save user options function
245