/**
  * Render the Email Column
  *
  * @access public
  * @since 0.9.3
  * @param array $item Contains all the data of the email
  * @return string Data shown in the Name column
  */
 function column_email($item)
 {
     $email = get_post($item['ID']);
     $status = strtolower($item['status']);
     $view = $status == 'draft' ? 'edit_pup_email' : 'view_pup_email';
     $emailname = !empty($email->post_title) ? $email->post_title : __('(no title)', 'edd-pup');
     $baseurl = admin_url('edit.php?post_type=download&page=edd-prod-updates');
     $row_actions = array();
     if ($status == 'draft') {
         $row_actions['edit'] = '<a href="' . add_query_arg(array('view' => $view, 'id' => $email->ID, 'edd_pup_notice' => false), $baseurl) . '">' . __('Edit', 'edd-pup') . '</a>';
     } else {
         $row_actions['edit'] = '<a href="' . add_query_arg(array('view' => $view, 'id' => $email->ID, 'edd_pup_notice' => false), $baseurl) . '">' . __('View', 'edd-pup') . '</a>';
     }
     if ($status == 'pending' && edd_pup_is_processing($item['ID']) == false) {
         $row_actions['send'] = '<a href="javascript:void(0);" class="edd-pup-queue-button" data-action="edd_pup_send_queue" data-email="' . $email->ID . '" data-url="' . add_query_arg(array('view' => 'send_pup_ajax', 'id' => $email->ID, 'restart' => 1), $baseurl) . '">' . __('Send Remaining', 'edd-pup') . '</a>';
         $row_actions['clear'] = '<a href="javascript:void(0);" class="edd-pup-queue-button" data-action="edd_pup_clear_queue" data-email="' . $email->ID . '" data-nonce="' . wp_create_nonce('clear-queue-' . $email->ID) . '" >' . __('Clear from Queue', 'edd-pup') . '</a>';
     }
     $row_actions['duplicate'] = '<a href="' . wp_nonce_url(add_query_arg(array('edd_action' => 'pup_duplicate_email', 'id' => $email->ID), $baseurl), 'edd-pup-duplicate-nonce') . '">' . __('Duplicate', 'edd-pup') . '</a>';
     $row_actions['delete'] = '<a href="' . wp_nonce_url(add_query_arg(array('edd_action' => 'pup_delete_email', 'id' => $email->ID), $baseurl), 'edd-pup-delete-nonce') . '" onclick="var result=confirm(\'' . __('Are you sure you want to permanently delete this email?', 'edd-pup') . '\');return result;">' . __('Delete', 'edd-pup') . '</a>';
     $row_actions = apply_filters('edd_pup_row_actions', $row_actions, $email);
     return '<strong><a class="row-title" href="' . add_query_arg(array('view' => $view, 'id' => $email->ID, 'edd_pup_notice' => false), $baseurl) . '">' . $emailname . '</a></strong>' . $this->row_actions($row_actions);
 }
Beispiel #2
0
 * @since 0.9.3
 */
// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
// Don't allow emails that have already been processed or are being processed to send.
switch (get_post_status($_GET['id'])) {
    case 'publish':
        printf(__('This email has already been sent. <a href="%s" target="_blank">View this email in the dashboard.</a>', 'edd-pup'), admin_url('edit.php?post_type=download&page=edd-prod-updates&view=view_pup_email&id=' . $_GET['id']));
        return;
    case 'abandoned':
        printf(__('This email has been cancelled. <a href="%s" target="_blank">View this email in the dashboard.</a>', 'edd-pup'), admin_url('edit.php?post_type=download&page=edd-prod-updates&view=view_pup_email&id=' . $_GET['id']));
        return;
    case 'pending':
        if (edd_pup_is_processing($_GET['id'])) {
            _e('This email is processing.', 'edd-pup');
            return;
        } else {
            if (empty($_GET['restart'])) {
                _e('This email is in the queue and has remaining messages to send. If you would like to send those messages now, click the send button below.', 'edd-pup');
                break;
            }
        }
}
// Don't allow a user to send multiple emails at once
if (false !== get_transient('edd_pup_sending_email_' . get_current_user_id())) {
    _e('Cannot process multiple emails at once. Please pause the email you are currently sending or wait for it to finish before attempting to send another. <a href="#" onclick="window.close()">Close Window.</a>', 'edd-pup');
    return;
}
?>
    exit;
}
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
    wp_die(__('Something went wrong.', 'edd-pup'), __('Error', 'edd-pup'));
}
global $edd_options;
$bundle = 0;
$user = get_current_user_id();
$email_id = absint($_GET['id']);
$email = get_post($email_id);
$emailmeta = get_post_custom($email_id);
$updated_products = get_post_meta($email_id, '_edd_pup_updated_products', TRUE);
$recipients = get_post_meta($email_id, '_edd_pup_recipients', TRUE);
$filters = isset($emailmeta['_edd_pup_filters'][0]) ? maybe_unserialize($emailmeta['_edd_pup_filters'][0]) : null;
$queue = edd_pup_check_queue($email_id);
$processing = edd_pup_is_processing($email_id) ? true : false;
$dateformat = get_option('date_format') . ' ' . get_option('time_format');
$baseurl = admin_url('edit.php?post_type=download&page=edd-prod-updates');
$restarturl = add_query_arg(array('view' => 'send_pup_ajax', 'id' => $email_id, 'restart' => 1), admin_url('edit.php?post_type=download&page=edd-prod-updates'));
$duplicateurl = wp_nonce_url(add_query_arg(array('edd_action' => 'pup_duplicate_email', 'id' => $email_id, 'redirect' => 1), $baseurl), 'edd-pup-duplicate-nonce');
// Find if any products were bundles
foreach ($updated_products as $prod_id => $prod_name) {
    if (edd_is_bundled_product($prod_id)) {
        $bundle++;
    }
}
switch (strtolower($email->post_status)) {
    case 'publish':
        $status = __('Sent', 'edd-pup');
        break;
    case 'pending':