@@ -69,7 +69,7 @@ |
||
69 | 69 | * |
70 | 70 | * @global object $wpdb |
71 | 71 | * @param array $tables List of tables to be deleted |
72 | - * @return array $tables Modified list of tables to be deleted |
|
72 | + * @return string[] $tables Modified list of tables to be deleted |
|
73 | 73 | */ |
74 | 74 | public static function on_delete_blog( $tables ) { |
75 | 75 | global $wpdb; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 1.7 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; // Exit if accessed directly |
|
11 | +defined('ABSPATH') || exit; // Exit if accessed directly |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Helper class to create and maintain tables |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @global object $wpdb |
28 | 28 | */ |
29 | - public static function on_activate( $network_wide ) { |
|
29 | + public static function on_activate($network_wide) { |
|
30 | 30 | global $wpdb; |
31 | 31 | |
32 | - if ( is_multisite() && $network_wide ) { |
|
32 | + if (is_multisite() && $network_wide) { |
|
33 | 33 | // store the current blog id |
34 | 34 | $current_blog = $wpdb->blogid; |
35 | 35 | |
36 | 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 ); |
|
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 | 40 | self::create_emaillog_table(); |
41 | 41 | restore_current_blog(); |
42 | 42 | } |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @static |
53 | 53 | * @access public |
54 | 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 ); |
|
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 | 58 | self::create_emaillog_table(); |
59 | 59 | restore_current_blog(); |
60 | 60 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param array $tables List of tables to be deleted |
72 | 72 | * @return array $tables Modified list of tables to be deleted |
73 | 73 | */ |
74 | - public static function on_delete_blog( $tables ) { |
|
74 | + public static function on_delete_blog($tables) { |
|
75 | 75 | global $wpdb; |
76 | 76 | $tables[] = $wpdb->prefix . EmailLog::TABLE_NAME; |
77 | 77 | return $tables; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $table_name = $wpdb->prefix . EmailLog::TABLE_NAME; |
93 | 93 | $charset_collate = $wpdb->get_charset_collate(); |
94 | 94 | |
95 | - if ( $wpdb->get_var( "show tables like '{$table_name}'" ) != $table_name ) { |
|
95 | + if ($wpdb->get_var("show tables like '{$table_name}'") != $table_name) { |
|
96 | 96 | |
97 | 97 | $sql = 'CREATE TABLE ' . $table_name . ' ( |
98 | 98 | id mediumint(9) NOT NULL AUTO_INCREMENT, |
@@ -105,20 +105,20 @@ discard block |
||
105 | 105 | PRIMARY KEY (id) |
106 | 106 | ) ' . $charset_collate . ' ;'; |
107 | 107 | |
108 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
109 | - dbDelta( $sql ); |
|
108 | + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
109 | + dbDelta($sql); |
|
110 | 110 | |
111 | - add_option( EmailLog::DB_OPTION_NAME, EmailLog::DB_VERSION ); |
|
111 | + add_option(EmailLog::DB_OPTION_NAME, EmailLog::DB_VERSION); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | // When the Plugin installed |
117 | -register_activation_hook( EMAIL_LOG_PLUGIN_FILE, array( 'Email_Log_Init', 'on_activate' ) ); |
|
117 | +register_activation_hook(EMAIL_LOG_PLUGIN_FILE, array('Email_Log_Init', 'on_activate')); |
|
118 | 118 | |
119 | 119 | // when a new blog is created in multisite |
120 | -add_action( 'wpmu_new_blog', array( 'Email_Log_Init', 'on_create_blog' ), 10, 6 ); |
|
120 | +add_action('wpmu_new_blog', array('Email_Log_Init', 'on_create_blog'), 10, 6); |
|
121 | 121 | |
122 | 122 | // when a blog is deleted in multisite |
123 | -add_filter( 'wpmu_drop_tables', array( 'Email_Log_Init', 'on_delete_blog' ) ); |
|
123 | +add_filter('wpmu_drop_tables', array('Email_Log_Init', 'on_delete_blog')); |
|
124 | 124 | ?> |
@@ -8,24 +8,24 @@ discard block |
||
8 | 8 | */ |
9 | 9 | // uninstall page for Email Log Plugin to clean up db. |
10 | 10 | if( !defined( 'ABSPATH' ) && !defined( 'WP_UNINSTALL_PLUGIN' ) ) |
11 | - exit(); |
|
11 | + exit(); |
|
12 | 12 | |
13 | 13 | if ( is_multisite() ) { |
14 | - global $wpdb; |
|
14 | + global $wpdb; |
|
15 | 15 | |
16 | - $original_blog_id = get_current_blog_id(); |
|
16 | + $original_blog_id = get_current_blog_id(); |
|
17 | 17 | |
18 | - $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
|
18 | + $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
|
19 | 19 | |
20 | - foreach ( $blog_ids as $blog_id ) { |
|
21 | - switch_to_blog( $blog_id ); |
|
22 | - email_log_delete_table(); |
|
23 | - } |
|
20 | + foreach ( $blog_ids as $blog_id ) { |
|
21 | + switch_to_blog( $blog_id ); |
|
22 | + email_log_delete_table(); |
|
23 | + } |
|
24 | 24 | |
25 | - switch_to_blog( $original_blog_id ); |
|
25 | + switch_to_blog( $original_blog_id ); |
|
26 | 26 | |
27 | 27 | } else { |
28 | - email_log_delete_table(); |
|
28 | + email_log_delete_table(); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | * @global object $wpdb |
37 | 37 | */ |
38 | 38 | function email_log_delete_table() { |
39 | - global $wpdb; |
|
40 | - $table_name = $wpdb->prefix . "email_log"; // This is hardcoded on purpose |
|
39 | + global $wpdb; |
|
40 | + $table_name = $wpdb->prefix . "email_log"; // This is hardcoded on purpose |
|
41 | 41 | |
42 | - if( $wpdb->get_var( "SHOW TABLES LIKE '{$table_name}'" ) == $table_name ) { |
|
43 | - // If table is present, drop it |
|
44 | - $wpdb->query( "DROP TABLE $table_name" ); |
|
45 | - } |
|
42 | + if( $wpdb->get_var( "SHOW TABLES LIKE '{$table_name}'" ) == $table_name ) { |
|
43 | + // If table is present, drop it |
|
44 | + $wpdb->query( "DROP TABLE $table_name" ); |
|
45 | + } |
|
46 | 46 | |
47 | - // Delete the option |
|
48 | - delete_option('email-log-db'); |
|
47 | + // Delete the option |
|
48 | + delete_option('email-log-db'); |
|
49 | 49 | } |
50 | 50 | ?> |
@@ -7,22 +7,22 @@ discard block |
||
7 | 7 | * @author Sudar |
8 | 8 | */ |
9 | 9 | // uninstall page for Email Log Plugin to clean up db. |
10 | -if( !defined( 'ABSPATH' ) && !defined( 'WP_UNINSTALL_PLUGIN' ) ) |
|
10 | +if ( ! defined('ABSPATH') && ! defined('WP_UNINSTALL_PLUGIN')) |
|
11 | 11 | exit(); |
12 | 12 | |
13 | -if ( is_multisite() ) { |
|
13 | +if (is_multisite()) { |
|
14 | 14 | global $wpdb; |
15 | 15 | |
16 | 16 | $original_blog_id = get_current_blog_id(); |
17 | 17 | |
18 | - $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
|
18 | + $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); |
|
19 | 19 | |
20 | - foreach ( $blog_ids as $blog_id ) { |
|
21 | - switch_to_blog( $blog_id ); |
|
20 | + foreach ($blog_ids as $blog_id) { |
|
21 | + switch_to_blog($blog_id); |
|
22 | 22 | email_log_delete_table(); |
23 | 23 | } |
24 | 24 | |
25 | - switch_to_blog( $original_blog_id ); |
|
25 | + switch_to_blog($original_blog_id); |
|
26 | 26 | |
27 | 27 | } else { |
28 | 28 | email_log_delete_table(); |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | global $wpdb; |
40 | 40 | $table_name = $wpdb->prefix . "email_log"; // This is hardcoded on purpose |
41 | 41 | |
42 | - if( $wpdb->get_var( "SHOW TABLES LIKE '{$table_name}'" ) == $table_name ) { |
|
42 | + if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") == $table_name) { |
|
43 | 43 | // If table is present, drop it |
44 | - $wpdb->query( "DROP TABLE $table_name" ); |
|
44 | + $wpdb->query("DROP TABLE $table_name"); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Delete the option |
@@ -7,8 +7,9 @@ |
||
7 | 7 | * @author Sudar |
8 | 8 | */ |
9 | 9 | // uninstall page for Email Log Plugin to clean up db. |
10 | -if( !defined( 'ABSPATH' ) && !defined( 'WP_UNINSTALL_PLUGIN' ) ) |
|
10 | +if( !defined( 'ABSPATH' ) && !defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
11 | 11 | exit(); |
12 | +} |
|
12 | 13 | |
13 | 14 | if ( is_multisite() ) { |
14 | 15 | global $wpdb; |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package EmailLog |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; // Exit if accessed directly |
|
9 | +defined('ABSPATH') || exit; // Exit if accessed directly |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Class Email Header Parser. |
@@ -23,26 +23,26 @@ discard block |
||
23 | 23 | * @param array $data Headers to be joined. |
24 | 24 | * @return string Joined headers. |
25 | 25 | */ |
26 | - public function join_headers( $data ) { |
|
26 | + public function join_headers($data) { |
|
27 | 27 | $headers = ''; |
28 | 28 | |
29 | - if ( ! empty( $data['from'] ) ) { |
|
29 | + if ( ! empty($data['from'])) { |
|
30 | 30 | $headers .= 'From: ' . $data['from'] . "\r\n"; |
31 | 31 | } |
32 | 32 | |
33 | - if ( ! empty( $data['cc'] ) ) { |
|
33 | + if ( ! empty($data['cc'])) { |
|
34 | 34 | $headers .= 'CC: ' . $data['cc'] . "\r\n"; |
35 | 35 | } |
36 | 36 | |
37 | - if ( ! empty( $data['bcc'] ) ) { |
|
37 | + if ( ! empty($data['bcc'])) { |
|
38 | 38 | $headers .= 'BCC: ' . $data['bcc'] . "\r\n"; |
39 | 39 | } |
40 | 40 | |
41 | - if ( ! empty( $data['reply_to'] ) ) { |
|
41 | + if ( ! empty($data['reply_to'])) { |
|
42 | 42 | $headers .= 'Reply-to: ' . $data['reply_to'] . "\r\n"; |
43 | 43 | } |
44 | 44 | |
45 | - if ( ! empty( $data['content_type'] ) ) { |
|
45 | + if ( ! empty($data['content_type'])) { |
|
46 | 46 | $headers .= 'Content-type: ' . $data['content_type'] . "\r\n"; |
47 | 47 | } |
48 | 48 | |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * @param string $headers Headers to parse |
56 | 56 | * @return array Parsed Headers. |
57 | 57 | */ |
58 | - public function parse_headers( $headers ) { |
|
59 | - return $this->parse( $headers ); |
|
58 | + public function parse_headers($headers) { |
|
59 | + return $this->parse($headers); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -67,16 +67,16 @@ discard block |
||
67 | 67 | * @param string $headers Headers to be parsed. |
68 | 68 | * @return array Parsed headers |
69 | 69 | */ |
70 | - private function parse( $headers ) { |
|
70 | + private function parse($headers) { |
|
71 | 71 | $data = array(); |
72 | - $arr_headers = explode( "\n", $headers ); |
|
72 | + $arr_headers = explode("\n", $headers); |
|
73 | 73 | |
74 | - foreach ( $arr_headers as $header ) { |
|
75 | - $split_header = explode( ':', $header ); |
|
76 | - $value = $this->parse_header_line( $split_header ); |
|
74 | + foreach ($arr_headers as $header) { |
|
75 | + $split_header = explode(':', $header); |
|
76 | + $value = $this->parse_header_line($split_header); |
|
77 | 77 | |
78 | - if ( trim( $value ) != '' ) { |
|
79 | - switch ( strtolower( $split_header[0] ) ) { |
|
78 | + if (trim($value) != '') { |
|
79 | + switch (strtolower($split_header[0])) { |
|
80 | 80 | case 'from': |
81 | 81 | $data['from'] = $value; |
82 | 82 | break; |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | * @param array $header Header line to be parsed |
112 | 112 | * @return string Parsed value |
113 | 113 | */ |
114 | - private function parse_header_line( $header ) { |
|
114 | + private function parse_header_line($header) { |
|
115 | 115 | $value = ''; |
116 | - if ( count( $header ) == 2 ) { |
|
117 | - if ( is_array( $header[1] ) ) { |
|
118 | - $value = trim( implode( ',', array_map( 'trim', $header[1] ) ) ); |
|
116 | + if (count($header) == 2) { |
|
117 | + if (is_array($header[1])) { |
|
118 | + $value = trim(implode(',', array_map('trim', $header[1]))); |
|
119 | 119 | } else { |
120 | - $value = trim( $header[1] ); |
|
120 | + $value = trim($header[1]); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |
@@ -30,7 +30,6 @@ |
||
30 | 30 | * |
31 | 31 | * @since 1.9 |
32 | 32 | * |
33 | - * @param $string $email Email string to be sanitized. |
|
34 | 33 | * |
35 | 34 | * @return string Sanitized email. |
36 | 35 | */ |
@@ -14,15 +14,15 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @return string Sanitized email. |
16 | 16 | */ |
17 | -function el_sanitize_email( $email, $multiple = true ) { |
|
18 | - $emails = explode( ',', $email ); |
|
19 | - if ( ! $multiple ) { |
|
20 | - $emails = array_slice( $emails, 0, 1 ); |
|
17 | +function el_sanitize_email($email, $multiple = true) { |
|
18 | + $emails = explode(',', $email); |
|
19 | + if ( ! $multiple) { |
|
20 | + $emails = array_slice($emails, 0, 1); |
|
21 | 21 | } |
22 | 22 | |
23 | - $cleaned_emails = array_map( 'el_sanitize_email_with_name', $emails ); |
|
23 | + $cleaned_emails = array_map('el_sanitize_email_with_name', $emails); |
|
24 | 24 | |
25 | - return implode( ', ', $cleaned_emails ); |
|
25 | + return implode(', ', $cleaned_emails); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -34,23 +34,23 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @return string Sanitized email. |
36 | 36 | */ |
37 | -function el_sanitize_email_with_name( $string ) { |
|
38 | - $string = trim( $string ); |
|
37 | +function el_sanitize_email_with_name($string) { |
|
38 | + $string = trim($string); |
|
39 | 39 | |
40 | - $bracket_pos = strpos( $string, '<' ); |
|
41 | - if ( $bracket_pos !== false ) { |
|
40 | + $bracket_pos = strpos($string, '<'); |
|
41 | + if ($bracket_pos !== false) { |
|
42 | 42 | // Text before the bracketed email is the name. |
43 | - if ( $bracket_pos > 0 ) { |
|
44 | - $name = substr( $string, 0, $bracket_pos ); |
|
45 | - $name = str_replace( '"', '', $name ); |
|
46 | - $name = trim( $name ); |
|
43 | + if ($bracket_pos > 0) { |
|
44 | + $name = substr($string, 0, $bracket_pos); |
|
45 | + $name = str_replace('"', '', $name); |
|
46 | + $name = trim($name); |
|
47 | 47 | |
48 | - $email = substr( $string, $bracket_pos + 1 ); |
|
49 | - $email = str_replace( '>', '', $email ); |
|
48 | + $email = substr($string, $bracket_pos + 1); |
|
49 | + $email = str_replace('>', '', $email); |
|
50 | 50 | |
51 | - return sanitize_text_field( $name ) . ' <' . sanitize_email( $email ) . '>'; |
|
51 | + return sanitize_text_field($name) . ' <' . sanitize_email($email) . '>'; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - return sanitize_email( $string ); |
|
55 | + return sanitize_email($string); |
|
56 | 56 | } |
57 | 57 | \ No newline at end of file |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | * We use the parent reference to set some default configs. |
16 | 16 | */ |
17 | 17 | public function __construct() { |
18 | - parent::__construct( array( |
|
19 | - 'singular' => 'email-log', //singular name of the listed records |
|
20 | - 'plural' => 'email-logs', //plural name of the listed records |
|
21 | - 'ajax' => false, //does this table support ajax? |
|
22 | - ) ); |
|
18 | + parent::__construct(array( |
|
19 | + 'singular' => 'email-log', //singular name of the listed records |
|
20 | + 'plural' => 'email-logs', //plural name of the listed records |
|
21 | + 'ajax' => false, //does this table support ajax? |
|
22 | + )); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -29,47 +29,47 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param string $which Add the markup after (bottom) or before (top) the list. |
31 | 31 | */ |
32 | - protected function extra_tablenav( $which ) { |
|
33 | - if ( 'top' == $which ) { |
|
32 | + protected function extra_tablenav($which) { |
|
33 | + if ('top' == $which) { |
|
34 | 34 | // The code that goes before the table is here. |
35 | 35 | echo '<span id = "el-pro-msg">'; |
36 | - _e( 'More fields are available in Pro addon. ', 'email-log' ); |
|
36 | + _e('More fields are available in Pro addon. ', 'email-log'); |
|
37 | 37 | echo '<a href = "http://sudarmuthu.com/out/buy-email-log-more-fields-addon" style = "color:red">'; |
38 | - _e( 'Buy Now', 'email-log' ); |
|
38 | + _e('Buy Now', 'email-log'); |
|
39 | 39 | echo '</a>'; |
40 | 40 | echo '</span>'; |
41 | 41 | } |
42 | 42 | |
43 | - if ( 'bottom' == $which ) { |
|
43 | + if ('bottom' == $which) { |
|
44 | 44 | // The code that goes after the table is here. |
45 | 45 | echo '<p> </p>'; |
46 | 46 | echo '<p> </p>'; |
47 | 47 | |
48 | 48 | echo '<p>'; |
49 | - _e( 'The following are the list of pro addons that are currently available for purchase.', 'email-log' ); |
|
49 | + _e('The following are the list of pro addons that are currently available for purchase.', 'email-log'); |
|
50 | 50 | echo '</p>'; |
51 | 51 | |
52 | 52 | echo '<ul style="list-style:disc; padding-left:35px">'; |
53 | 53 | |
54 | 54 | echo '<li>'; |
55 | - echo '<strong>', __( 'Email Log - Resend Email', 'email-log' ), '</strong>', ' - '; |
|
56 | - echo __( 'Adds the ability to resend email from logs.', 'email-log' ); |
|
57 | - echo ' <a href = "http://sudarmuthu.com/wordpress/email-log/pro-addons#resend-email-addon">', __( 'More Info', 'email-log' ), '</a>.'; |
|
58 | - echo ' <a href = "http://sudarmuthu.com/out/buy-email-log-resend-email-addon">', __( 'Buy now', 'email-log' ), '</a>'; |
|
55 | + echo '<strong>', __('Email Log - Resend Email', 'email-log'), '</strong>', ' - '; |
|
56 | + echo __('Adds the ability to resend email from logs.', 'email-log'); |
|
57 | + echo ' <a href = "http://sudarmuthu.com/wordpress/email-log/pro-addons#resend-email-addon">', __('More Info', 'email-log'), '</a>.'; |
|
58 | + echo ' <a href = "http://sudarmuthu.com/out/buy-email-log-resend-email-addon">', __('Buy now', 'email-log'), '</a>'; |
|
59 | 59 | echo '</li>'; |
60 | 60 | |
61 | 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>'; |
|
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 | 66 | echo '</li>'; |
67 | 67 | |
68 | 68 | echo '<li>'; |
69 | - echo '<strong>', __( 'Email Log - Forward Email', 'email-log' ), '</strong>', ' - '; |
|
70 | - echo __( 'This addon allows you to send a copy of all emails send from WordPress to another email address', 'email-log' ); |
|
71 | - echo ' <a href = "http://sudarmuthu.com/wordpress/email-log/pro-addons#forward-email-addon">', __( 'More Info', 'email-log' ), '</a>.'; |
|
72 | - echo ' <a href = "http://sudarmuthu.com/out/buy-email-log-forward-email-addon">', __( 'Buy now', 'email-log' ), '</a>'; |
|
69 | + echo '<strong>', __('Email Log - Forward Email', 'email-log'), '</strong>', ' - '; |
|
70 | + echo __('This addon allows you to send a copy of all emails send from WordPress to another email address', 'email-log'); |
|
71 | + echo ' <a href = "http://sudarmuthu.com/wordpress/email-log/pro-addons#forward-email-addon">', __('More Info', 'email-log'), '</a>.'; |
|
72 | + echo ' <a href = "http://sudarmuthu.com/out/buy-email-log-forward-email-addon">', __('Buy now', 'email-log'), '</a>'; |
|
73 | 73 | echo '</li>'; |
74 | 74 | |
75 | 75 | echo '</ul>'; |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | public function get_columns() { |
87 | 87 | $columns = array( |
88 | 88 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
89 | - 'sent_date' => __( 'Sent at', 'email-log' ), |
|
90 | - 'to' => __( 'To', 'email-log' ), |
|
91 | - 'subject' => __( 'Subject', 'email-log' ), |
|
89 | + 'sent_date' => __('Sent at', 'email-log'), |
|
90 | + 'to' => __('To', 'email-log'), |
|
91 | + 'subject' => __('Subject', 'email-log'), |
|
92 | 92 | ); |
93 | 93 | |
94 | - return apply_filters( EmailLog::HOOK_LOG_COLUMNS, $columns ); |
|
94 | + return apply_filters(EmailLog::HOOK_LOG_COLUMNS, $columns); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function get_sortable_columns() { |
105 | 105 | $sortable_columns = array( |
106 | - 'sent_date' => array( 'sent_date', true ), //true means it's already sorted |
|
107 | - 'to' => array( 'to_email', false ), |
|
108 | - 'subject' => array( 'subject', false ), |
|
106 | + 'sent_date' => array('sent_date', true), //true means it's already sorted |
|
107 | + 'to' => array('to_email', false), |
|
108 | + 'subject' => array('subject', false), |
|
109 | 109 | ); |
110 | 110 | return $sortable_columns; |
111 | 111 | } |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | * @param object $item |
119 | 119 | * @param string $column_name |
120 | 120 | */ |
121 | - protected function column_default( $item, $column_name ) { |
|
122 | - do_action( EmailLog::HOOK_LOG_DISPLAY_COLUMNS, $column_name, $item ); |
|
121 | + protected function column_default($item, $column_name) { |
|
122 | + do_action(EmailLog::HOOK_LOG_DISPLAY_COLUMNS, $column_name, $item); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @param object $item Current item object. |
131 | 131 | * @return string Markup to be displayed for the column. |
132 | 132 | */ |
133 | - protected function column_sent_date( $item ) { |
|
133 | + protected function column_sent_date($item) { |
|
134 | 134 | $email_date = mysql2date( |
135 | - sprintf( __( '%s @ %s', 'email-log' ), get_option( 'date_format', 'F j, Y' ), get_option( 'time_format', 'g:i A' ) ), |
|
135 | + sprintf(__('%s @ %s', 'email-log'), get_option('date_format', 'F j, Y'), get_option('time_format', 'g:i A')), |
|
136 | 136 | $item->sent_date |
137 | 137 | ); |
138 | 138 | |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | 'admin-ajax.php' |
150 | 150 | ); |
151 | 151 | |
152 | - $actions['view-content'] = sprintf( '<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>', |
|
153 | - esc_url( $content_ajax_url ), |
|
154 | - __( 'Email Content', 'email-log' ), |
|
155 | - __( 'View Content', 'email-log' ) |
|
152 | + $actions['view-content'] = sprintf('<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>', |
|
153 | + esc_url($content_ajax_url), |
|
154 | + __('Email Content', 'email-log'), |
|
155 | + __('View Content', 'email-log') |
|
156 | 156 | ); |
157 | 157 | |
158 | 158 | $delete_url = add_query_arg( |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | 'page' => $_REQUEST['page'], |
161 | 161 | 'action' => 'delete', |
162 | 162 | $this->_args['singular'] => $item->id, |
163 | - EmailLog::DELETE_LOG_NONCE_FIELD => wp_create_nonce( EmailLog::DELETE_LOG_ACTION ), |
|
163 | + EmailLog::DELETE_LOG_NONCE_FIELD => wp_create_nonce(EmailLog::DELETE_LOG_ACTION), |
|
164 | 164 | ) |
165 | 165 | ); |
166 | 166 | |
167 | - $actions['delete'] = sprintf( '<a href="%s">%s</a>', |
|
168 | - esc_url( $delete_url ), |
|
169 | - __( 'Delete', 'email-log' ) |
|
167 | + $actions['delete'] = sprintf('<a href="%s">%s</a>', |
|
168 | + esc_url($delete_url), |
|
169 | + __('Delete', 'email-log') |
|
170 | 170 | ); |
171 | 171 | |
172 | 172 | /** |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | * @param array $actions List of actions. |
178 | 178 | * @param object $item The current log item. |
179 | 179 | */ |
180 | - $actions = apply_filters( 'el_row_actions', $actions, $item ); |
|
180 | + $actions = apply_filters('el_row_actions', $actions, $item); |
|
181 | 181 | |
182 | - return sprintf( '%1$s <span style="color:silver">(id:%2$s)</span>%3$s', |
|
182 | + return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s', |
|
183 | 183 | /*$1%s*/ $email_date, |
184 | 184 | /*$2%s*/ $item->id, |
185 | - /*$3%s*/ $this->row_actions( $actions ) |
|
185 | + /*$3%s*/ $this->row_actions($actions) |
|
186 | 186 | ); |
187 | 187 | } |
188 | 188 | |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | * @param object $item |
195 | 195 | * @return string |
196 | 196 | */ |
197 | - protected function column_to( $item ) { |
|
198 | - return esc_html( $item->to_email ); |
|
197 | + protected function column_to($item) { |
|
198 | + return esc_html($item->to_email); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | * @param object $item |
207 | 207 | * @return string |
208 | 208 | */ |
209 | - protected function column_subject( $item ) { |
|
210 | - return esc_html( $item->subject ); |
|
209 | + protected function column_subject($item) { |
|
210 | + return esc_html($item->subject); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @param object $item |
219 | 219 | * @return string |
220 | 220 | */ |
221 | - protected function column_cb( $item ) { |
|
221 | + protected function column_cb($item) { |
|
222 | 222 | return sprintf( |
223 | 223 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
224 | 224 | /*$1%s*/ $this->_args['singular'], |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | */ |
236 | 236 | protected function get_bulk_actions() { |
237 | 237 | $actions = array( |
238 | - 'delete' => __( 'Delete', 'email-log' ), |
|
239 | - 'delete-all' => __( 'Delete All Logs', 'email-log' ), |
|
238 | + 'delete' => __('Delete', 'email-log'), |
|
239 | + 'delete-all' => __('Delete All Logs', 'email-log'), |
|
240 | 240 | ); |
241 | 241 | return $actions; |
242 | 242 | } |
@@ -250,16 +250,16 @@ discard block |
||
250 | 250 | global $wpdb; |
251 | 251 | global $EmailLog; //@codingStandardsIgnoreLine |
252 | 252 | |
253 | - if ( 'delete' === $this->current_action() ) { |
|
253 | + if ('delete' === $this->current_action()) { |
|
254 | 254 | // Delete a list of logs by id. |
255 | 255 | |
256 | - $nonce = $_REQUEST[ EmailLog::DELETE_LOG_NONCE_FIELD ]; |
|
257 | - if ( wp_verify_nonce( $nonce, EmailLog::DELETE_LOG_ACTION ) ) { |
|
256 | + $nonce = $_REQUEST[EmailLog::DELETE_LOG_NONCE_FIELD]; |
|
257 | + if (wp_verify_nonce($nonce, EmailLog::DELETE_LOG_ACTION)) { |
|
258 | 258 | |
259 | - $ids = $_GET[ $this->_args['singular'] ]; |
|
259 | + $ids = $_GET[$this->_args['singular']]; |
|
260 | 260 | |
261 | - if ( is_array( $ids ) ) { |
|
262 | - $selected_ids = implode( ',', $ids ); |
|
261 | + if (is_array($ids)) { |
|
262 | + $selected_ids = implode(',', $ids); |
|
263 | 263 | } else { |
264 | 264 | $selected_ids = $ids; |
265 | 265 | } |
@@ -267,21 +267,21 @@ discard block |
||
267 | 267 | // Can't use wpdb->prepare for the below query. If used it results in this bug |
268 | 268 | // https://github.com/sudar/email-log/issues/13 |
269 | 269 | |
270 | - $selected_ids = esc_sql( $selected_ids ); |
|
270 | + $selected_ids = esc_sql($selected_ids); |
|
271 | 271 | |
272 | 272 | $table_name = $wpdb->prefix . EmailLog::TABLE_NAME; |
273 | - $EmailLog->logs_deleted = $wpdb->query( "DELETE FROM $table_name where id IN ( $selected_ids )" ); //@codingStandardsIgnoreLine |
|
273 | + $EmailLog->logs_deleted = $wpdb->query("DELETE FROM $table_name where id IN ( $selected_ids )"); //@codingStandardsIgnoreLine |
|
274 | 274 | } else { |
275 | - wp_die( 'Cheating, Huh? ' ); |
|
275 | + wp_die('Cheating, Huh? '); |
|
276 | 276 | } |
277 | - } elseif ( 'delete-all' === $this->current_action() ) { |
|
277 | + } elseif ('delete-all' === $this->current_action()) { |
|
278 | 278 | // Delete all logs. |
279 | - $nonce = $_REQUEST[ EmailLog::DELETE_LOG_NONCE_FIELD ]; |
|
280 | - if ( wp_verify_nonce( $nonce, EmailLog::DELETE_LOG_ACTION ) ) { |
|
279 | + $nonce = $_REQUEST[EmailLog::DELETE_LOG_NONCE_FIELD]; |
|
280 | + if (wp_verify_nonce($nonce, EmailLog::DELETE_LOG_ACTION)) { |
|
281 | 281 | $table_name = $wpdb->prefix . EmailLog::TABLE_NAME; |
282 | - $EmailLog->logs_deleted = $wpdb->query( "DELETE FROM $table_name" ); //@codingStandardsIgnoreLine |
|
282 | + $EmailLog->logs_deleted = $wpdb->query("DELETE FROM $table_name"); //@codingStandardsIgnoreLine |
|
283 | 283 | } else { |
284 | - wp_die( 'Cheating, Huh? ' ); |
|
284 | + wp_die('Cheating, Huh? '); |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
@@ -305,47 +305,47 @@ discard block |
||
305 | 305 | $count_query = 'SELECT count(*) FROM ' . $table_name; |
306 | 306 | $query_cond = ''; |
307 | 307 | |
308 | - if ( isset( $_GET['s'] ) ) { |
|
309 | - $search_term = trim( esc_sql( $_GET['s'] ) ); |
|
308 | + if (isset($_GET['s'])) { |
|
309 | + $search_term = trim(esc_sql($_GET['s'])); |
|
310 | 310 | $query_cond .= " WHERE to_email LIKE '%$search_term%' OR subject LIKE '%$search_term%' "; |
311 | 311 | } |
312 | 312 | |
313 | 313 | // Ordering parameters. |
314 | - $orderby = ! empty( $_GET['orderby'] ) ? esc_sql( $_GET['orderby'] ) : 'sent_date'; |
|
315 | - $order = ! empty( $_GET['order'] ) ? esc_sql( $_GET['order'] ) : 'DESC'; |
|
314 | + $orderby = ! empty($_GET['orderby']) ? esc_sql($_GET['orderby']) : 'sent_date'; |
|
315 | + $order = ! empty($_GET['order']) ? esc_sql($_GET['order']) : 'DESC'; |
|
316 | 316 | |
317 | - if ( ! empty( $orderby ) & ! empty( $order ) ) { |
|
317 | + if ( ! empty($orderby) & ! empty($order)) { |
|
318 | 318 | $query_cond .= ' ORDER BY ' . $orderby . ' ' . $order; |
319 | 319 | } |
320 | 320 | |
321 | 321 | // Find total number of items. |
322 | 322 | $count_query = $count_query . $query_cond; |
323 | - $total_items = $wpdb->get_var( $count_query ); |
|
323 | + $total_items = $wpdb->get_var($count_query); |
|
324 | 324 | |
325 | 325 | // Adjust the query to take pagination into account. |
326 | 326 | $per_page = EmailLog::get_per_page(); |
327 | - if ( ! empty( $current_page ) && ! empty( $per_page ) ) { |
|
328 | - $offset = ( $current_page - 1 ) * $per_page; |
|
327 | + if ( ! empty($current_page) && ! empty($per_page)) { |
|
328 | + $offset = ($current_page - 1) * $per_page; |
|
329 | 329 | $query_cond .= ' LIMIT ' . (int) $offset . ',' . (int) $per_page; |
330 | 330 | } |
331 | 331 | |
332 | 332 | // Fetch the items. |
333 | 333 | $query = $query . $query_cond; |
334 | - $this->items = $wpdb->get_results( $query ); |
|
334 | + $this->items = $wpdb->get_results($query); |
|
335 | 335 | |
336 | 336 | // Register pagination options & calculations. |
337 | - $this->set_pagination_args( array( |
|
337 | + $this->set_pagination_args(array( |
|
338 | 338 | 'total_items' => $total_items, |
339 | 339 | 'per_page' => $per_page, |
340 | - 'total_pages' => ceil( $total_items / $per_page ), |
|
341 | - ) ); |
|
340 | + 'total_pages' => ceil($total_items / $per_page), |
|
341 | + )); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
345 | 345 | * Displays default message when no items are found. |
346 | 346 | */ |
347 | 347 | public function no_items() { |
348 | - _e( 'Your email log is empty', 'email-log' ); |
|
348 | + _e('Your email log is empty', 'email-log'); |
|
349 | 349 | } |
350 | 350 | } |
351 | 351 | ?> |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 1.7.2 |
34 | 34 | */ |
35 | -if ( ! defined( 'EMAIL_LOG_PLUGIN_FILE' ) ) { |
|
36 | - define( 'EMAIL_LOG_PLUGIN_FILE', __FILE__ ); |
|
35 | +if ( ! defined('EMAIL_LOG_PLUGIN_FILE')) { |
|
36 | + define('EMAIL_LOG_PLUGIN_FILE', __FILE__); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Handles installation and table creation. |
41 | 41 | */ |
42 | -require_once plugin_dir_path( __FILE__ ) . 'include/install.php'; |
|
42 | +require_once plugin_dir_path(__FILE__) . 'include/install.php'; |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Helper functions. |
46 | 46 | */ |
47 | -require_once plugin_dir_path( __FILE__ ) . 'include/util/helper.php'; |
|
47 | +require_once plugin_dir_path(__FILE__) . 'include/util/helper.php'; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * The main plugin class. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @since Genesis |
77 | 77 | * @var const VERSION |
78 | 78 | */ |
79 | - const VERSION = '1.8.2'; |
|
79 | + const VERSION = '1.8.2'; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Filter name. |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @since Genesis |
85 | 85 | * @var const FILTER_NAME |
86 | 86 | */ |
87 | - const FILTER_NAME = 'wp_mail_log'; |
|
87 | + const FILTER_NAME = 'wp_mail_log'; |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Page slug to be used in admin dashboard hyperlinks. |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @since Genesis |
93 | 93 | * @var const PAGE_SLUG |
94 | 94 | */ |
95 | - const PAGE_SLUG = 'email-log'; |
|
95 | + const PAGE_SLUG = 'email-log'; |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * String value to generate nonce. |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @since Genesis |
101 | 101 | * @var const DELETE_LOG_NONCE_FIELD |
102 | 102 | */ |
103 | - const DELETE_LOG_NONCE_FIELD = 'sm-delete-email-log-nonce'; |
|
103 | + const DELETE_LOG_NONCE_FIELD = 'sm-delete-email-log-nonce'; |
|
104 | 104 | |
105 | 105 | /** |
106 | 106 | * String value to generate nonce. |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | const DELETE_LOG_ACTION = 'sm-delete-email-log'; |
112 | 112 | |
113 | 113 | // DB stuff |
114 | - const TABLE_NAME = 'email_log'; /* Database table name */ |
|
115 | - const DB_OPTION_NAME = 'email-log-db'; /* Database option name */ |
|
116 | - const DB_VERSION = '0.1'; /* Database version */ |
|
114 | + const TABLE_NAME = 'email_log'; /* Database table name */ |
|
115 | + const DB_OPTION_NAME = 'email-log-db'; /* Database option name */ |
|
116 | + const DB_VERSION = '0.1'; /* Database version */ |
|
117 | 117 | |
118 | 118 | // JS Stuff |
119 | 119 | const JS_HANDLE = 'email-log'; |
@@ -126,25 +126,25 @@ discard block |
||
126 | 126 | * Initialize the plugin by registering the hooks. |
127 | 127 | */ |
128 | 128 | function __construct() { |
129 | - $this->include_path = plugin_dir_path( __FILE__ ); |
|
129 | + $this->include_path = plugin_dir_path(__FILE__); |
|
130 | 130 | |
131 | 131 | // Load localization domain. |
132 | - $this->translations = dirname( plugin_basename( __FILE__ ) ) . '/languages/' ; |
|
133 | - load_plugin_textdomain( 'email-log', false, $this->translations ); |
|
132 | + $this->translations = dirname(plugin_basename(__FILE__)) . '/languages/'; |
|
133 | + load_plugin_textdomain('email-log', false, $this->translations); |
|
134 | 134 | |
135 | 135 | // Register hooks. |
136 | - add_action( 'admin_menu', array( $this, 'register_settings_page' ) ); |
|
136 | + add_action('admin_menu', array($this, 'register_settings_page')); |
|
137 | 137 | |
138 | 138 | // Register Filter. |
139 | - add_filter( 'wp_mail', array( $this, 'log_email' ) ); |
|
140 | - add_filter( 'set-screen-option', array( $this, 'save_screen_options' ), 10, 3 ); |
|
141 | - add_filter( 'plugin_row_meta', array( $this, 'add_plugin_links' ), 10, 2 ); |
|
139 | + add_filter('wp_mail', array($this, 'log_email')); |
|
140 | + add_filter('set-screen-option', array($this, 'save_screen_options'), 10, 3); |
|
141 | + add_filter('plugin_row_meta', array($this, 'add_plugin_links'), 10, 2); |
|
142 | 142 | |
143 | - $plugin = plugin_basename( __FILE__ ); |
|
144 | - add_filter( "plugin_action_links_$plugin", array( $this, 'add_action_links' ) ); |
|
143 | + $plugin = plugin_basename(__FILE__); |
|
144 | + add_filter("plugin_action_links_$plugin", array($this, 'add_action_links')); |
|
145 | 145 | |
146 | 146 | // Add our ajax call. |
147 | - add_action( 'wp_ajax_display_content', array( $this, 'display_content_callback' ) ); |
|
147 | + add_action('wp_ajax_display_content', array($this, 'display_content_callback')); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | * @param string $file The name of the plugin file. |
160 | 160 | * @return array Array with links to display in plugins page. |
161 | 161 | */ |
162 | - public function add_plugin_links( $links, $file ) { |
|
163 | - $plugin = plugin_basename( __FILE__ ); |
|
162 | + public function add_plugin_links($links, $file) { |
|
163 | + $plugin = plugin_basename(__FILE__); |
|
164 | 164 | |
165 | - if ( $file == $plugin ) { |
|
165 | + if ($file == $plugin) { |
|
166 | 166 | // only for this plugin |
167 | - return array_merge( $links, |
|
168 | - array( '<a href="http://sudarmuthu.com/wordpress/email-log/pro-addons" target="_blank">' . __( 'Buy Addons', 'email-log' ) . '</a>' ) |
|
167 | + return array_merge($links, |
|
168 | + array('<a href="http://sudarmuthu.com/wordpress/email-log/pro-addons" target="_blank">' . __('Buy Addons', 'email-log') . '</a>') |
|
169 | 169 | ); |
170 | 170 | } |
171 | 171 | return $links; |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function register_settings_page() { |
180 | 180 | // Save the handle to your admin page - you'll need it to create a WP_Screen object |
181 | - $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' ) ); |
|
181 | + $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')); |
|
182 | 182 | |
183 | - add_action( "load-{$this->admin_page}", array( $this, 'create_settings_panel' ) ); |
|
183 | + add_action("load-{$this->admin_page}", array($this, 'create_settings_panel')); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -191,33 +191,33 @@ discard block |
||
191 | 191 | public function display_logs() { |
192 | 192 | add_thickbox(); |
193 | 193 | |
194 | - $this->logs_table->prepare_items( $this->get_per_page() ); |
|
194 | + $this->logs_table->prepare_items($this->get_per_page()); |
|
195 | 195 | ?> |
196 | 196 | <div class="wrap"> |
197 | - <h2><?php _e( 'Email Logs', 'email-log' );?></h2> |
|
197 | + <h2><?php _e('Email Logs', 'email-log'); ?></h2> |
|
198 | 198 | <?php |
199 | - if ( isset( $this->logs_deleted ) && $this->logs_deleted != '' ) { |
|
200 | - $logs_deleted = intval( $this->logs_deleted ); |
|
199 | + if (isset($this->logs_deleted) && $this->logs_deleted != '') { |
|
200 | + $logs_deleted = intval($this->logs_deleted); |
|
201 | 201 | |
202 | - if ( $logs_deleted > 0 ) { |
|
203 | - echo '<div class="updated"><p>' . sprintf( _n( '1 email log deleted.', '%s email logs deleted', $logs_deleted, 'email-log' ), $logs_deleted ) . '</p></div>'; |
|
202 | + if ($logs_deleted > 0) { |
|
203 | + echo '<div class="updated"><p>' . sprintf(_n('1 email log deleted.', '%s email logs deleted', $logs_deleted, 'email-log'), $logs_deleted) . '</p></div>'; |
|
204 | 204 | } else { |
205 | - echo '<div class="updated"><p>' . __( 'There was some problem in deleting the email logs' , 'email-log' ) . '</p></div>'; |
|
205 | + echo '<div class="updated"><p>' . __('There was some problem in deleting the email logs', 'email-log') . '</p></div>'; |
|
206 | 206 | } |
207 | - unset( $this->logs_deleted ); |
|
207 | + unset($this->logs_deleted); |
|
208 | 208 | } |
209 | 209 | ?> |
210 | 210 | <form id="email-logs-search" method="get"> |
211 | 211 | <input type="hidden" name="page" value="<?php echo self::PAGE_SLUG; ?>" > |
212 | 212 | <?php |
213 | - $this->logs_table->search_box( __( 'Search Logs', 'email-log' ), 'search_id' ); |
|
213 | + $this->logs_table->search_box(__('Search Logs', 'email-log'), 'search_id'); |
|
214 | 214 | ?> |
215 | 215 | </form> |
216 | 216 | |
217 | 217 | <form id="email-logs-filter" method="get"> |
218 | 218 | <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" /> |
219 | 219 | <?php |
220 | - wp_nonce_field( self::DELETE_LOG_ACTION, self::DELETE_LOG_NONCE_FIELD ); |
|
220 | + wp_nonce_field(self::DELETE_LOG_ACTION, self::DELETE_LOG_NONCE_FIELD); |
|
221 | 221 | $this->logs_table->display(); |
222 | 222 | ?> |
223 | 223 | </form> |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | * |
229 | 229 | * @since 1.8 |
230 | 230 | */ |
231 | - do_action( 'el_admin_footer' ); |
|
231 | + do_action('el_admin_footer'); |
|
232 | 232 | |
233 | 233 | // Display credits in Footer |
234 | - add_action( 'in_admin_footer', array( $this, 'add_footer_links' ) ); |
|
234 | + add_action('in_admin_footer', array($this, 'add_footer_links')); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -245,43 +245,43 @@ discard block |
||
245 | 245 | * Create the WP_Screen object against your admin page handle |
246 | 246 | * This ensures we're working with the right admin page |
247 | 247 | */ |
248 | - $this->admin_screen = WP_Screen::get( $this->admin_page ); |
|
248 | + $this->admin_screen = WP_Screen::get($this->admin_page); |
|
249 | 249 | |
250 | 250 | /** |
251 | 251 | * Content specified inline |
252 | 252 | */ |
253 | 253 | $this->admin_screen->add_help_tab( |
254 | 254 | array( |
255 | - 'title' => __( 'About Plugin', 'email-log' ), |
|
255 | + 'title' => __('About Plugin', 'email-log'), |
|
256 | 256 | 'id' => 'about_tab', |
257 | - 'content' => '<p>' . __( 'Email Log WordPress Plugin, allows you to log all emails that are sent through WordPress.', 'email-log' ) . '</p>', |
|
257 | + 'content' => '<p>' . __('Email Log WordPress Plugin, allows you to log all emails that are sent through WordPress.', 'email-log') . '</p>', |
|
258 | 258 | 'callback' => false, |
259 | 259 | ) |
260 | 260 | ); |
261 | 261 | |
262 | 262 | // Add help sidebar |
263 | 263 | $this->admin_screen->set_help_sidebar( |
264 | - '<p><strong>' . __( 'More information', 'email-log' ) . '</strong></p>' . |
|
265 | - '<p><a href = "http://sudarmuthu.com/wordpress/email-log">' . __( 'Plugin Homepage/support', 'email-log' ) . '</a></p>' . |
|
266 | - '<p><a href = "http://sudarmuthu.com/blog">' . __( "Plugin author's blog", 'email-log' ) . '</a></p>' . |
|
267 | - '<p><a href = "http://sudarmuthu.com/wordpress/">' . __( "Other Plugin's by Author", 'email-log' ) . '</a></p>' |
|
264 | + '<p><strong>' . __('More information', 'email-log') . '</strong></p>' . |
|
265 | + '<p><a href = "http://sudarmuthu.com/wordpress/email-log">' . __('Plugin Homepage/support', 'email-log') . '</a></p>' . |
|
266 | + '<p><a href = "http://sudarmuthu.com/blog">' . __("Plugin author's blog", 'email-log') . '</a></p>' . |
|
267 | + '<p><a href = "http://sudarmuthu.com/wordpress/">' . __("Other Plugin's by Author", 'email-log') . '</a></p>' |
|
268 | 268 | ); |
269 | 269 | |
270 | 270 | // Add screen options |
271 | 271 | $this->admin_screen->add_option( |
272 | 272 | 'per_page', |
273 | 273 | array( |
274 | - 'label' => __( 'Entries per page', 'email-log' ), |
|
274 | + 'label' => __('Entries per page', 'email-log'), |
|
275 | 275 | 'default' => 20, |
276 | 276 | 'option' => 'per_page', |
277 | 277 | ) |
278 | 278 | ); |
279 | 279 | |
280 | - if ( ! class_exists( 'WP_List_Table' ) ) { |
|
280 | + if ( ! class_exists('WP_List_Table')) { |
|
281 | 281 | require_once ABSPATH . WPINC . '/class-wp-list-table.php'; |
282 | 282 | } |
283 | 283 | |
284 | - if ( ! class_exists( 'Email_Log_List_Table' ) ) { |
|
284 | + if ( ! class_exists('Email_Log_List_Table')) { |
|
285 | 285 | require_once $this->include_path . 'include/class-email-log-list-table.php'; |
286 | 286 | } |
287 | 287 | |
@@ -298,12 +298,12 @@ discard block |
||
298 | 298 | global $wpdb; |
299 | 299 | |
300 | 300 | $table_name = $wpdb->prefix . self::TABLE_NAME; |
301 | - $email_id = absint( $_GET['email_id'] ); |
|
301 | + $email_id = absint($_GET['email_id']); |
|
302 | 302 | |
303 | - $query = $wpdb->prepare( 'SELECT * FROM ' . $table_name . ' WHERE id = %d', $email_id ); |
|
304 | - $content = $wpdb->get_results( $query ); |
|
303 | + $query = $wpdb->prepare('SELECT * FROM ' . $table_name . ' WHERE id = %d', $email_id); |
|
304 | + $content = $wpdb->get_results($query); |
|
305 | 305 | |
306 | - echo wpautop( $content[0]->message ); |
|
306 | + echo wpautop($content[0]->message); |
|
307 | 307 | |
308 | 308 | die(); // this is required to return a proper result |
309 | 309 | } |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | * @param int $value The number of rows to use. |
319 | 319 | * @return bool|int |
320 | 320 | */ |
321 | - function save_screen_options( $status, $option, $value ) { |
|
322 | - if ( 'per_page' == $option ) { |
|
321 | + function save_screen_options($status, $option, $value) { |
|
322 | + if ('per_page' == $option) { |
|
323 | 323 | return $value; |
324 | 324 | } else { |
325 | 325 | return $status; |
@@ -335,12 +335,12 @@ discard block |
||
335 | 335 | */ |
336 | 336 | public static function get_per_page() { |
337 | 337 | $screen = get_current_screen(); |
338 | - $option = $screen->get_option( 'per_page', 'option' ); |
|
338 | + $option = $screen->get_option('per_page', 'option'); |
|
339 | 339 | |
340 | - $per_page = get_user_meta( get_current_user_id(), $option, true ); |
|
340 | + $per_page = get_user_meta(get_current_user_id(), $option, true); |
|
341 | 341 | |
342 | - if ( empty( $per_page ) || $per_page < 1 ) { |
|
343 | - $per_page = $screen->get_option( 'per_page', 'default' ); |
|
342 | + if (empty($per_page) || $per_page < 1) { |
|
343 | + $per_page = $screen->get_option('per_page', 'default'); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | return $per_page; |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | * @param array $links |
355 | 355 | * @return array |
356 | 356 | */ |
357 | - public function add_action_links( $links ) { |
|
357 | + public function add_action_links($links) { |
|
358 | 358 | // Add a link to this plugin's settings page |
359 | - $settings_link = '<a href="tools.php?page=email-log">' . __( 'Log', 'email-log' ) . '</a>'; |
|
360 | - array_unshift( $links, $settings_link ); |
|
359 | + $settings_link = '<a href="tools.php?page=email-log">' . __('Log', 'email-log') . '</a>'; |
|
360 | + array_unshift($links, $settings_link); |
|
361 | 361 | return $links; |
362 | 362 | } |
363 | 363 | |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | * @link http://striderweb.com/nerdaphernalia/2008/06/give-your-wordpress-plugin-credit/ |
371 | 371 | */ |
372 | 372 | public function add_footer_links() { |
373 | - $plugin_data = get_plugin_data( __FILE__ ); |
|
374 | - 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'] ); |
|
373 | + $plugin_data = get_plugin_data(__FILE__); |
|
374 | + 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']); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -384,21 +384,21 @@ discard block |
||
384 | 384 | * @param array $mail_info Information about email. |
385 | 385 | * @return array Information about email. |
386 | 386 | */ |
387 | - public function log_email( $mail_info ) { |
|
387 | + public function log_email($mail_info) { |
|
388 | 388 | global $wpdb; |
389 | 389 | |
390 | - $attachment_present = ( count( $mail_info['attachments'] ) > 0 ) ? 'true' : 'false'; |
|
390 | + $attachment_present = (count($mail_info['attachments']) > 0) ? 'true' : 'false'; |
|
391 | 391 | |
392 | 392 | // return filtered array |
393 | - $mail_info = apply_filters( self::FILTER_NAME, $mail_info ); |
|
393 | + $mail_info = apply_filters(self::FILTER_NAME, $mail_info); |
|
394 | 394 | $table_name = $wpdb->prefix . self::TABLE_NAME; |
395 | 395 | |
396 | - if ( isset( $mail_info['message'] ) ) { |
|
396 | + if (isset($mail_info['message'])) { |
|
397 | 397 | $message = $mail_info['message']; |
398 | 398 | } else { |
399 | 399 | // wpmandrill plugin is changing "message" key to "html". See https://github.com/sudar/email-log/issues/20 |
400 | 400 | // Ideally this should be fixed in wpmandrill, but I am including this hack here till it is fixed by them. |
401 | - if ( isset( $mail_info['html'] ) ) { |
|
401 | + if (isset($mail_info['html'])) { |
|
402 | 402 | $message = $mail_info['html']; |
403 | 403 | } else { |
404 | 404 | $message = ''; |
@@ -406,14 +406,14 @@ discard block |
||
406 | 406 | } |
407 | 407 | |
408 | 408 | // Log into the database |
409 | - $wpdb->insert( $table_name, array( |
|
410 | - 'to_email' => is_array( $mail_info['to'] ) ? implode( ',', $mail_info['to'] ) : $mail_info['to'], |
|
409 | + $wpdb->insert($table_name, array( |
|
410 | + 'to_email' => is_array($mail_info['to']) ? implode(',', $mail_info['to']) : $mail_info['to'], |
|
411 | 411 | 'subject' => $mail_info['subject'], |
412 | 412 | 'message' => $message, |
413 | - 'headers' => is_array( $mail_info['headers'] ) ? implode( "\n", $mail_info['headers'] ) : $mail_info['headers'], |
|
413 | + 'headers' => is_array($mail_info['headers']) ? implode("\n", $mail_info['headers']) : $mail_info['headers'], |
|
414 | 414 | 'attachments' => $attachment_present, |
415 | - 'sent_date' => current_time( 'mysql' ), |
|
416 | - ) ); |
|
415 | + 'sent_date' => current_time('mysql'), |
|
416 | + )); |
|
417 | 417 | |
418 | 418 | return $mail_info; |
419 | 419 | } |
@@ -431,5 +431,5 @@ discard block |
||
431 | 431 | global $EmailLog; |
432 | 432 | $EmailLog = new EmailLog(); |
433 | 433 | } |
434 | -add_action( 'init', 'email_log' ); |
|
434 | +add_action('init', 'email_log'); |
|
435 | 435 | ?> |