Esempio n. 1
0
 /**
  * @access public
  * @since  8.2.10
  * @static
  *
  * @uses   add_action()
  *
  * @return cnLog_Email
  */
 public static function instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof cnLog_Email) {
         self::$instance = new cnLog_Email();
         // Register log type.
         add_filter('cn_log_types', array(__CLASS__, 'registerLogType'));
         // Add action to log email after they are sent.
         add_action('cn_email_post_send', array(__CLASS__, 'add'), 10, 11);
         // Add filter to format meta key for display.
         add_filter('cn_log_meta_key', array(__CLASS__, 'metaKey'));
         // Add filter to format meta value for display.
         add_filter('cn_log_meta_value', array(__CLASS__, 'metaValue'), 10, 2);
     }
     return self::$instance;
 }
 /**
  * Renders the email sent status column.
  *
  * @access public
  * @since  8.3
  *
  * @param array $log The log item data.
  *
  * @return string
  */
 public function column_status($log)
 {
     return cnLog_Email::viewLogItem('response', $log['status']);
 }
Esempio n. 3
0
    /**
     * Callback used to render the log view of the log type being viewed.
     *
     * @access private
     * @since  8.3
     * @static
     *
     * @uses   current_user_can()
     * @uses   wp_list_pluck()
     * @uses   esc_url()
     * @uses   self_admin_url()
     * @uses   cnLog::types()
     * @uses   cnLog_Email::types()
     * @uses   cnHTML::select()
     * @uses   submit_button()
     * @uses   do_action()
     */
    public static function logs()
    {
        if (!current_user_can('install_plugins')) {
            return;
        }
        $current = cnLog_Email::LOG_TYPE;
        $views = wp_list_pluck(cnLog::views(), 'id');
        if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) {
            $current = $_GET['view'];
        }
        ?>

		<div class="wrap" id="cn-logs">

			<form id="cn-log-type" method="get"
			      action="<?php 
        echo esc_url(self_admin_url('admin.php'));
        ?>
">

				<input type="hidden" name="page" value="connections_tools"/>
				<input type="hidden" name="tab" value="logs"/>

				<?php 
        $allLogTypes = wp_list_pluck(cnLog::types(), 'name', 'id');
        $emailLogTypes = wp_list_pluck(cnLog_Email::types(), 'name', 'id');
        unset($emailLogTypes[cnLog_Email::LOG_TYPE]);
        cnHTML::select(array('id' => 'view', 'options' => array_diff_assoc($allLogTypes, $emailLogTypes)), $current);
        submit_button('Switch', 'secondary', 'action', FALSE, array('id' => 'log-type-submit'));
        ?>

			</form>

			<?php 
        do_action('cn_logs_view_' . $current);
        ?>

		</div>

	<?php 
    }
				<td><?php 
    cnLog_Email::viewLogItem('bcc', $meta['bcc']);
    ?>
</td>
			</tr>
		<?php 
}
?>

		<tr>
			<th><?php 
esc_html_e('Attachments', 'connections');
?>
</th>
			<td><?php 
echo cnLog_Email::viewLogItem('attachments', $meta['attachments']);
?>
</td>
		</tr>

		<tr>
			<th><?php 
echo esc_html_x('Message', 'Content of email.', 'connections');
?>
</th>
			<?php 
if (!empty($meta['type']) && 'text/html' == $meta['type']) {
    ?>
				<td><?php 
    echo wp_kses_post($post->post_content);
    ?>