some improvement
-
log-detail.php
not needed sanitize post_content, if is html, i want html!<tr> <th><?php echo esc_html_x('Message', 'content of email', 'log-emails'); ?></th> <?php if (!empty($content_type) && strpos($content_type, 'text/html') !== false && empty($_GET['raw'])): ?> <td> <p><a href="<?php echo esc_url($current . '&raw=1'); ?>"><?php esc_html_e('view raw message', 'log-emails'); ?></a></p> <?php echo $post->post_content; ?> </td> <?php else: ?> <td> <?php if (!empty($content_type) && strpos($content_type, 'text/html') !== false && !empty($_GET['raw'])): ?> <p><a href="<?php echo esc_url($current); ?>"><?php esc_html_e('view HTML message', 'log-emails'); ?></a></p> <?php endif; ?> <?php echo nl2br(esc_html($post->post_content)); ?> </td> <?php endif; ?> </tr>
remove filter sanitization
public static function createLog($subject, $message, $alt_message, $fields) { do_action('log_emails_cache_pause'); remove_all_filters("content_save_pre"); // create post for message $post_id = wp_insert_post(array(
Im using MyMail plugin for newsletters. There is option to override all system email via MyMail templates, so if I want log this email ->
add_action('mymail_presend','mymail_log_email' ); function mymail_log_email($email){ if (class_exists('LogEmailsPostTypeLog')) { $fields = array(); $fields['_log_emails_log_from'] = sprintf('%s <%s>', $email->from_name, $email->from); /* if (!empty($cc)) { $fields['_log_emails_log_cc'] = implode(', ', $cc); } if (!empty($bcc)) { $fields['_log_emails_log_bcc'] = implode(', ', $bcc); } */ $fields['_log_emails_log_to'] = $email->to; $fields['_log_emails_log_content-type'] = 'text/html'; new LogEmailsPostTypeLog(); LogEmailsPostTypeLog::createLog($email->subject, $email->content, $email->plaintext, $fields); } }
better css handle with html email
.log-emails-log-details { width: 96%; > tbody > tr > th { text-align: right; vertical-align: top; padding: 3px; width: 8em; } > tbody > tr > td { padding: 3px; border: 1px solid #ccc; background-color: white; } } .log-emails-log-details * { margin: inherit; }
add i18n to menu
public function adminMenu() { add_options_page(__('Email Logs', 'log-emails'), __('Email Logs', 'log-emails'), 'manage_options', 'log-emails', array($this, 'settingsPage')); }
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘some improvement’ is closed to new replies.