/** * SAVE Boxes meta in Newsletter */ function alo_em_save_newsletter_meta($post_id) { if (@(!wp_verify_nonce($_POST["edit_newsletter"], ALO_EM_PLUGIN_DIR))) { return $post_id; } if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } // Check permissions if ('newsletter' == $_POST['post_type']) { if (!current_user_can('edit_newsletter', $post_id)) { return $post_id; } } do_action('alo_easymail_save_newsletter_meta_extra', $post_id); // If a previous list exists already: if requested reset, otherwise don't save if (alo_em_count_newsletter_recipients($post_id) > 0 || alo_em_is_newsletter_recipients_archived($post_id)) { if (isset($_POST['easymail-reset-all-recipients'])) { alo_em_delete_newsletter_recipients($post_id); alo_em_delete_newsletter_status($post_id); alo_em_delete_cache_recipients($post_id); } else { return $post_id; // don't save, exit } } // Save Recipients $recipients = array(); if (isset($_POST['easymail-recipients-all-regusers'])) { $recipients['registered'] = "1"; } else { if (isset($_POST['check_role']) && is_array($_POST['check_role'])) { foreach ($_POST['check_role'] as $role) { $recipients['role'][] = $role; } } } if (isset($_POST['easymail-recipients-all-subscribers'])) { $recipients['subscribers'] = "1"; } else { if (isset($_POST['check_list']) && is_array($_POST['check_list'])) { foreach ($_POST['check_list'] as $list) { $recipients['list'][] = $list; } } } if (isset($_POST['check_lang']) && is_array($_POST['check_lang'])) { foreach ($_POST['check_lang'] as $lang) { $recipients['lang'][] = $lang; } } // Save! delete_post_meta($post_id, "_easymail_recipients"); add_post_meta($post_id, "_easymail_recipients", $recipients); // If required, create list of recipient now, without ajax if (get_option('alo_em_js_rec_list') == "no_ajax_onsavepost" && alo_em_count_recipients_from_meta($post_id) > 0) { alo_em_create_cache_recipients($post_id); alo_em_add_recipients_from_cache_to_db($post_id, alo_em_count_recipients_from_meta($post_id), false); } }
$n = 0; foreach ($urls as $url) { $class = '' == $class ? "style='background-color:#eee;'" : ""; $n++; echo "<tr {$class} ><td><a href=\"" . $url->request . "\" target=\"_blank\" title=\"" . esc_attr(sprintf(__('Visit %s'), esc_url($url->request))) . "\">" . $url->request . "</a></td>"; echo "<td><strong>" . $url->num_visits . "</strong></td>"; echo "</tr>"; } } ?> </tbody></table> <?php // Table with recipients } elseif (!alo_em_is_newsletter_recipients_archived($newsletter)) { ?> <?php $tot_pages = @ceil($tot_recipients / $per_page); if ($tot_pages > 1) { ?> <!-- Pagination --> <ul id="easymail_report_tabs" class="ui-tabs-nav"> <?php for ($i = 0; $i < $tot_pages; $i++) { $to_offset = $i * $per_page; $active = $offset == $to_offset ? "ui-tabs-selected ui-state-active" : ""; $atitle = __("Recipients", "alo-easymail") . ": " . ($to_offset + 1) . " - " . ($i < $tot_pages - 1 ? $to_offset + $per_page : $tot_recipients); ?>