function prerender() { $ip = $_SERVER['REMOTE_ADDR']; //print_r($info); $info = $this->data(); if (isset($info->id)) { $lists = SendPress_Data::get_list_ids_for_subscriber($info->id); //$lists = explode(',',$info->listids); foreach ($lists as $list) { $status = SendPress_Data::get_subscriber_list_status($list->listID, $info->id); if ($status->statusid == 1) { SendPress_Data::update_subscriber_status($list->listID, $info->id, '2'); } } SPNL()->db("Subscribers_Tracker")->open($info->report, $info->id, 4); } if (SendPress_Option::get('confirm-page') == 'custom') { $page = SendPress_Option::get('confirm-page-id'); if ($page != false) { $plink = get_permalink($page); if ($plink != "") { wp_safe_redirect(esc_url_raw($plink)); exit; } } } }
/** ************************************************************************ * Recommended. This method is called when the parent class can't find a method * specifically build for a given column. Generally, it's recommended to include * one method for each column you want to render, keeping your package class * neat and organized. For example, if the class needs to process a column * named 'title', it would first see if a method named $this->column_title() * exists - if it does, that method will be used. If it doesn't, this one will * be used. Generally, you should try to use custom column methods as much as * possible. * * Since we have defined a column_title() method later on, this method doesn't * need to concern itself with any column with a name of 'title'. Instead, it * needs to handle everything else. * * For more detailed insight into how columns are handled, take a look at * WP_List_Table::single_row_columns() * * @param array $item A singular item (one full row's worth of data) * @param array $column_name The name/slug of the column to be processed * @return string Text or HTML to be placed inside the column <td> **************************************************************************/ function column_default($item, $column_name) { $settings = SendPress_Data::get_post_meta_object($item->ID); switch ($column_name) { case 'name': return $item->post_title; break; case 'type': return ucwords(str_replace('_', ' ', $settings['_form_type'])); break; case 'shortcode': return '[sp-form formid=' . $item->ID . ']'; break; case 'actions': //$type = get_post_meta($item->ID, "_template_type", true); $a = '<div class="inline-buttons" style="text-align:right;">'; $a .= '<a class="btn btn-default" href="' . SendPress_Admin::link('Settings_Widgets', array('id' => $item->ID, 'create' => 1)) . '">' . __('Clone', 'sendpress') . '</a> <a class="btn btn-primary" href="' . SendPress_Admin::link('Settings_Widgets', array('id' => $item->ID)) . '">' . __('Edit', 'sendpress') . '</a>' . '</a> <a class="btn btn-danger" href="' . SendPress_Admin::link('Settings_Widgets', array('id' => $item->ID, 'delete' => 1)) . '">' . __('Delete', 'sendpress') . '</a>'; $a .= '</div>'; return $a; break; default: return print_r($item, true); //Show the whole array for troubleshooting purposes } }
function html($sp) { global $sendpress_html_templates; //print_r($sendpress_html_templates[$_GET['templateID']]); $postdata = get_post($_GET['templateID']); //print_r( $postdata ); ?> <form method="post" name="post" > <input type="hidden" value="<?php echo $_GET['templateID']; ?> " name="templateID" /> <div class="pull-right"> <a href="<?php echo SendPress_Admin::link('Emails_Tempstyle', array('templateID' => $_GET['templateID'])); ?> "><?php _e('Back to Template', 'sendpress'); ?> </a> <button class="btn btn-primary " type="submit" value="save" name="submit"><i class="icon-white icon-ok"></i> <?php echo __('Save', 'sendpress'); ?> </button> </div> <h2><?php echo $postdata->post_title; ?> <?php _e('Template Footer', 'sendpress'); ?> </h2><br> <div class="tab-pane fade in active" id="home"><?php wp_editor(get_post_meta($postdata->ID, '_footer_content', true), 'footer-content'); ?> </div> <?php SendPress_Data::nonce_field(); ?> </form><br><br><?php _e('Default Content', 'sendpress'); ?> <textarea class="form-control" rows="3"> <?php echo SendPress_Tag_Footer_Content::content(); ?> </textarea> <br> <?php echo spnl_get_emails_tags_list(); $this->popup(); ?> <?php }
function prerender() { $ip = $_SERVER['REMOTE_ADDR']; //print_r($info); $info = $this->data(); if (isset($info->listids)) { $lists = explode(',', $info->listids); foreach ($lists as $list_id) { if ($list_id > 0) { $status = SendPress_Data::get_subscriber_list_status($list_id, $info->id); if (!isset($status) || $status->status != '2') { SendPress_Data::update_subscriber_status($list_id, $info->id, '2'); } } } } if (SendPress_Option::get('confirm-page') == 'custom') { $page = SendPress_Option::get('confirm-page-id'); if ($page != false) { $plink = get_permalink($page); if ($plink != "") { wp_safe_redirect(esc_url_raw($plink)); exit; } } } }
function html($sp) { $list = SPNL()->validate->int($_GET['listID']); if ($list > 0) { $role_to_sync = get_post_meta($list, 'sync_role', true); SendPress_Data::drop_active_subscribers_for_sync($list); if ($role_to_sync == 'meta') { $meta_key = get_post_meta($list, 'meta-key', true); $meta_value = get_post_meta($list, 'meta-value', true); $meta_compare = get_post_meta($list, 'meta-compare', true); // WP_User_Query arguments $args = array('meta_query' => array(array('key' => $meta_key, 'value' => $meta_value, 'compare' => $meta_compare))); $user_query = new WP_User_Query($args); $blogusers = $user_query->get_total(); } else { $result = count_users(); foreach ($result['avail_roles'] as $role => $count) { if ($role == $role_to_sync) { $blogusers = $count; } } } } //$blogusers = get_users( 'role=' . $role ); //echo count($blogusers); ?> <div id="taskbar" class="lists-dashboard rounded group"> </div> <input type="hidden" id="post_ID" name="post_ID" value="<?php echo $list; ?> " /> <div class='well' id="sync-wordpress-roles"> <h2><strong><?php _e('Syncing ', 'sendpress'); ?> <?php echo ucwords($role); ?> <?php _e(' Role to List', 'sendpress'); ?> <?php echo get_the_title($list); ?> </strong></h2> <br> <div class="progress progress-striped active"> <div class="progress-bar sp-queueit" style="width: 0%;"></div> </div> <span id="queue-total">0</span> of <span id="list-total"><?php echo $blogusers; ?> </span> </div> <?php }
static function external($template_id, $email_id, $subscriber_id, $e) { $links = SendPress_Data::build_social(); if ($links != '' && $links != false) { return $links; } return ''; }
static function delete_subscribers_bulk_all() { if (isset($_GET['subscriber']) && is_array($_GET['subscriber'])) { foreach ($_GET['subscriber'] as $value) { SendPress_Data::delete_subscriber($value); } } SendPress_Admin::redirect('Subscribers_All'); }
function html($sp) { global $post_ID, $post; $list = ''; if (isset($_GET['emailID'])) { $emailID = SPNL()->validate->int($_GET['emailID']); $post = get_post($emailID); $post_ID = $post->ID; } update_post_meta($post->ID, '_send_last', 0); $info = get_post_meta($post->ID, '_send_data', true); $lists = get_post_meta($post->ID, '_send_lists', true); $subject = $post->post_title; $list = explode(",", $lists); $view = isset($_GET['view']) ? $_GET['view'] : ''; if (isset($_GET['finished'])) { $time = get_post_meta($post->ID, '_send_time', true); if ($time == '0000-00-00 00:00:00') { SendPress_Admin::redirect('Queue'); } else { SendPress_Admin::redirect('Reports'); } } $subs = SendPress_Data::get_active_subscribers_count($list); update_post_meta($post->ID, '_send_last_count', $subs); update_post_meta($post->ID, '_sendpress_report', 'new'); ?> <div id="taskbar" class="lists-dashboard rounded group"> </div><input type="hidden" id="post_ID" name="post_ID" value="<?php echo $post->ID; ?> " /><input type="hidden" id="reporttoqueue" name="reporttoqueue" value="<?php echo $lists; ?> " /> <div class='well' id="confirm-queue-add"> <h2><strong><?php _e('Adding Subscribers to Queue', 'sendpress'); ?> </strong></h2><br> <!-- <p>email: <?php echo stripslashes(esc_attr(htmlspecialchars($subject))); ?> </p>--> <div class="progress progress-striped active"> <div class="progress-bar sp-queueit" style="width: 0%;"></div> </div> <span id="queue-total">0</span> of <span id="list-total"><?php echo $subs; ?> </span> </div> <?php }
public static function build_cache() { self::getInstance(); $email_list = SendPress_Data::get_email_id_from_queue(); foreach ($email_list as $email) { $html = SendPress_Template::get_instance()->render_html($email->emailID, false, false, false); self::set($email->emailID, $html); } }
function html() { $ip = $_SERVER['REMOTE_ADDR']; $info = $this->data(); $link = SendPress_Data::get_url_by_id($info->urlID); SendPress_Data::track_click($info->id, $info->report, $info->urlID, $ip, $this->_device_type, $this->_device); header("Location: " . esc_url_raw($link->url)); //wp_redirect( $link->url ); exit; }
function html($sp) { echo "<h2>" . __('Attempting to install or repair missing data', 'sendpress') . "</h2><br>"; SendPress_Data::install(); @SPNL()->db->subscribers_tracker->create_table(); @SPNL()->db->url->create_table(); @SPNL()->db->subscribers_url->create_table(); echo "<pre>"; echo SendPress_DB_Tables::check_setup_support(); echo "</pre>"; }
function save() { $name = $_POST['name']; $public = 0; if (isset($_POST['public']) && $_POST['sync_role'] == 'none') { $public = $_POST['public']; } $list_id = SendPress_Data::create_list(array('name' => $name, 'public' => $public)); update_post_meta($list_id, 'sync_role', $_POST['sync_role']); SendPress_Admin::redirect('Subscribers'); }
function save($post, $sp) { if (isset($_POST['templates'])) { SendPress_Data::remove_all_templates(); SendPress_Template_Manager::update_template_content(); } if (isset($_POST['settings'])) { SendPress_Data::remove_all_settings(); //SendPress_Data::create_settings_post_signup_form(); } SendPress_Admin::redirect('Settings_Dbfix'); }
function html() { $info = $this->data(); if (isset($_GET['id'])) { $id = SPNL()->validate->int($_GET['id']); } else { $id = $info->id; } $email = SendPress_Data::process_with_iron($id); $data = array("send" => $email); echo json_encode($data); }
static function data() { $transient_key = 'sendpress_tracking_cache'; $data = get_transient($transient_key); // bail if transient is set and valid if ($data !== false) { return; } // Make sure to only send tracking data once a week set_transient($transient_key, 1, WEEK_IN_SECONDS); // Start of Metrics global $blog_id, $wpdb; $hash = get_option('SendPress_Tracking_Hash', false); if (!$hash || empty($hash)) { // create and store hash $hash = md5(site_url()); update_option('SendPress_Tracking_Hash', $hash); } $pts = array(); $post_types = get_post_types(array('public' => true)); if (is_array($post_types) && $post_types !== array()) { foreach ($post_types as $post_type) { $count = wp_count_posts($post_type); $pts[$post_type] = $count->publish; } } unset($post_types); $comments_count = wp_count_comments(); $theme_data = wp_get_theme(); $theme = array('name' => $theme_data->display('Name', false, false), 'theme_uri' => $theme_data->display('ThemeURI', false, false), 'version' => $theme_data->display('Version', false, false), 'author' => $theme_data->display('Author', false, false), 'author_uri' => $theme_data->display('AuthorURI', false, false)); $theme_template = $theme_data->get_template(); if ($theme_template !== '' && $theme_data->parent()) { $theme['template'] = array('version' => $theme_data->parent()->display('Version', false, false), 'name' => $theme_data->parent()->display('Name', false, false), 'theme_uri' => $theme_data->parent()->display('ThemeURI', false, false), 'author' => $theme_data->parent()->display('Author', false, false), 'author_uri' => $theme_data->parent()->display('AuthorURI', false, false)); } else { $theme['template'] = ''; } unset($theme_template); $plugins = array(); $active_plugin = get_option('active_plugins'); foreach ($active_plugin as $plugin_path) { if (!function_exists('get_plugin_data')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path); $slug = str_replace('/' . basename($plugin_path), '', $plugin_path); $plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']); } unset($active_plugins, $plugin_path); $lists = SendPress_Data::get_lists(); $data = array('site' => array('hash' => $hash, 'wp_version' => get_bloginfo('version'), 'sp' => SENDPRESS_VERSION, 'pro' => defined('SENDPRESS_PRO_VERSION') ? SENDPRESS_PRO_VERSION : 0, 'lists' => count($lists->posts), 'subscribers' => SendPress_Data::get_total_subscribers(), 'multisite' => is_multisite(), 'lang' => get_locale()), 'pts' => $pts, 'options' => apply_filters('sp_tracking_filters', array()), 'theme' => $theme, 'plugins' => $plugins); $args = array('body' => $data, 'blocking' => false, 'sslverify' => false); wp_remote_post('http://api.sendpress.com/api/v1/track/add', $args); }
function html($sp) { global $post_ID, $post; $view = isset($_GET['view']) ? $_GET['view'] : ''; if (isset($_GET['emailID'])) { $emailID = SPNL()->validate->int($_GET['emailID']); $post = get_post($emailID); $post_ID = $post->ID; } ?> <form method="post"> <input type="hidden" id="post_ID" name="post_ID" value="<?php echo $post->ID; ?> " /> <h2><?php _e('Cancel Scheduled Email', 'sendpress'); ?> </h2> <div class='well'> <?php $info = get_post_meta($post->ID, '_send_time', true); ?> <p><?php _e('Subject', 'sendpress'); ?> : <?php echo $post->post_title; ?> </p> <p><?php _e('Date', 'sendpress'); ?> : <?php echo date_i18n('Y/m/d @ h:i A', strtotime($info)); ?> </p> <?php SendPress_Data::nonce_field(); ?> <button class="btn" value="cancel" name="submit"><?php _e('Cancel', 'sendpress'); ?> </button> <button class="btn btn-danger" value="delete" name="submit"><?php _e('Delete Scheduled Email', 'sendpress'); ?> </button> </div> </form> <?php }
function html() { //$ip = $_SERVER['REMOTE_ADDR']; $info = $this->data(); //$hash = wp_hash( $info->url , 'sendpress' ); $db_url = SPNL()->db->url; $url_in_db = $db_url->get($info->url); //= SendPress_Data::get_url_by_hash( $hash ); if ($url_in_db == false) { $id = $db_url->add($info->url); } else { $id = $url_in_db; } $dk = SendPress_Data::devicetypes($this->_device_type); $url = $info->url; switch ($info->url) { case '{sp-browser-url}': $url = SPNL()->template_tags->do_subscriber_tags(SendPress_Tag_Browser_Url::external($info->url, $info->report, $info->id, false), $info->report, $info->report, $info->id, false); break; case '{sp-unsubscribe-url}': $url = SPNL()->template_tags->do_subscriber_tags(SendPress_Tag_Unsubscribe::external($info->url, $info->report, $info->id, false), $info->report, $info->report, $info->id, false); break; case '{sp-manage-subscription-url}': $url = SPNL()->template_tags->do_subscriber_tags(SendPress_Tag_Manage_Subscriptions::external($info->url, $info->report, $info->id, false), $info->report, $info->report, $info->id, false); break; } SPNL()->db->subscribers_url->add_update(array('subscriber_id' => $info->id, 'email_id' => $info->report, 'url_id' => $id)); SPNL()->db->subscribers_tracker->open($info->report, $info->id, 2); if (strrpos($url, "mailto") !== false) { header("Location: " . esc_url_raw($url)); } else { if (defined("SENDPRESS_PRO_VERSION")) { $url = add_query_arg('utm_medium', 'email', $url); $url = add_query_arg('utm_source', 'sendpress', $url); $sub = get_post_meta($info->report, '_sendpress_subject', true); $alt = get_post_meta($info->report, 'google-campaign-name', true); if ($alt !== false) { $sub = $alt; } $url = add_query_arg('utm_campaign', $sub, $url); } wp_redirect(esc_url_raw($url)); } exit; // //$link = SendPress_Data::get_url_by_id( $info->urlID ); //SendPress_Data::track_click( $info->id , $info->report, $info->urlID , $ip , $this->_device_type, $this->_device ); //header("Location: " . $link->url); //wp_redirect( $link->url ); //exit; }
function export_list() { $l = SPNL()->validate->int($_GET['listID']); if ($l > 0) { $items = SendPress_Data::export_subscirbers($l); header("Content-type:text/octect-stream"); header("Content-Disposition:attachment;filename=sendpress.csv"); print "email,firstname,lastname,status \n"; foreach ($items as $user) { print $user->email . "," . $user->firstname . "," . $user->lastname . "," . $user->status . "\n"; } } exit; }
function sendpress_register_template($html_template = array()) { global $sendpress_html_templates; $id = SendPress_Data::get_html_template_id_by_slug(sanitize_title_for_query($html_template['name'])); //$id = 0; echo $id; $content = file_get_contents($html_template['path']); $my_post = array('ID' => $id, 'post_content' => $content, 'post_title' => $html_template['name'], 'post_status' => 'draft'); //print_r( $my_post ); // Update the post into the database wp_update_post($my_post); //$html_template['ID'] = $id; //$sendpress_html_templates[$id] = $html_template; }
function save() { $post_options = array('list', 'email', 'firstname', 'lastname', 'status'); $user_info = array(); foreach ($post_options as $opt) { $user_info[$opt] = isset($_POST['sp_' . $opt]) ? $_POST['sp_' . $opt] : false; } $valid_user = array(); //foreach() if (isset($user_info['list'])) { if (!is_array($user_info['list'])) { $user_info['list'] = array($user_info['list']); } if (isset($user_info['status'])) { $valid_user['status'] = $user_info['status']; } else { $valid_user['status'] = 2; } $data_error = false; if (isset($user_info['email']) && is_email($user_info['email'])) { $valid_user['email'] = $user_info['email']; } else { $data_error = __('Invalid Email', 'sendpress'); } if (isset($user_info['firstname'])) { $valid_user['firstname'] = $user_info['firstname']; } else { $valid_user['firstname'] = ''; } if (isset($user_info['lastname'])) { $valid_user['lastname'] = $user_info['lastname']; } else { $valid_user['lastname'] = ''; } $status = false; if ($data_error == false) { $list = implode(",", $user_info['list']); $custom = apply_filters('sendpress_subscribe_to_list_custom_fields', array(), $_POST); $status = SendPress_Data::subscribe_user($list, $valid_user['email'], $valid_user['firstname'], $valid_user['lastname'], $valid_user['status'], $custom); if ($status == false) { $data_error = __('Problem with subscribing user.', 'sendpress'); } else { $data_error = __('Thanks for subscribing.', 'sendpress'); } } } $this->message = $data_error; }
function html($sp) { $count = SendPress_Data::get_bad_post_count(); echo __("We see", "sendpress") . " " . $count . " " . __("bad posts.", "sendpress"); $link = SendPress_Admin::link('Settings_Fixposts', array('action' => 'posts-repair')); echo "<br><br><a href='{$link}' class='btn btn-primary' >" . __('Attempt to Delete These', 'sendpress') . "</a>"; /* echo "<h2>Attempting to install or repair missing data</h2><br>"; SendPress_Data::install(); echo "<pre>"; echo SendPress_DB_Tables::check_setup_support(); echo "</pre>"; */ }
static function external($template_id, $email_id, $subscriber_id, $e) { //maybe saved link? $link_data = array("id" => $subscriber_id, "view" => 'manage'); $code = SendPress_Data::encrypt($link_data); $link = SendPress_Manager::public_url($code); if (SendPress_Option::get('manage-page') == 'custom') { $page = SendPress_Option::get('manage-page-id'); if ($page != false) { $plink = get_permalink($page); if ($plink != "") { $link = $plink . '?spms=' . $code; } } } return $link; }
function html($sp) { global $sendpress_html_templates; //print_r($sendpress_html_templates[$_GET['templateID']]); $templateID = SPNL()->validate->int($_GET['templateID']); $postdata = get_post($templateID); //print_r( $postdata ); ?> <form method="post" name="post" > <input type="hidden" value="<?php echo $templateID; ?> " name="templateID" /> <div class="pull-right"> <a href="<?php echo SendPress_Admin::link('Emails_Tempstyle', array('templateID' => $templateID)); ?> "><?php _e('Back to Template', 'sendpress'); ?> </a> <button class="btn btn-primary " type="submit" value="save" name="submit"><i class="icon-white icon-ok"></i> <?php echo __('Save', 'sendpress'); ?> </button> </div> <h2><?php echo $postdata->post_title; ?> <?php _e('Template Page Header', 'sendpress'); ?> </h2><br> <div class="tab-pane fade in active" id="home"><?php wp_editor(get_post_meta($postdata->ID, '_header_page', true), 'header-content'); ?> </div> <?php SendPress_Data::nonce_field(); ?> </form> <?php $this->popup(); }
function html() { //$ip = $_SERVER['REMOTE_ADDR']; $info = $this->data(); //$hash = wp_hash( $info->url , 'sendpress' ); $dk = SendPress_Data::devicetypes($this->_device_type); $url = $info->url; switch ($info->url) { case '{sp-browser-url}': $url = SPNL()->template_tags->do_subscriber_tags(SendPress_Tag_Browser_Url::external($info->url, $info->report, $info->id, false), $info->report, $info->report, $info->id, false); break; case '{sp-unsubscribe-url}': $url = SPNL()->template_tags->do_subscriber_tags(SendPress_Tag_Unsubscribe::external($info->url, $info->report, $info->id, false), $info->report, $info->report, $info->id, false); break; case '{sp-manage-subscription-url}': $url = SPNL()->template_tags->do_subscriber_tags(SendPress_Tag_Manage_Subscriptions::external($info->url, $info->report, $info->id, false), $info->report, $info->report, $info->id, false); break; } $args = array('timeout' => 0.1, 'blocking' => false, 'headers' => array(), 'sslverify' => false); $request = home_url('/spnl-api/tracker'); // Parameters as separate arguments $request = add_query_arg(array('email' => $info->report, 'url' => urlencode($info->url), 'id' => $info->id), $request); wp_remote_get($request, $args); if (strrpos($url, "mailto") !== false) { header("Location: " . esc_url_raw($url)); } else { if (defined("SENDPRESS_PRO_VERSION")) { $url = add_query_arg('utm_medium', 'email', $url); $url = add_query_arg('utm_source', 'sendpress', $url); $sub = get_post_meta($info->report, '_sendpress_subject', true); $alt = get_post_meta($info->report, 'google-campaign-name', true); if ($alt !== false) { $sub = $alt; } $url = add_query_arg('utm_campaign', $sub, $url); } wp_redirect(esc_url_raw($url)); } exit; // //$link = SendPress_Data::get_url_by_id( $info->urlID ); //SendPress_Data::track_click( $info->id , $info->report, $info->urlID , $ip , $this->_device_type, $this->_device ); //header("Location: " . $link->url); //wp_redirect( $link->url ); //exit; }
static function update_template_content() { $templates = self::templates(); foreach ($templates as $key => $template) { SendPress_Data::get_email_template($key, $template); } /* $update_array= array(); foreach ($template_data as $template) { $guid = get_post_meta($template->ID, '_guid', true); foreach ($templates as $key => $values) { if( $guid == trim($values['guid']) && $values['name'] == $template->post_title ){ // $content = file_get_contents( $update['path'] ); $template->post_title = $values['name']; $template->post_content = json_encode($values); $template->post_status = $values['status']; wp_update_post( $template ); unset($templates[$key]); } } } foreach ($templates as $key => $template) { //print_r($template); //$content = file_get_contents($template['path']); // Create post object $my_post = array( 'post_title' => $template['name'], 'post_content' => json_encode($template), 'post_status' => $template['status'], 'post_name' => $key, 'post_type' => 'sp_template' ); // Insert the post into the database $post_id_added = wp_insert_post( $my_post ); update_post_meta( $post_id_added, '_guid', $template['guid'] ); update_post_meta( $post_id_added, '_footer_page', SendPress_Tag_Footer_Page::content() ); update_post_meta( $post_id_added, '_header_content', SendPress_Tag_Header_Content::content() ); update_post_meta( $post_id_added, '_header_padding', 'pad-header' ); } */ }
function html($sp) { SendPress_Tracking::event('Emails Tab'); //Create an instance of our package class... $testListTable = new SendPress_System_Email_Table(); //Fetch, prepare, sort, and filter our data... $testListTable->prepare_items(); ?> <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions --> <form id="email-filter" method="get"> <div id="taskbar" class="lists-dashboard rounded group"> <?php $form_types = SendPress_Data::get_system_email_types(); if ($form_types) { ?> <div id="button-area"> <a class="btn btn-primary btn-large" href="?page=<?php echo $_REQUEST['page']; ?> &view=systememailcreate"><?php _e('Create System E-mail', 'sendpress'); ?> </a> </div> <?php } ?> </div> <!-- For plugins, we also need to ensure that the form posts back to our current page --> <input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?> " /> <!-- Now we can render the completed list table --> <?php $testListTable->display(); ?> <?php wp_nonce_field($this->_nonce_value); ?> </form> <?php }
public static function form_post() { global $wp; $email = isset($_POST['sp-email']) ? $_POST['sp-email'] : false; $message = 'true'; if ($email !== false) { if (is_email($email)) { $id = SendPress_Data::get_subscriber_by_email($email); if ($id != false) { SendPress_Data::unsubscribe_from_all_lists($id); } } } if (isset($_POST['sp-current-page'])) { $permalink = $_POST['sp-current-page']; $permalink = add_query_arg($wp->query_string, array('sp-unsubscribe' => $message), $permalink); wp_safe_redirect($permalink); } }
function prerender() { $r = $_GET['rid']; $s = $_GET['sid']; $r = (int) base64_decode($r); $s = (int) base64_decode($s); if (is_numeric($r)) { $lists = get_post_meta($r, '_send_lists', true); $lists = explode(",", $lists); foreach ($lists as $list) { SendPress_Data::unsubscribe_from_list($s, $r, $list); } } $link_data = array("id" => $s, "report" => $r, "urlID" => '0', "view" => "manage", "listID" => "0", "action" => ""); $code = SendPress_Data::encrypt($link_data); $link = SendPress_Manager::public_url($code); $this->redirect($link); exit; }
function save() { $listid = $_POST['listID']; $name = $_POST['name']; $public = 0; if (isset($_POST['public']) && $_POST['sync_role'] == 'none') { $public = $_POST['public']; } SendPress_Data::update_list($listid, array('name' => $name, 'public' => $public)); $roles_list = array(); $test_list = 0; if (isset($_POST['test_list'])) { $public = $_POST['test_list']; } update_post_meta($listid, '_test_list', $_POST['test_list']); update_post_meta($listid, 'sync_role', $_POST['sync_role']); update_post_meta($listid, 'meta-key', $_POST['meta-key']); update_post_meta($listid, 'meta-compare', $_POST['meta-compare']); update_post_meta($listid, 'meta-value', $_POST['meta-value']); SendPress_Admin::redirect('Subscribers'); }
function auto_cron() { // make sure we're in wp-cron.php if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-cron.php')) { // make sure a secret string is provided in the ur if (isset($_GET['action']) && $_GET['action'] == 'sendpress') { $time_start = microtime(true); $count = SendPress_Data::emails_in_queue(); $bg = 0; if ($count > 0) { SendPress_Queue::send_mail(); $count = SendPress_Data::emails_in_queue(); } else { SPNL()->log->prune_logs(); SendPress_Data::clean_queue_table(); //SendPress_Logging::prune_logs(); $bg = 1; } $attempted_count = SendPress_Option::get('autocron-per-call', 25); $pro = 0; if (defined('SENDPRESS_PRO_VERSION')) { $pro = SENDPRESS_PRO_VERSION; } $stuck = SendPress_Data::emails_stuck_in_queue(); $limit = SendPress_Manager::limit_reached(); $emails_per_day = SendPress_Option::get('emails-per-day'); $emails_per_hour = SendPress_Option::get('emails-per-hour'); $hourly_emails = SendPress_Data::emails_sent_in_queue("hour"); $emails_so_far = SendPress_Data::emails_sent_in_queue("day"); $limits = array('autocron' => $attempted_count, 'dl' => $emails_per_day, 'hl' => $emails_per_hour, 'ds' => $emails_so_far, 'hs' => $hourly_emails); $time_end = microtime(true); $time = $time_end - $time_start; echo json_encode(array("background" => $bg, "queue" => $count, "stuck" => $stuck, "version" => SENDPRESS_VERSION, "pro" => $pro, "limit" => $limit, 'info' => $limits, 'time' => number_format($time, 3))); die; } } }