function save() { $_POST['post_type'] = SendPress_Data::email_post_type(); // Update post 37 (37!) $my_post = _wp_translate_postdata(true); $system_emails = SendPress_Option::base_get('system-emails'); $my_post['post_status'] = 'sp-systememail'; $my_post['post_content'] = SendPress_Data::get_sysemail_content($_POST['email_type']); // Update the post into the database wp_update_post($my_post); update_post_meta($my_post['ID'], '_sendpress_subject', $_POST['post_subject']); update_post_meta($my_post['ID'], '_sendpress_template', $_POST['template']); update_post_meta($my_post['ID'], '_sendpress_status', 'private'); update_post_meta($my_post['ID'], '_sendpress_system', 'new'); update_post_meta($my_post['ID'], '_system_email_type', $_POST['email_type']); update_post_meta($my_post['ID'], '_system_default', $_POST['default']); if ($_POST['default']) { //set default system e-mail for this type SendPress_Data::set_system_email_default($my_post['ID'], $_POST['email_type']); } SendPress_Email::set_default_style($my_post['ID']); //clear the cached file. delete_transient('sendpress_email_html_' . $my_post['ID']); if (!in_array($_POST['email_type'], $system_emails)) { $system_emails[] = $_POST['email_type']; } SendPress_Option::base_set('system-emails', $system_emails); SendPress_Admin::redirect('Settings_Emailedit', array('emailID' => $my_post['ID'])); //$this->save_redirect( $_POST ); }
function send_email($to, $subject, $html, $text, $istest = false, $sid, $list_id, $report_id) { //$user = SendPress_Option::get( 'mandrilluser' ); //$pass = SendPress_Option::get( 'mandrillpass' ); $from_email = SendPress_Option::get('fromemail'); //$hdr = new SendPress_SendGrid_SMTP_API(); $m = SendPress_Option::get_sender('sendpress'); //$hdr->addFilterSetting('dkim', 'domain', SendPress_Manager::get_domain_from_email($from_email) ); //$phpmailer->AddCustomHeader(sprintf( 'X-SMTPAPI: %s', $hdr->asJSON() ) ); $info = array("X-SP-METHOD" => "WPED.co", "X-SP-LIST" => $list_id, "X-SP-REPORT" => $report_id, "X-SP-SUBSCRIBER" => $sid, "X-SP-DOMAIN" => home_url()); $url = 'https://gateway.wped.co/send/'; //$url = 'http://spnl.dev/'; $verify_ssl = true; if (isset($m['verifyssl']) && $m['verifyssl'] == 'donotverify') { $verify_ssl = false; $url = 'http://api.wped.co/send'; } $message = array('to' => array(array('email' => $to)), 'subject' => $subject, 'html' => $html, 'text' => $text, 'from_email' => $from_email, 'from_name' => SendPress_Option::get('fromname'), 'headers' => $info, 'inline_css' => true, 'subaccount' => $m['sendpress-key'], 'metadata' => array('sender' => 'SPNL', 'return' => home_url())); $response = wp_remote_post($url, array('method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array('Content-Type' => 'application/json'), 'body' => json_encode($message), 'sslverify' => $verify_ssl, 'cookies' => array())); if (is_wp_error($response)) { $error_message = $response->get_error_message(); SPNL()->log->add('WPED Sending', $error_message, 0, 'sending'); return false; } else { return true; } return false; }
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; } } } }
function save() { if (isset($_POST['send-date']) && $_POST['send-date'] == 'later') { $send_at = $_POST['date-pickit'] . " " . $_POST['send-later-time']; } else { $send_at = '0000-00-00 00:00:00'; } if (isset($_POST['test-add'])) { $csvadd = "email,firstname,lastname\n" . trim($_POST['test-add']); $data = SendPress_Data::subscriber_csv_post_to_array($csvadd); } else { $data = false; } $listids = isset($_POST['listIDS']) ? $_POST['listIDS'] : array(); SendPress_Option::set('current_send_' . $_POST['post_ID'], array('listIDS' => $listids, 'testemails' => $data, 'send_at' => $send_at)); SendPress_Option::set('current_send_subject_' . $_POST['post_ID'], $_POST['post_subject']); if (isset($_POST['test_report'])) { update_post_meta($_POST['post_ID'], 'istest', true); } else { update_post_meta($_POST['post_ID'], 'istest', false); } if (isset($_POST['google-campaign-name'])) { update_post_meta($_POST['post_ID'], 'google-campaign-name', $_POST['google-campaign-name']); } if (isset($_POST['submit']) && $_POST['submit'] == 'save-next') { SendPress_Admin::redirect('Emails_Send_Confirm', array('emailID' => $_GET['emailID'])); } else { SendPress_Admin::redirect('Emails_Style', array('emailID' => $_GET['emailID'])); } }
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; } } } }
static function external($template_id, $email_id, $subscriber_id, $example) { $canspam = SendPress_Option::get('canspam'); if ($canspam != '' && $canspam != false) { return nl2br($canspam); } return ''; }
function module_deactivate_sendpress_pro() { $path = $_POST['plugin_path']; $pro_options = SendPress_Option::get('pro_plugins'); if (!preg_match('/sendpress-pro.php/i', $path)) { if (preg_match('/sendpress-pro/i', $path)) { //make sure the plugin loads from sendpress pro $pro_options[$path] = false; SendPress_Option::set('pro_plugins', $pro_options); } } else { deactivate_plugins($path); } }
function sendpress($phpmailer) { // Set the mailer type as per config above, this overrides the already called isMail method $phpmailer->Mailer = 'smtp'; // We are sending SMTP mail $phpmailer->IsSMTP(); // Set the other options $phpmailer->Host = 'smtp.sendgrid.net'; $phpmailer->Port = 25; // If we're using smtp auth, set the username & password $phpmailer->SMTPAuth = TRUE; $phpmailer->Username = SendPress_Option::get('sp_user'); $phpmailer->Password = SendPress_Option::get('sp_pass'); return $phpmailer; }
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; }
static function send_mail_cron() { //@ini_set('max_execution_time',0); global $wpdb; $count = SendPress_Option::get('emails-per-hour'); $count = SendPress_Option::get('wpcron-per-call', 25); $email_count = 0; $attempts = 0; if (SendPress_Manager::limit_reached($count)) { return; } SendPress_Email_Cache::build_cache(); for ($i = 0; $i < $count; $i++) { $email = SendPress_Data::get_single_email_from_queue(); if ($email != null) { $attempts++; SendPress_Data::queue_email_process($email->id); $result = SendPress_Manager::send_email_from_queue($email); $email_count++; if ($result) { if ($result === true) { $wpdb->update(SendPress_Data::queue_table(), array('success' => 1, 'inprocess' => 3), array('id' => $email->id)); //( $sid, $rid, $lid=null, $uid=null, $ip=null, $device_type=null, $device=null, $type='confirm' ) //$wpdb->update( SendPress_Data::queue_table() , array('success'=>1,'inprocess'=>3 ) , array('id'=> $email->id )); //$wpdb->insert(SendPress_Data::subscriber_tracker_table() , array('subscriberID'=>$email->subscriberID,'emailID'=>$email->emailID,'sent_at' => get_gmt_from_date( date('Y-m-d H:i:s') )) ); SPNL()->db("Subscribers_Tracker")->add(array('subscriber_id' => intval($email->subscriberID), 'email_id' => intval($email->emailID))); SendPress_Data::add_subscriber_event($email->subscriberID, $email->emailID, $email->listID, null, null, null, null, 'send'); } else { $wpdb->update(SendPress_Data::queue_table(), array('success' => 2, 'inprocess' => 3), array('id' => $email->id)); SendPress_Data::add_subscriber_event($email->subscriberID, $email->emailID, $email->listID, null, null, null, null, 'bounce'); SendPress_Data::bounce_subscriber_by_id($email->subscriberID); } //$wpdb->insert( $this->subscriber_open_table(), $senddata); $count++; //SendPress_Data::update_report_sent_count( $email->emailID ); } else { $wpdb->update(SendPress_Data::queue_table(), array('attempts' => $email->attempts + 1, 'inprocess' => 0, 'last_attempt' => date('Y-m-d H:i:s')), array('id' => $email->id)); } } else { //We ran out of emails to process. break; } set_time_limit(30); } return; }
function pn_select($sub_id, $listid) { $pro_list = SendPress_Option::get('pro_notification_lists'); if (isset($pro_list['post_notifications']['id']) && $listid == $pro_list['post_notifications']['id']) { $current = SendPress_Data::get_subscriber_meta($sub_id, 'post_notifications', $listid); $info = SendPress_Data::get_post_notification_types(); echo '<select name="' . $listid . '-pn">'; echo "<option cls value='-1' >No Status</option>"; foreach ($info as $key => $value) { $cls = ''; if ($current == $key) { $cls = " selected='selected' "; } echo "<option {$cls} value='" . $key . "'>" . $value . "</option>"; } echo '</select> '; } }
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; } } }
function html($sp) { SendPress_Tracking::event('Queue Tab'); $testListTable = new SendPress_Queue_Errors_Table(); $testListTable->prepare_items(); SendPress_Option::set('no_cron_send', 'false'); $sp->cron_start(); $open_info = array("id" => 13, "report" => 10, "view" => "open"); ?> <h2><?php _e('Error history for the last 2 Weeks', 'sendpress'); ?> .</h2> <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions --> <form id="email-filter" action="<?php echo SendPress_Admin::link('Queue_Errors'); ?> " method="get"> <!-- For plugins, we also need to ensure that the form posts back to our current page --> <input type="hidden" name="page" value="<?php echo SPNL()->validate->page($_REQUEST['page']); ?> " /> <!-- Now we can render the completed list table --> <?php $testListTable->display(); ?> <?php wp_nonce_field($sp->_nonce_value); ?> </form> <br> <?php }
/** * Enqueue styles and scripts needed for the pointers. */ function enqueue() { if (!current_user_can('manage_options')) { return; } SendPress_Option::set('allow_tracking', ''); $track = SendPress_Option::get('allow_tracking'); $tour = false; //SendPress_Option::get( 'intro_tour' ); if (($track == false || $track == '') && !isset($_GET['allow_tracking'])) { wp_enqueue_style('wp-pointer'); wp_enqueue_script('jquery-ui'); wp_enqueue_script('wp-pointer'); wp_enqueue_script('utils'); add_action('admin_print_footer_scripts', array($this, 'tracking_request')); } else { if ($tour == 'false' || $tour == false) { /* add_action( 'admin_print_footer_scripts', array( $this, 'intro_tour' ) ); add_action( 'admin_head', array( $this, 'admin_head' ) ); */ } } }
function html() { $icon_list = SendPress_Data::social_icons(); $socialsize = SendPress_Option::get('socialsize', 'large'); ?> <form method="post" id="post" role="form"> <div > <div id="button-area"> <input type="submit" value="<?php _e('Save', 'sendpress'); ?> " class="btn btn-large btn-primary"/> </div> </div> <br><br><br> <?php $this->panel_start(); ?> <div class="sp-row"> <div class="sp-50 sp-first"> <p class="lead"><?php _e('Social Icons appear in emails in Alphabetical order. If you enter a url in the box below then that icon will show in your emails.', 'sendpress'); ?> </p> </div> <div class="sp-50"> <p> <label > <input type="radio" name="icon-view" value="large" <?php checked($socialsize, 'large'); ?> /> <?php _e('Large', 'sendpress'); ?> ( 32px x 32px ) </label> <br> <label > <input type="radio" name="icon-view" value="small" <?php checked($socialsize, 'small'); ?> /> <?php _e('Small', 'sendpress'); ?> ( 16px x 16px ) </label> <br> <label > <input type="radio" name="icon-view" value="text" <?php checked($socialsize, 'text'); ?> /> <?php _e('Text', 'sendpress'); ?> </label> </p> </div> </div> <div class="sp-row"> <div class="sp-50 sp-first"> <?php $icons = count($icon_list); $link = SendPress_Option::get('socialicons'); $firsthalf = array_slice($icon_list, 0, $icons / 2); $secondhalf = array_slice($icon_list, $icons / 2); $firsthalf = array_merge(array_flip(array('Facebook', 'LinkedIn', 'GitHub', 'Instagram')), $firsthalf); $secondhalf = array_merge(array_flip(array('Twitter', 'Skype', 'Vimeo', 'YouTube', 'WordPress')), $secondhalf); foreach ($firsthalf as $key => $value) { $class = ""; if (isset($link[$key])) { $class = "bg-success"; } ?> <div class="well <?php echo $class; ?> "> <div class="form-group"> <?php echo "<span class='hidden-xs hidden-sm pull-right text-muted'>" . $value . "</span>"; ?> <label for="url-<?php echo $key; ?> " class="control-label "> <img src="<?php echo SENDPRESS_URL . "img/16px/" . $key . ".png"; ?> " /> <img src="<?php echo SENDPRESS_URL . "img/32px/" . $key . ".png"; ?> " /> <?php echo $key . "</label>"; $xlink = ""; if (isset($link[$key])) { $xlink = $link[$key]; } ?> </div><input type="text" name="url-<?php echo $key; ?> " value="<?php echo $xlink; ?> " class="form-control" placeholder="<?php echo __('URL da mídia social: por favor, inclua http:// ou https://', 'jaiminho'); ?> "> </div> <?php } ?> </div> <div class="sp-50"> <?php foreach ($secondhalf as $key => $value) { $class = ""; if (isset($link[$key])) { $class = "bg-success"; } ?> <div class="well <?php echo $class; ?> "> <div class="form-group"> <?php echo "<span class='hidden-xs hidden-sm pull-right text-muted'>" . $value . "</span>"; ?> <label for="url-<?php echo $key; ?> " class="control-label "> <img src="<?php echo SENDPRESS_URL . "img/16px/" . $key . ".png"; ?> " /> <img src="<?php echo SENDPRESS_URL . "img/32px/" . $key . ".png"; ?> " /> <?php echo $key . "</label>"; $xlink = ""; if (isset($link[$key])) { $xlink = $link[$key]; } ?> </div><input type="text" name="url-<?php echo $key; ?> " value="<?php echo $xlink; ?> " class="form-control" placeholder="<?php echo __('URL da mídia social: por favor, inclua http:// ou https://', 'jaiminho'); ?> " /> </div> <?php } ?> </div> </div> <?php $this->panel_end(); ?> <?php wp_nonce_field($this->_nonce_value); ?> </form> <?php }
function text_settings() { ?> <br> <div class="well"> <?php $display_correct = __("Is this email not displaying correctly?", "sendpress"); $view = __("View it in your browser", "sendpress"); if (SendPress_Option::get('beta')) { ?> <h4 class="nomargin"><?php _e('Link to browser version', 'sendpress'); ?> </h4> <p><input type=radio value="" name="browerslink" checked/> <?php _e('Use default', 'sendpress'); ?> <input type=radio value="" name="browerslink"/> <?php _e('Use custom', 'sendpress'); ?> <input type=radio value="" name="browerslink"/> <?php _e('None', 'sendpress'); ?> </p> <p><input name="inbrowser" type="text" id="inbrowser" value="<?php echo SendPress_Option::get('inbrowser'); ?> " class="regular-text sp-text"></p> <br> <?php } ?> <div style="float: right; width: 45%;"> </div> <div style="width: 45%; margin-right: 10%"> <h4 class="nomargin"><?php _e('CAN-SPAM', 'sendpress'); ?> : <small><?php _e('required in the US.', 'sendpress'); ?> </small> <?php _e('This area displays in Email Footer', 'sendpress'); ?> </h4> <textarea cols="20" rows="10" class="large-text code" name="can-spam"><?php echo SendPress_Option::get('canspam'); ?> </textarea> <p><?php _e('Your message must include your valid physical postal address. This can be your current street address, a post office box youve registered with the U.S. Postal Service, or a private mailbox youve registered with a commercial mail receiving agency established under Postal Service regulations.', 'sendpress'); ?> </p> <?php _e('This is dictated under the <a href="http://business.ftc.gov/documents/bus61-can-spam-act-compliance-guide-business" target="_blank">Federal CAN-SPAM Act of 2003</a>.', 'sendpress'); ?> </p> </div> </div> <?php }
function html() { global $sendpress_sender_factory; $senders = $sendpress_sender_factory->get_all_senders(); ksort($senders); $method = SendPress_Option::get('sendmethod'); $fe = __('From Email', 'sendpress'); $fn = __('From Name', 'sendpress'); ?> <!-- <div style="float:right;" > <a href="" class="btn btn-large btn-default" ><i class="icon-remove"></i> <?php _e('Cancel', 'sendpress'); ?> </a> <a href="#" id="save-update" class="btn btn-primary btn-large"><i class="icon-white icon-ok"></i> <?php _e('Save', 'sendpress'); ?> </a> </div> --> <form method="post" id="post"> <br class="clear"> <br class="clear"> <div class="sp-row"> <div class="sp-50 sp-first"> <?php $this->panel_start('<span class="glyphicon glyphicon-user"></span> ' . __('Sending Email', 'sendpress')); ?> <div class="form-group"> <label for="fromname"><?php _e('From Name', 'sendpress'); ?> </label> <input name="fromname" tabindex=1 type="text" id="fromname" value="<?php echo SendPress_Option::get('fromname'); ?> " class="form-control"> </div> <div class="form-group"> <label for="fromemail"><?php _e('From Email', 'sendpress'); ?> </label> <input name="fromemail" tabindex=2 type="text" id="fromemail" value="<?php echo SendPress_Option::get('fromemail'); ?> " class="form-control"> </div> <div class="form-group"> <label for="bounceemail"><?php _e('Email de Retorno', 'jaiminho'); ?> </label> <input name="bounceemail" tabindex=3 type="text" id="bounceemail" value="<?php echo SendPress_Option::get('bounce_email'); ?> " class="form-control"> </div> <?php $this->panel_end(); ?> </div > <div class="sp-50"> <?php $this->panel_start('<span class="glyphicon glyphicon-inbox"></span> ' . __('Test Email', 'sendpress')); ?> <div class="form-group"> <label for="testemail"><?php _e('Where to send Test Email', 'sendpress'); ?> </label> <input name="testemail" type="text" id="test-email-main" value="<?php echo SendPress_Option::get('testemail'); ?> " class="form-control"/> </div> <div class="sp-row"> <div class="sp-50 sp-first"> <button class="btn btn-primary btn-block" value="test" name="test" type="submit"><?php _e('Send Test!', 'sendpress'); ?> </button> </div> <div class="sp-50"> <button class="btn btn-danger btn-block" data-toggle="modal" data-target="#debugModal" type="button"><?php _e('Debug Info', 'sendpress'); ?> </button> </div> </div> <div class="sp-row"> <br> <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne"> <?php _e('Click to View Last Error', 'sendpress'); ?> </a> </h4> </div> <div id="collapseOne" class="panel-collapse collapse"> <div class="panel-body"> <?php $logs = SPNL()->log->get_connected_logs(array('posts_per_page' => 1, 'log_type' => 'sending')); if (!empty($logs)) { foreach ($logs as $log) { echo "<strong>" . $log->post_date . "</strong> " . $log->post_title; echo "<br>" . $log->post_content; } } ?> </div> </div> </div> </div> </div> <?php $this->panel_end(); ?> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php _e('Sending Account Setup', 'sendpress'); ?> </h3> </div> <div class="panel-body"> <input type="hidden" name="action" value="account-setup" /> <?php $new = array(); foreach ($senders as $key => $sender) { array_push($new, array($key, $sender->label())); } echo '<strong>Delivery Method: </strong>'; $this->select('sendpress-sender', $method, $new); ?> <br><br> <?php if (count($senders) < 3) { $c = 0; foreach ($senders as $key => $sender) { $class = ''; if ($c >= 1) { $class = "margin-left: 4%"; } echo "<div style=' float:left; width: 48%; {$class}' id='{$key}'>"; ?> <!-- XXXX --> <p> <!--<input name="sendpress-sender" type="radio" <?php if ($method == $key || strpos(strtolower($key), $method) > 0) { ?> checked="checked"<?php } ?> id="website" value="<?php echo $key; ?> " /> <?php _e('Send Emails via', 'sendpress'); ?> --> <?php echo $sender->label(); echo "</p><div class='well'>"; echo $sender->settings(); echo "</div></div>"; $c++; } } else { ?> <div class="tabbable tabs-left"> <ul class="nav nav-tabs"> <?php foreach ($senders as $key => $sender) { $class = ''; if ($method == $key || strpos(strtolower($key), $method) > 0) { $class = "class='active'"; } echo "<li {$class}><a href='#{$key}' data-toggle='tab'>"; if ($method == $key || strpos(strtolower($key), $method) > 0) { echo '<span class="glyphicon glyphicon-ok-sign"></span> '; } echo $sender->label(); echo "</a></li>"; } ?> </ul> <div class="tab-content" style="display:block;"> <?php foreach ($senders as $key => $sender) { $class = ''; if ($method == $key || strpos(strtolower($key), $method) > 0) { $class = "active"; } echo "<div class='tab-pane {$class}' id='{$key}'>"; ?> <!-- XXXX --> <!--<p> <input name="sendpress-sender" type="radio" <?php if ($key === 'SendPress_Sender_Website' && is_multisite()) { echo 'style="display:none"'; } ?> <?php if ($method == $key || strpos(strtolower($key), $method) > 0) { ?> checked="checked"<?php } ?> id="website" value="<?php echo $key; ?> " /> <?php _e('Activate', 'sendpress'); ?> --> <?php //echo $sender->label(); echo "</p><div class='well'>"; echo $sender->settings(); echo "</div></div>"; } ?> </div> </div> <p > <span class="glyphicon glyphicon-ok-sign"></span> = <?php _e('Currently Active', 'sendpress'); ?> </p> <?php } ?> </div> </div> <br class="clear"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php _e('Advanced Sending Options', 'sendpress'); ?> </h3> </div> <div class="panel-body"> <div class="boxer form-box"> <div style="float: right; width: 45%;"> <h2><?php _e('Email Sending Limits', 'sendpress'); ?> </h2> <?php $emails_per_day = SendPress_Option::get('emails-per-day'); $emails_per_hour = SendPress_Option::get('emails-per-hour'); $credits = SendPress_Option::get('emails-credits'); //$hourly_emails = SendPress_Data::emails_sent_in_queue("hour"); $emails_so_far = SendPress_Data::emails_sent_in_queue("day"); $offset = get_option('gmt_offset') * 60 * 60; // Time offset in seconds $local_timestamp = wp_next_scheduled('sendpress_cron_action') + $offset; //print_r(wp_get_schedules()); sprintf(__('You have sent <strong>%s</strong> emails so far today and you have <strong>%s</strong> credits remaining.', 'sendpress'), $emails_so_far, $credits); ?> <br><br> <input type="text" size="6" name="emails-per-day" value="<?php echo $emails_per_day; ?> " /> <?php _e('Emails Per Day', 'sendpress'); ?> <br><br> <input type="text" size="6" name="emails-per-hour" value="<?php echo $emails_per_hour; ?> " /> <?php _e('Emails Per Hour', 'sendpress'); ?> <br><br> <h2><?php _e('Email Encoding', 'sendpress'); ?> </h2> <?php $charset = SendPress_Option::get('email-charset', 'UTF-8'); ?> Charset: <select name="email-charset" id=""> <?php $charsete = SendPress_Data::get_charset_types(); foreach ($charsete as $type) { $select = ""; if ($type == $charset) { $select = " selected "; } echo "<option {$select} value={$type}>{$type}</option>"; } ?> </select><br> <?php _e('Squares or weird characters displaying in your emails select the charset for your language', 'sendpress'); ?> . <br><br> <?php _e('Encoding', 'sendpress'); ?> : <select name="email-encoding" id=""> <?php $charset = SendPress_Option::get('email-encoding', '8bit'); $charsete = SendPress_Data::get_encoding_types(); foreach ($charsete as $type) { $select = ""; if ($type == $charset) { $select = " selected "; } echo "<option {$select} value={$type}>{$type}</option>"; } ?> </select> <br class="clear"> </div> </div> </div> </div> <?php //Page Nonce //wp_nonce_field( basename(__FILE__) ,'_spnonce' ); wp_nonce_field($this->_nonce_value); ?> <input type="submit" class="btn btn-primary" value="Save"/> <a href="" class="btn btn-default"><i class="icon-remove"></i> <?php _e('Cancel', 'sendpress'); ?> </a> </form> <form method="post" id="post-test" class="form-inline"> <input type="hidden" name="action" value="send-test-email" /> <input name="testemail" type="hidden" id="test-email-form" value="<?php echo SendPress_Option::get('testemail'); ?> " class="form-control"/> <br class="clear"> <?php //Page Nonce //wp_nonce_field( basename(__FILE__) ,'_spnonce' ); //SendPress General Nonce wp_nonce_field($this->_nonce_value); ?> </form> <?php $error = SendPress_Option::get('phpmailer_error'); $hide = 'hide'; if (!empty($error) && isset($_POST['testemail'])) { $hide = ''; $phpmailer_error = '<pre>' . $error . '</pre>'; ?> <script type="text/javascript"> jQuery(document).ready(function($) { $('#debugModal').modal('show'); }); </script> <?php } ?> <div class="modal fade" id="debugModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h3><?php _e('SMTP Debug Info', 'sendpress'); ?> </h3> </div> <div class="modal-body"> <?php if (!empty($phpmailer_error)) { $server = "smtp.sendgrid.net"; $port = "25"; $port2 = "465"; $port3 = "587"; $timeout = "1"; if ($server and $port and $timeout) { $port25 = @fsockopen("{$server}", $port, $errno, $errstr, $timeout); $port465 = @fsockopen("{$server}", $port2, $errno, $errstr, $timeout); $port587 = @fsockopen("{$server}", $port3, $errno, $errstr, $timeout); } if (!$port25) { echo '<div class="alert alert-error">'; _e('Port 25 seems to be blocked.', 'sendpress'); echo '</div>'; } if (!$port465) { echo '<div class="alert alert-error">'; _e('Port 465 seems to be blocked. Gmail may have trouble', 'sendpress'); echo '</div>'; } if (!$port587) { echo '<div class="alert alert-error">'; _e('Port 587 seems to be blocked.', 'sendpress'); echo '</div>'; } echo $phpmailer_error; } ?> <pre> <?php $whoops = SendPress_Option::get('last_test_debug'); if (empty($whoops)) { _e('No Debug info saved.', 'sendpress'); } else { echo $whoops; } ?> </pre> </div> <div class="modal-footer"> <a href="#" class="btn" data-dismiss="modal"><?php _e('Close', 'sendpress'); ?> </a> </div> </div> </div></div> <?php }
function html($sp) { global $sendpress_sender_factory; $senders = $sendpress_sender_factory->get_all_senders(); ksort($senders); $method = SendPress_Option::get('sendmethod'); $fe = __('From Email', 'sendpress'); $fn = __('From Name', 'sendpress'); ?> <!-- <div style="float:right;" > <a href="" class="btn btn-large btn-default" ><i class="icon-remove"></i> <?php _e('Cancel', 'sendpress'); ?> </a> <a href="#" id="save-update" class="btn btn-primary btn-large"><i class="icon-white icon-ok"></i> <?php _e('Save', 'sendpress'); ?> </a> </div> --> <form method="post" id="post"> <br class="clear"> <br class="clear"> <div class="sp-row"> <div class="sp-50 sp-first"> <?php $this->panel_start('<span class="glyphicon glyphicon-user"></span> ' . __('Sending Email', 'sendpress')); ?> <div class="form-group"> <label for="fromname"><?php _e('From Name', 'sendpress'); ?> </label> <input name="fromname" tabindex=1 type="text" id="fromname" value="<?php echo SendPress_Option::get('fromname'); ?> " class="form-control"> </div> <div class="form-group"> <label for="fromemail"><?php _e('From Email', 'sendpress'); ?> </label> <input name="fromemail" tabindex=2 type="text" id="fromemail" value="<?php echo SendPress_Option::get('fromemail'); ?> " class="form-control"> </div> <?php $this->panel_end(); ?> </div > <div class="sp-50"> <?php $this->panel_start('<span class="glyphicon glyphicon-inbox"></span> ' . __('Test Email', 'sendpress')); ?> <div class="form-group"> <label for="testemail"><?php _e('Where to send Test Email', 'sendpress'); ?> </label> <input name="testemail" type="text" id="test-email-main" value="<?php echo SendPress_Option::get('testemail'); ?> " class="form-control"/> </div> <div class="sp-row"> <div class="sp-50 sp-first"> <button class="btn btn-primary btn-block" value="test" name="test" type="submit"><?php _e('Send Test!', 'sendpress'); ?> </button> </div> <div class="sp-50"> <button class="btn btn-danger btn-block" data-toggle="modal" data-target="#debugModal" type="button"><?php _e('Debug Info', 'sendpress'); ?> </button> </div> </div> <div class="sp-row"> <br> <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne"> <?php _e('Click to View Last Error', 'sendpress'); ?> </a> </h4> </div> <div id="collapseOne" class="panel-collapse collapse"> <div class="panel-body"> <?php $logs = SPNL()->log->get_connected_logs(array('posts_per_page' => 1, 'log_type' => 'sending')); if (!empty($logs)) { foreach ($logs as $log) { echo "<strong>" . $log->post_date . "</strong> " . $log->post_title; echo "<br>" . $log->post_content; } } ?> </div> </div> </div> </div> </div> <?php $this->panel_end(); ?> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php _e('Sending Account Setup', 'sendpress'); ?> </h3> </div> <div class="panel-body"> <input type="hidden" name="action" value="account-setup" /> <?php if (count($senders) < 3) { $c = 0; foreach ($senders as $key => $sender) { $class = ''; if ($c >= 1) { $class = "margin-left: 4%"; } echo "<div style=' float:left; width: 48%; {$class}' id='{$key}'>"; ?> <p> <input name="sendpress-sender" type="radio" <?php if ($method == $key || strpos(strtolower($key), $method) > 0) { ?> checked="checked"<?php } ?> id="website" value="<?php echo $key; ?> " /> <?php _e('Send Emails via', 'sendpress'); ?> <?php echo $sender->label(); echo "</p><div class='well'>"; echo $sender->settings(); echo "</div></div>"; $c++; } } else { ?> <div class="tabbable tabs-left"> <ul class="nav nav-tabs"> <?php foreach ($senders as $key => $sender) { $class = ''; if ($method == $key || strpos(strtolower($key), $method) > 0) { $class = "class='active'"; } echo "<li {$class}><a href='#{$key}' data-toggle='tab'>"; if ($method == $key || strpos(strtolower($key), $method) > 0) { echo '<span class="glyphicon glyphicon-ok-sign"></span> '; } echo $sender->label(); echo "</a></li>"; } ?> </ul> <div class="tab-content" style="display:block;"> <?php foreach ($senders as $key => $sender) { $class = ''; if ($method == $key || strpos(strtolower($key), $method) > 0) { $class = "active"; } echo "<div class='tab-pane {$class}' id='{$key}'>"; ?> <p> <input name="sendpress-sender" type="radio" <?php if ($method == $key || strpos(strtolower($key), $method) > 0) { ?> checked="checked"<?php } ?> id="website" value="<?php echo $key; ?> " /> <?php _e('Activate', 'sendpress'); ?> <?php echo $sender->label(); echo "</p><div class='well'>"; echo $sender->settings(); echo "</div></div>"; } ?> </div> </div> <p > <span class="glyphicon glyphicon-ok-sign"></span> = <?php _e('Currently Active', 'sendpress'); ?> </p> <?php } ?> </div> </div> <br class="clear"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php _e('Advanced Sending Options', 'sendpress'); ?> </h3> </div> <div class="panel-body"> <div class="boxer form-box"> <div style="float: right; width: 45%;"> <h2><?php _e('Email Sending Limits', 'sendpress'); ?> </h2> <?php $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"); $offset = get_option('gmt_offset') * 60 * 60; // Time offset in seconds $local_timestamp = wp_next_scheduled('sendpress_cron_action') + $offset; //print_r(wp_get_schedules()); printf(__('You have sent <strong>%d</strong> emails so far today.', 'sendpress'), $emails_so_far); ?> .<br><br> <input type="text" size="6" name="emails-per-day" value="<?php echo $emails_per_day; ?> " /> <?php _e('Emails Per Day', 'sendpress'); ?> <br><br> <input type="text" size="6" name="emails-per-hour" value="<?php echo $emails_per_hour; ?> " /> <?php _e('Emails Per Hour', 'sendpress'); ?> <br><br> <h2><?php _e('Email Encoding', 'sendpress'); ?> </h2> <?php $charset = SendPress_Option::get('email-charset', 'UTF-8'); ?> Charset: <select name="email-charset" id=""> <?php $charsete = SendPress_Data::get_charset_types(); foreach ($charsete as $type) { $select = ""; if ($type == $charset) { $select = " selected "; } echo "<option {$select} value={$type}>{$type}</option>"; } ?> </select><br> <?php _e('Squares or weird characters displaying in your emails select the charset for your language', 'sendpress'); ?> . <br><br> <?php _e('Encoding', 'sendpress'); ?> : <select name="email-encoding" id=""> <?php $charset = SendPress_Option::get('email-encoding', '8bit'); $charsete = SendPress_Data::get_encoding_types(); foreach ($charsete as $type) { $select = ""; if ($type == $charset) { $select = " selected "; } echo "<option {$select} value={$type}>{$type}</option>"; } ?> </select><br> <?php _e('Older versions of SendPress used', 'sendpress'); ?> "quoted-printable" <br><br><br> <h2><?php _e('AutoCron Information', 'sendpress'); ?> </h2> <?php $api_info = json_decode(SendPress_Cron::get_info()); $autocron = SendPress_Option::get('autocron', 'no'); if ($autocron == 'yes') { ?> <ul> <li>Last Check: <?php echo $api_info->lastcheck; ?> UTC</li> <li>Errors: <?php echo $api_info->errors; ?> </li> <li>Active: <?php if ($api_info->active == 0) { echo "false"; } else { echo "true"; } ?> </li> </ul> <?php } else { ?> <p>AutoCron is not enabled.</p> <?php } ?> <br class="clear"> </div> <div style="width: 45%; margin-right: 10%"> <?php $tl = SendPress_Option::get('autocron', 'no'); ?> <h2><?php _e('SendPress Pro Auto Cron', 'sendpress'); ?> </h2> <p>At least once every hour we visit your site, just like a "cron" job.<br>There's no setup involved. Easy and hassle free.</p> <button id="sp-enable-cron" <?php if ($tl == 'yes') { echo "style='display:none;'"; } ?> class="btn btn-success">Enable Pro Auto Cron</button><button id="sp-disable-cron" <?php if ($tl == 'no') { echo "style='display:none;'"; } ?> class="btn btn-danger">Disable Pro Auto Cron</button> <br><br> <strong>Enable AutoCron and receive a 20% discount code for SendPress Pro. Your discount code will be emailed to you.</strong> <br><br> <p class="well"> <strong>Without SendPress Pro</strong><br> Auto Cron is limited to a max of <strong>3,000*</strong> emails per day at a max rate of <strong>125*</strong> emails per hour. <br><br> <strong>With SendPress Pro</strong><br> Auto Cron starts at a max of <strong>12,000*</strong> emails per day at a max rate of <strong>500*</strong> emails per hour. Sending of up to <strong>36,000*</strong> emails a day available provided your server can handle it. <br><br><br> <strong>*</strong>Auto Cron will not send faster then your <strong>Email Sending Limits</strong> to the right.<br><br>Please make sure you follow the rules of your hosting provider or upgrade to <strong><a href="http://sendpress.com">SendPress Pro</a></strong> to use a third-party service. </p> <small>Pro Auto Cron does collect some data about your website and usage of SendPress. It will not track any user details, so your security and privacy are safe with us.</small> <!-- WordPress Cron: Next run @ <?php echo date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $local_timestamp); ?> <br><br>--> <br class="clear"> </div> </div> </div> </div> <?php //Page Nonce //wp_nonce_field( basename(__FILE__) ,'_spnonce' ); wp_nonce_field($sp->_nonce_value); ?> <input type="submit" class="btn btn-primary" value="Save"/> <a href="" class="btn btn-default"><i class="icon-remove"></i> <?php _e('Cancel', 'sendpress'); ?> </a> </form> <form method="post" id="post-test" class="form-inline"> <input type="hidden" name="action" value="send-test-email" /> <input name="testemail" type="hidden" id="test-email-form" value="<?php echo SendPress_Option::get('testemail'); ?> " class="form-control"/> <br class="clear"> <?php //Page Nonce //wp_nonce_field( basename(__FILE__) ,'_spnonce' ); //SendPress General Nonce wp_nonce_field($sp->_nonce_value); ?> </form> <?php $error = SendPress_Option::get('phpmailer_error'); $hide = 'hide'; if (!empty($error)) { $hide = ''; $phpmailer_error = '<pre>' . $error . '</pre>'; ?> <script type="text/javascript"> jQuery(document).ready(function($) { $('#debugModal').modal('show'); }); </script> <?php } ?> <div class="modal fade" id="debugModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h3><?php _e('SMTP Debug Info', 'sendpress'); ?> </h3> </div> <div class="modal-body"> <?php if (!empty($phpmailer_error)) { $server = "smtp.sendgrid.net"; $port = "25"; $port2 = "465"; $port3 = "587"; $timeout = "1"; if ($server and $port and $timeout) { $port25 = @fsockopen("{$server}", $port, $errno, $errstr, $timeout); $port465 = @fsockopen("{$server}", $port2, $errno, $errstr, $timeout); $port587 = @fsockopen("{$server}", $port3, $errno, $errstr, $timeout); } if (!$port25) { echo '<div class="alert alert-error">'; _e('Port 25 seems to be blocked.', 'sendpress'); echo '</div>'; } if (!$port465) { echo '<div class="alert alert-error">'; _e('Port 465 seems to be blocked. Gmail may have trouble', 'sendpress'); echo '</div>'; } if (!$port587) { echo '<div class="alert alert-error">'; _e('Port 587 seems to be blocked.', 'sendpress'); echo '</div>'; } echo $phpmailer_error; } ?> <pre> <?php $whoops = SendPress_Option::get('last_test_debug'); if (empty($whoops)) { _e('No Debug info saved.', 'sendpress'); } else { echo $whoops; } ?> </pre> </div> <div class="modal-footer"> <a href="#" class="btn" data-dismiss="modal"><?php _e('Close', 'sendpress'); ?> </a> </div> </div> </div></div> <?php }
function html($sp) { SendPress_Tracking::event('Queue Tab'); if (isset($_GET['cron'])) { $sp->fetch_mail_from_queue(); } //Create an instance of our package class... $testListTable = new SendPress_Queue_Table(); //Fetch, prepare, sort, and filter our data... $testListTable->prepare_items(); SendPress_Option::set('no_cron_send', 'false'); //$sp->fetch_mail_from_queue(); $sp->cron_start(); //echo $sp->get_key(). "<br>"; $open_info = array("id" => 13, "report" => 10, "view" => "open"); /* $x = $sp->encrypt_data($open_info); echo $x."<br>"; $x = $sp->decrypt_data($x); print_r($x); echo "<br>"; $d = $_GET['t']; $x = $sp->decrypt_data($d); print_r($x->id); echo "<br>"; //echo wp_get_schedule('sendpress_cron_action_run'); // $time_delay = SendPress_Option::get('time-delay'); echo $time_delay; echo date('l jS \of F Y H:i:s A',$time_delay ); echo "<br>"; $time = date('H:i:s'); echo $time;//11:09 $time = date('H:i:s', $time_delay); echo $time;//11:09 */ $autocron = SendPress_Option::get('autocron', 'no'); if ($autocron == 'yes') { $api_info = json_decode(SendPress_Cron::get_info()); if (isset($api_info->active) && $api_info->active === 0) { echo "<p class='alert alert-danger'><strong>Oh no!</strong> It looks like AutoCron disconnected itself. To get max send speed please re-enable it <a href='" . SendPress_Admin::link('Settings_Account') . "'>here</a>.</p>"; delete_transient('sendpress_autocron_cache'); SendPress_Option::set('autocron', 'no'); } else { if (isset($api_info->lastcheck)) { echo "<p class='alert alert-success'><strong>Looking good!</strong> Autocron is running and last checked your site at: " . $api_info->lastcheck . " UTC</p>"; } } } else { echo "<p class='alert alert-info'><strong>Howdy.</strong> It looks like AutoCron was not enabled or it disconnected itself. To get max send speed please re-enable it <a href='" . SendPress_Admin::link('Settings_Account') . "'>here</a>.</p>"; } ?> <br> <div id="taskbar" class="lists-dashboard rounded group"> <div id="button-area"> <?php $pause_sending = SendPress_Option::get('pause-sending', 'no'); $txt = __('Pause Sending', 'sendpress'); //Stop Sending for now if ($pause_sending == 'yes') { $txt = __('Resume Sending', 'sendpress'); } ?> <div class="btn-group"> <a class="btn btn-large btn-default " href="<?php echo SendPress_Admin::link('Queue'); ?> &action=pause-queue" ><i class="icon-repeat icon-white "></i> <?php echo $txt; ?> </a> <a id="send-now" class="btn btn-primary btn-large " data-toggle="modal" href="#sendpress-sending" ><i class="icon-white icon-refresh"></i> <?php _e('Send Emails Now', 'sendpress'); ?> </a> </div> </div> <?php $emails_per_day = SendPress_Option::get('emails-per-day'); if ($emails_per_day == 0) { $emails_per_day = __('Unlimited', 'sendpress'); } $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"); //print_r(SendPress_Data::emails_stuck_in_queue()); ?> <h2><strong><?php echo $emails_so_far; ?> </strong> <?php _e('of a possible', 'sendpress'); ?> <strong><?php echo $emails_per_day; ?> </strong> <?php _e('emails sent in the last 24 hours', 'sendpress'); ?> .</h2> <h2><strong><?php echo $hourly_emails; ?> </strong> <?php _e('of a possible', 'sendpress'); ?> <strong><?php echo $emails_per_hour; ?> </strong> <?php _e('emails sent in the last hour', 'sendpress'); ?> .</h2> <small><?php _e('You can adjust these settings here', 'sendpress'); ?> : <a href="<?php echo SendPress_Admin::link('Settings_Account'); ?> "><?php _e('Settings', 'sendpress'); ?> > <?php _e('Sending Account', 'sendpress'); ?> </a>.</small> <?php if ($autocron == 'no') { $offset = get_option('gmt_offset') * 60 * 60; // Time offset in seconds $local_timestamp = wp_next_scheduled('sendpress_cron_action') + $offset; ?> <br><small><?php _e('The cron will run again around', 'sendpress'); ?> : <?php echo date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $local_timestamp); ?> </small> <?php } ?> <br><br> </div> <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions --> <form id="email-filter" action="<?php echo SendPress_Admin::link('Queue'); ?> " method="get"> <!-- For plugins, we also need to ensure that the form posts back to our current page --> <input type="hidden" name="page" value="<?php echo SPNL()->validate->page($_REQUEST['page']); ?> " /> <!-- Now we can render the completed list table --> <?php $testListTable->display(); ?> <?php wp_nonce_field($sp->_nonce_value); ?> </form> <br> <!-- <a class="btn btn-large btn-success " href="<?php echo SendPress_Admin::link('Queue'); ?> &action=reset-queue" ><i class="icon-repeat icon-white "></i> <?php _e('Re-queue All Emails', 'sendpress'); ?> </a><br><br> --> <form method='get'> <input type='hidden' value="<?php echo SPNL()->validate->page($_GET['page']); ?> " name="page" /> <input type='hidden' value="empty-queue" name="action" /> <a class="btn btn-large btn-danger" data-toggle="modal" href="#sendpress-empty-queue" ><i class="icon-warning-sign "></i> <?php _e('Delete All Emails in the Queue', 'sendpress'); ?> </a> <?php wp_nonce_field($sp->_nonce_value); ?> </form> <div class="modal fade" id="sendpress-empty-queue" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h3><?php _e('Really? Delete All Emails in the Queue.', 'sendpress'); ?> </h3> </div> <div class="modal-body"> <p><?php _e('This will remove all emails from the queue without attempting to send them', 'sendpress'); ?> .</p> </div> <div class="modal-footer"> <a href="#" class="btn btn-primary" data-dismiss="modal"><?php _e('No! I was Joking', 'sendpress'); ?> </a><a href="<?php echo SendPress_Admin::link('Queue'); ?> &action=empty-queue" id="confirm-delete" class="btn btn-danger" ><?php _e('Yes! Delete All Emails', 'sendpress'); ?> </a> </div> </div></div> </div> <div class="modal fade" id="sendpress-sending" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h3><?php _e('Sending Emails', 'sendpress'); ?> </h3> </div> <div class="modal-body"> <div id="sendbar" class="progress progress-striped active"> <div id="sendbar-inner" class="progress-bar" style="width: 40%;"></div> </div> <span id="queue-sent">-</span> <?php _e('of', 'sendpress'); ?> <span id="queue-total">-</span> <?php _e('emails left to send', 'sendpress'); ?> .<br> <br> <?php _e('You are also limited to', 'sendpress'); ?> <?php echo $hour; ?> <?php _e('emails per hour', 'sendpress'); ?> .<br> <?php _e('To change these settings go to', 'sendpress'); ?> <a href="<?php echo SendPress_Admin::link('Settings_Account'); ?> "> <?php _e('Settings', 'sendpress'); ?> > <?php _e('Sending Account', 'sendpress'); ?> </a>. </div> <div class="modal-footer"> <?php _e('If you close this window sending will stop. ', 'sendpress'); ?> <a href="#" class="btn btn-primary" data-dismiss="modal"><?php _e('Close', 'sendpress'); ?> </a> </div> </div> </div></div> <?php }
function send_email($to, $subject, $html, $text, $istest = false, $sid, $list_id, $report_id) { $phpmailer = new SendPress_PHPMailer(); /* * Make sure the mailer thingy is clean before we start, should not * be necessary, but who knows what others are doing to our mailer */ $phpmailer->ClearAddresses(); $phpmailer->ClearAllRecipients(); $phpmailer->ClearAttachments(); $phpmailer->ClearBCCs(); $phpmailer->ClearCCs(); $phpmailer->ClearCustomHeaders(); $phpmailer->ClearReplyTos(); $charset = SendPress_Option::get('email-charset', 'UTF-8'); $encoding = SendPress_Option::get('email-encoding', '8bit'); $phpmailer->CharSet = $charset; $phpmailer->Encoding = $encoding; if ($charset != 'UTF-8') { $html = $this->change($html, 'UTF-8', $charset); $text = $this->change($text, 'UTF-8', $charset); $subject = $this->change($subject, 'UTF-8', $charset); } $from_email = SendPress_Option::get('fromemail'); $phpmailer->From = $from_email; $phpmailer->FromName = SendPress_Option::get('fromname'); //$subject = str_replace(array('’','“','�','–'),array("'",'"','"','-'),$subject); //$html = str_replace(chr(194),chr(32),$html); //$text = str_replace(chr(194),chr(32),$text); //return $email; $phpmailer->AddAddress(trim($to)); $phpmailer->AltBody = $text; $phpmailer->Subject = $subject; $content_type = 'text/html'; $phpmailer->MsgHTML($html); $phpmailer->ContentType = $content_type; // Set whether it's plaintext, depending on $content_type //if ( 'text/html' == $content_type ) $phpmailer->IsHTML(true); $hosting = SendPress_Option::get('website-hosting-provider'); if ($hosting == 'godaddy') { // We are sending SMTP mail $phpmailer->IsSMTP(); // Set the other options $phpmailer->Host = 'relay-hosting.secureserver.net'; } // If we don't have a charset from the input headers //if ( !isset( $charset ) ) //$charset = get_bloginfo( 'charset' ); // Set the content-type and charset /** * We'll let php init mess with the message body and headers. But then * we stomp all over it. Sorry, my plug-inis more important than yours :) */ do_action_ref_array('phpmailer_init', array(&$phpmailer)); //$phpmailer->Sender = '*****@*****.**';//SendPress_Option::get('fromemail'); $hdr = new SendPress_SendGrid_SMTP_API(); $hdr->addFilterSetting('dkim', 'domain', SendPress_Manager::get_domain_from_email($from_email)); //$phpmailer->AddCustomHeader( sprintf( 'X-SP-MID: %s',$email->messageID ) ); $phpmailer->AddCustomHeader(sprintf('X-SMTPAPI: %s', $hdr->asJSON())); $phpmailer->AddCustomHeader('X-SP-METHOD: website'); // Set SMTPDebug to 2 will collect dialogue between us and the mail server $phpmailer->AddCustomHeader('X-SP-LIST: ' . $list_id); $phpmailer->AddCustomHeader('X-SP-REPORT: ' . $report_id); $phpmailer->AddCustomHeader('X-SP-SUBSCRIBER: ' . $sid); if ($istest == true) { $phpmailer->SMTPDebug = 2; // Start output buffering to grab smtp output ob_start(); } // Send! $result = true; // start with true, meaning no error $result = @$phpmailer->Send(); //$phpmailer->SMTPClose(); if ($istest == true) { // Grab the smtp debugging output $smtp_debug = ob_get_clean(); SendPress_Option::set('phpmailer_error', $phpmailer->ErrorInfo); SendPress_Option::set('last_test_debug', $smtp_debug); //$this->last_send_smtp_debug = $smtp_debug; } if ($result != true) { $log_message = 'Website <br>'; $log_message .= $to . "<br>"; if ($istest == true) { $log_message .= "<br><br>"; $log_message .= $smtp_debug; } //$phpmailer->ErrorInfo SPNL()->log->add($phpmailer->ErrorInfo, $log_message, 0, 'sending'); } if ($result != true && $istest == true) { $hostmsg = 'host: ' . $phpmailer->Host . ' port: ' . $phpmailer->Port . ' secure: ' . $phpmailer->SMTPSecure . ' auth: ' . $phpmailer->SMTPAuth . ' user: '******''; $msg .= __('The result was: ', 'sendpress') . $result . "\n"; $msg .= __('The mailer error info: ', 'sendpress') . $phpmailer->ErrorInfo . "\n"; $msg .= $hostmsg; $msg .= __("The SMTP debugging output is shown below:\n", "sendpress"); $msg .= $smtp_debug . "\n"; //$msg .= 'The full debugging output(exported mailer) is shown below:\n'; //$msg .= var_export($phpmailer,true)."\n"; //$this->append_log($msg); } return $result; }
function help_debug() { global $wp_version, $wpdb; $browser = new SendPress_Browser(); echo "<b>WordPress Version</b>: " . $wp_version . "<br>"; echo "<b>SendPress Version</b>: " . SENDPRESS_VERSION . "<br>"; if (defined('SENDPRESS_PRO_VERSION')) { echo "<b>SendPress Pro Version</b>: " . SENDPRESS_VERSION . "<br>"; } echo '<b>PHP Version</b>: ' . phpversion() . '<br>'; $mem = (int) ini_get('memory_limit'); $used = function_exists('memory_get_usage') ? round(memory_get_usage() / 1024 / 1024, 2) : 0; if (!empty($mem) && !empty($used)) { $prec = round($used / $mem * 100, 0); } echo '<b>PHP Memory Limit</b>: ' . $mem . __(' MByte') . '<br>'; echo '<b>PHP Memory Used</b>: ' . $used . __(' MByte') . '<br>'; echo '<b>MySQL Version</b>: ' . $wpdb->db_version() . '<br><br>'; echo '<b>Send Setup</b>: ' . SendPress_Option::get('sendmethod') . '<br><br>'; SendPress_DB_Tables::check_setup(); /* echo "<b>Ports:</b><br>"; $server = "smtp.sendgrid.net"; $port = "25"; $port2 = "465"; $port3 = "587"; $timeout = "1"; if ($server and $port and $timeout) { $port25 = @fsockopen("$server", $port, $errno, $errstr, $timeout); $port465 = @fsockopen("$server", $port2, $errno, $errstr, $timeout); $port587 = @fsockopen("$server", $port3, $errno, $errstr, $timeout); } echo "Port 25: "; if(!$port25){ _e('blocked','sendpress'); } else { _e('open','sendpress'); } echo "<br>Port 465: "; if(!$port465){ _e('blocked','sendpress'); } else { _e('open','sendpress'); } echo "<br>Port 587: "; if(!$port587){ _e('blocked','sendpress'); } else { _e('open','sendpress'); } */ ?> <br><br> <b>Support Info:</b> <textarea readonly="readonly" class="sendpress-sysinfo" name="sendpress-sysinfo" title="<?php _e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'sendpress'); ?> "><?php echo esc_html($this->display()); ?> </textarea> <?php }
static 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') { //* Use cache static $cron_bg_run = null; static $cron_bg_run_weekly = null; $time_start = microtime(true); $count = SendPress_Data::emails_in_queue(); $bg = 0; $bg_weekly = 0; $error = ''; try { if ($count > 0) { SendPress_Queue::send_mail(); $count = SendPress_Data::emails_in_queue(); } else { //* If cache is empty, pull transient if (!$cron_bg_run) { $cron_bg_run = get_transient('spnl-background-daily'); } //* If transient has expired, do a fresh update check if (!$cron_bg_run) { //* If cache is empty, pull transient if (!$cron_bg_run_weekly) { $cron_bg_run_weekly = get_transient('spnl-background-weekly'); } //* If transient has expired, do a fresh update check if (!$cron_bg_run_weekly) { SPNL()->log->prune_logs(); SendPress_Data::clean_queue_table(); SendPress_DB_Tables::repair_tables(); $cron_bg_run_weekly = array('runtime' => date("F j, Y, g:i a")); set_transient('spnl-background-weekly', $cron_bg_run_weekly, 60 * 60 * 24 * 7); $bg_weekly = 1; } //SendPress_Logging::prune_logs(); $bg = 1; $cron_bg_run = array('runtime' => date("F j, Y, g:i a")); set_transient('spnl-background-daily', $cron_bg_run, 60 * 60 * 24); } } } catch (Exception $e) { $error = $e->getMessage(); SPNL()->log->add('Autocron', $error, 0, 'error'); } $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("error" => $error, "background" => $bg, "weekly" => $bg_weekly, "queue" => $count, "stuck" => $stuck, "version" => SENDPRESS_VERSION, "pro" => $pro, "limit" => $limit, 'info' => $limits, 'time' => number_format($time, 3))); die; } } }
function html($sp) { ?> <?php if (SendPress_Option::get('import_error', false) == true) { ?> <div class="alert alert-danger"> <?php _e('We had a problem saving your upload', 'sendpress'); ?> . </div> <?php } ?> <div id="taskbar" class="lists-dashboard rounded group"> <h2><?php _e('Import CSV to ', 'sendpress'); echo get_the_title($_GET['listID']); ?> </h2> </div> <div class="boxer"> <div class="boxer-inner"> <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions --> <form method="post" enctype="multipart/form-data" accept-charset="utf-8" > <!-- For plugins, we also need to ensure that the form posts back to our current page --> <input type="hidden" name="listID" value="<?php echo SPNL()->validate->int($_GET['listID']); ?> " /> <table> <tr> <td class="left_label"> <?php echo $label; ?> </td> <td> <input type="file" name="uploadfiles[]" id="uploadfiles" size="35" class="uploadfiles" /> <input class="button-primary" type="submit" name="uploadfile" id="uploadfile_btn" value="Upload" /> </td> </tr> </table> <?php SendPress_Option::set('import_error', false); SendPress_Data::nonce_field(); ?> </form> </div> </div> <?php }
function html($sp) { $key_active = false; if (get_transient('sendpress_key_state') === 'valid') { $key_active = true; } // SendPress_Helper::log('API Key = '.SendPress_Option::get('api_key')); // SendPress_Helper::log('API State = '.get_transient( 'sendpress_key_state' )); $key = SendPress_Option::get('api_key'); if (empty($key) || $key == '') { $key_active = false; delete_transient('sendpress_key_state'); } ?> <h4><?php _e('SendPress API Key', 'sendpress'); ?> </h4> <form method="post" id="post"> <?php if ($key_active) { echo '<span class="icon-ok-sign"></span>'; } ?> <input <?php if ($key_active) { echo 'disabled'; } ?> name="api_key" type="text" id="api_key" value="<?php echo SendPress_Option::get('api_key'); ?> " class="regular-text sp-text"> <?php if (!$key_active) { ?> <a href="#" class="save-api-key btn-success btn"><?php _e('Register Key', 'sendpress'); ?> </a> <?php } else { ?> <a href="#" class="save-api-key btn-danger btn"><?php _e('Deactivate Key', 'sendpress'); ?> </a> <?php } ?> <div class="description"> <?php echo sprintf(__('Enter your API key to enable premium support and automatic updates. Get your API key by logging into <a href="%s">SendPress.com</a>.', 'sendpress'), 'http://sendpress.com'); ?> </div> <input class="action " type="hidden" name="action" value="<?php if ($key_active) { echo 'module-deactivate-api-key'; } else { echo 'module-save-api-key'; } ?> " /> <?php wp_nonce_field($sp->_nonce_value); ?> </form> <?php }
function sub_menu($sp = false) { ?> <div class="navbar navbar-default" > <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only"><?php _e('Toggle navigation', 'sendpress'); ?> </span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#"><?php _e('Emails', 'sendpress'); ?> </a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li <?php if (!isset($_GET['view']) || isset($_GET['view']) && $_GET['view'] === 'style' || isset($_GET['view']) && $_GET['view'] === 'create' || isset($_GET['view']) && $_GET['view'] === 'send' || isset($_GET['view']) && $_GET['view'] === 'send-confirm' || isset($_GET['view']) && $_GET['view'] === 'send-queue') { ?> class="active"<?php } ?> > <a href="<?php echo SendPress_Admin::link('Emails'); ?> "><?php _e('Newsletters', 'sendpress'); ?> </a> </li> <?php if (false == true) { //if(SendPress_Option::get('prerelease_templates') == 'yes') { ?> <li <?php if (isset($_GET['view']) && $_GET['view'] === 'all') { ?> class="active"<?php } ?> > <a href="<?php echo SendPress_Admin::link('Emails_Auto'); ?> "><?php _e('Autoresponders', 'sendpress'); ?> </a> </li> <!-- --> <?php } ?> <li <?php if (isset($_GET['view']) && ($_GET['view'] === 'temp' || $_GET['view'] === 'tempstyle')) { ?> class="active"<?php } ?> > <a href="<?php echo SendPress_Admin::link('Emails_Temp'); ?> "><?php _e('Templates', 'sendpress'); ?> </a> </li> <li <?php if (isset($_GET['view']) && ($_GET['view'] === 'templates' || $_GET['view'] === 'tempedit')) { ?> class="active"<?php } ?> > <a href="<?php echo SendPress_Admin::link('Emails_Templates'); ?> "><?php _e('Custom Templates', 'sendpress'); ?> </a> </li> <?php //} ?> <li <?php if (isset($_GET['view']) && $_GET['view'] === 'social') { ?> class="active"<?php } ?> > <a href="<?php echo SendPress_Admin::link('Emails_Social'); ?> "><?php _e('Social Icons', 'sendpress'); ?> </a> </li> <li <?php if (isset($_GET['view']) && in_array($_GET['view'], array('postnotifications'))) { ?> class="active"<?php } ?> > <a href="<?php echo SendPress_Admin::link('Emails_Postnotifications'); ?> "><?php _e('Post Notifications', 'sendpress'); ?> </a> </li> <?php if (SendPress_Option::get('beta')) { ?> <li <?php if (isset($_GET['view']) && in_array($_GET['view'], array('autoresponder', 'autoedit'))) { ?> class="active"<?php } ?> > <a href="<?php echo SendPress_Admin::link('Emails_Autoresponder'); ?> "><?php _e('Automation', 'sendpress'); ?> </a> </li> <?php } ?> <li <?php if (strpos($sp->_current_view, 'systememail') !== false) { ?> class="active"<?php } ?> ><a <?php if (strpos($sp->_current_view, 'systememail') !== false) { ?> class="wp-ui-primary"<?php } ?> href="<?php echo SendPress_Admin::link('Emails_Systememail'); ?> "><i class=" icon-bullhorn"></i> <?php _e('System Email', 'sendpress'); ?> </a></li> </ul> </div> </div> <?php }
$my_post['post_title'] = $_POST['post_title']; */ $my_post['post_status'] = 'publish'; // Update the post into the database wp_update_post($my_post); update_post_meta($my_post['ID'], '_sendpress_subject', $_POST['post_subject']); update_post_meta($my_post['ID'], '_sendpress_template', $_POST['template']); update_post_meta($my_post['ID'], '_sendpress_status', 'private'); SendPress_Email::set_default_style($my_post['ID']); //clear the cached file. delete_transient('sendpress_email_html_' . $my_post['ID']); $this->save_redirect($_POST); break; case 'temaplte-widget-settings': $widget_options = array(); $widget_options['widget_options']['load_css'] = 0; $widget_options['widget_options']['load_ajax'] = 0; $widget_options['widget_options']['load_scripts_in_footer'] = 0; if (isset($_POST['load_css'])) { $widget_options['widget_options']['load_css'] = $_POST['load_css']; } if (isset($_POST['load_ajax'])) { $widget_options['widget_options']['load_ajax'] = $_POST['load_ajax']; } if (isset($_POST['load_scripts_in_footer'])) { $widget_options['widget_options']['load_scripts_in_footer'] = $_POST['load_scripts_in_footer']; } SendPress_Option::set($widget_options); wp_redirect(esc_url_raw(admin_url('admin.php?page=sp-settings&view=widget'))); break; }
function html($sp) { global $is_IE; global $post_ID, $post; /* if ( wp_is_mobile() && ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) ) { wp_enqueue_script('editor-expand'); $_wp_autoresize_on = true; } */ $view = isset($_GET['view']) ? $_GET['view'] : ''; if (isset($_GET['emailID'])) { $emailID = $_GET['emailID']; $post = get_post($_GET['emailID']); $post_ID = $post->ID; } if ($post->post_type !== 'sp_newsletters') { SendPress_Admin::redirect('Emails'); } $options = SendPress_Option::email_get('autoresponder_' . $post_ID); ?> <form method="post" id="post" role="form"> <input type="hidden" name="post_ID" id="post_ID" value="<?php echo $post->ID; ?> " /> <input type="hidden" name="action" id="action" value="save-email" /> <div > <div style="float:right;" class="btn-toolbar"> <div id="sp-cancel-btn" class="btn-group"> <?php if ($post->post_status != 'sp-autoresponder') { ?> <a href="?page=<?php echo $_GET['page']; ?> " id="cancel-update" class="btn btn-default"><?php echo __('Cancel', 'sendpress'); ?> </a> <?php } else { ?> <a href="<?php echo SendPress_Admin::link('Emails_Autoresponder'); ?> " id="cancel-update" class="btn btn-default"><?php echo __('Cancel', 'sendpress'); ?> </a> <?php } ?> </div> <div class="btn-group"> <button class="btn btn-primary " type="submit" value="save-next" name="submit"><i class="icon-envelope icon-white"></i> <?php echo __('Save', 'sendpress'); ?> </button> </div> </div> </div> <h2>Autoresponder Settings</h2> <br> <h4>Subject: <?php echo esc_attr(htmlspecialchars(get_post_meta($post->ID, '_sendpress_subject', true))); ?> </h4> <div class="sp-row"> <div class="sp-75 sp-first"> <br> <select name="sp-autoresponder-type" id="params-auto" > <option value="subscribe" <?php if ($options['type'] == 'subscribe') { echo "selected"; } ?> >When someone subscribes to the list...</option> <!--<option value="user-new" <?php if ($options['type'] == 'user-new') { echo "selected"; } ?> >When a new WordPress user is added to your site...</option>--> </select> <select name="" id="params-list"> <?php $post_args = array('post_type' => 'sendpress_list', 'numberposts' => -1, 'offset' => 0, 'orderby' => 'post_title', 'order' => 'DESC'); $current_lists = get_posts($post_args); foreach ($current_lists as $list) { $t = ''; $tlist = ''; echo "<option value=" . $list->ID . "> " . $list->post_title . " <small>(" . SendPress_Data::get_count_subscribers($list->ID) . ")</small></option>"; } ?> </select> <input type="text" name="sp-delay" style="width:30px; <?php if ($options['when'] == 'immediate') { echo "display:none;"; } ?> " class="text" id="timer" value="<?php echo $options['delay']; ?> " /> <select name="sp-timing" id="when-to-send" > <option value="immediate" <?php if ($options['when'] == 'immediate') { echo "selected"; } ?> >immediately.</option> <option value="hours" <?php if ($options['when'] == 'hours') { echo "selected"; } ?> >hour(s) after.</option> <option value="days" <?php if ($options['when'] == 'days') { echo "selected"; } ?> >day(s) after.</option> <option value="weeks" <?php if ($options['when'] == 'weeks') { echo "selected"; } ?> >week(s) after.</option> </select> <br><br> </div> <div class="sp-25"> <br><br> </div> </div> <script> (function($){ $(document).ready(function($){ $('#params-auto').change(function(){ var it = $(this); var v = it.val(); }); $('#when-to-send').change(function(){ var it = $(this); var v = it.val(); if(v !== 'immediate'){ $('#timer').show(); } else { $('#timer').hide(); } }); }); }(jQuery)); </script> <?php SendPress_Data::nonce_field(); ?> </form> <?php }
static function old_send_email($to, $subject, $html, $text, $istest = false, $sid, $list_id, $report_id) { global $phpmailer, $wpdb; // (Re)create it, if it's gone missing if (!is_object($phpmailer) || !is_a($phpmailer, 'PHPMailer')) { require_once ABSPATH . WPINC . '/class-phpmailer.php'; require_once ABSPATH . WPINC . '/class-smtp.php'; $phpmailer = new PHPMailer(); } /* * Make sure the mailer thingy is clean before we start, should not * be necessary, but who knows what others are doing to our mailer */ $phpmailer->ClearAddresses(); $phpmailer->ClearAllRecipients(); $phpmailer->ClearAttachments(); $phpmailer->ClearBCCs(); $phpmailer->ClearCCs(); $phpmailer->ClearCustomHeaders(); $phpmailer->ClearReplyTos(); //return $email; // $charset = SendPress_Option::get('email-charset', 'UTF-8'); $encoding = SendPress_Option::get('email-encoding', '8bit'); $phpmailer->CharSet = $charset; $phpmailer->Encoding = $encoding; if ($charset != 'UTF-8') { $sender = new SendPress_Sender(); $html = $sender->change($html, 'UTF-8', $charset); $text = $sender->change($text, 'UTF-8', $charset); $subject = $sender->change($subject, 'UTF-8', $charset); } $subject = str_replace(array('’', '“', '�', '–'), array("'", '"', '"', '-'), $subject); $html = str_replace(chr(194), chr(32), $html); $text = str_replace(chr(194), chr(32), $text); $phpmailer->AddAddress(trim($to)); $phpmailer->AltBody = $text; $phpmailer->Subject = $subject; $phpmailer->MsgHTML($html); $content_type = 'text/html'; $phpmailer->ContentType = $content_type; // Set whether it's plaintext, depending on $content_type //if ( 'text/html' == $content_type ) $phpmailer->IsHTML(true); /** * We'll let php init mess with the message body and headers. But then * we stomp all over it. Sorry, my plug-inis more important than yours :) */ do_action_ref_array('phpmailer_init', array(&$phpmailer)); $from_email = SendPress_Option::get('fromemail'); $phpmailer->From = $from_email; $phpmailer->FromName = SendPress_Option::get('fromname'); $phpmailer->Sender = SendPress_Option::get('fromemail'); $sending_method = SendPress_Option::get('sendmethod'); $phpmailer = apply_filters('sendpress_sending_method_' . $sending_method, $phpmailer); $hdr = new SendPress_SendGrid_SMTP_API(); $hdr->addFilterSetting('dkim', 'domain', SendPress_Manager::get_domain_from_email($from_email)); $phpmailer->AddCustomHeader(sprintf('X-SMTPAPI: %s', $hdr->asJSON())); $phpmailer->AddCustomHeader('X-SP-METHOD: old'); // Set SMTPDebug to 2 will collect dialogue between us and the mail server if ($istest == true) { $phpmailer->SMTPDebug = 2; // Start output buffering to grab smtp output ob_start(); } // Send! $result = true; // start with true, meaning no error $result = @$phpmailer->Send(); //$phpmailer->SMTPClose(); if ($istest == true) { // Grab the smtp debugging output $smtp_debug = ob_get_clean(); SendPress_Option::set('phpmailer_error', $phpmailer->ErrorInfo); SendPress_Option::set('last_test_debug', $smtp_debug); } if ($result != true && $istest == true) { $hostmsg = 'host: ' . $phpmailer->Host . ' port: ' . $phpmailer->Port . ' secure: ' . $phpmailer->SMTPSecure . ' auth: ' . $phpmailer->SMTPAuth . ' user: '******''; $msg .= __('The result was: ', 'sendpress') . $result . "\n"; $msg .= __('The mailer error info: ', 'sendpress') . $phpmailer->ErrorInfo . "\n"; $msg .= $hostmsg; $msg .= __("The SMTP debugging output is shown below:\n", "sendpress"); $msg .= $smtp_debug . "\n"; } return $result; }
function html($sp) { SendPress_Tracking::event('Overview Tab'); global $wp_version; $classes = 'sp-welcome-panel'; $option = get_user_meta(get_current_user_id(), 'show_sp_welcome_panel', true); // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner $hide = 0 == $option || 2 == $option && wp_get_current_user()->user_email != get_option('admin_email'); list($display_version) = explode('-', $wp_version); ?> <br> <div class="sp-row "> <div class="sp-block sp-25 sp-first"> <h2 class="nomargin nopadding"><?php echo SendPress_Data::bd_nice_number(SendPress_Data::get_total_subscribers()); ?> </h2> <p class="fwb"><?php _e('Subscribers', 'sendpress'); ?> </p> </div> <div class="sp-block sp-25"> <h2 class="nomargin nopadding"><?php $report = SendPress_Data::get_last_report(); echo SendPress_Data::emails_active_in_queue(); ?> </h2> <p class="fwb"><?php _e('Emails Actively Sending', 'sendpress'); ?> </small></p> </div> <div class="sp-block sp-25"> <h2 class="nomargin nopadding"><?php echo SendPress_Data::emails_maxed_in_queue(); ?> </h2> <p class="fwb"><?php _e('Emails Stuck in Queue', 'sendpress'); ?> </p> </div> <div class="sp-block sp-25"> <h2 class="nomargin nopadding"><?php _e('Autocron last check', 'sendpress'); ?> </h2> <p class="fwb"> <?php $autocron = SendPress_Option::get('autocron', 'no'); //print_r(SendPress_Data::emails_stuck_in_queue()); if ($autocron == 'yes') { $api_info = json_decode(SendPress_Cron::get_info()); if (isset($api_info->lastcheck)) { echo $api_info->lastcheck . " UTC"; } else { echo "No Data"; } } else { echo "Not Enabled"; } ?> </p> </div> </div> <?php if ($report) { $rec = get_post_meta($report->ID, '_send_last_count', true); $this->panel_start($report->post_title . " <small style='color:#333;'>" . __('This email had', 'sendpress') . " " . $rec . " " . __('Recipients', 'sendpress') . "</small>"); $stat_type = get_post_meta($report->ID, '_stat_type', true); $clicks = SPNL()->db("Subscribers_Url")->clicks_email_id($report->ID); $clicks_total = SPNL()->db("Subscribers_Url")->clicks_total_email_id($report->ID); ?> <div class="sp-row"> <div class="sp-50 sp-first"> <h4 style="text-align:center;"><?php _e('Opens', 'sendpress'); ?> </h4> <?php $this->panel_start(); $open = 0; $rec = get_post_meta($report->ID, '_send_last_count', true); if ($report) { if ($stat_type == 'new') { $open = SPNL()->db("Subscribers_Tracker")->get_opens_total($report->ID); } else { $open = SendPress_Data::get_opens($report->ID); } $p = $open / $rec * 100; } ?> <div class="sp-row"> <div class="sp-50 sp-first"> <div style="float:left;"> <div id="myStat" class="chartid" data-dimension="150" data-text="<?php echo floor($p); ?> %" data-info="Total Opens" data-width="15" data-fontsize="30" data-percent="<?php echo floor($p); ?> " data-fgcolor="#61a9dc" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php echo $rec; ?> " data-part="<?php echo $open; ?> " data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div> </div> <div style="text-align:center;"> <h5>Total</h5> <?php echo $open; ?> </div> </div> <div class="sp-50"> <?php $ou = 0; if ($stat_type == 'new') { $ou = SPNL()->db("Subscribers_Tracker")->get_opens($report->ID); } else { $ou = SendPress_Data::get_opens_unique_total($report->ID); } $px = $ou / $rec * 100; ?> <div style="float:left;"> <div id="myStat" class="chartid" data-dimension="150" data-text="<?php echo floor($px); ?> %" data-info="Unique Opens" data-width="15" data-fontsize="30" data-percent="35" data-fgcolor="#85d002" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php echo $rec; ?> " data-part="<?php echo $ou; ?> " data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div> </div> <div style="text-align:center;"> <h5>Unique</h5> <?php echo $ou; ?> </div> </div> </div> <?php $this->panel_end(); ?> </div> <div class="sp-50"> <h4 style="text-align:center;"><?php _e('Clicks', 'sendpress'); ?> </h4> <?php $this->panel_start(); $click = 0; $rec = get_post_meta($report->ID, '_send_last_count', true); if ($report) { if ($stat_type == 'new') { $click = SPNL()->db("Subscribers_Url")->clicks_email_id($report->ID); } else { $click = SendPress_Data::get_clicks($report->ID); } $p = $click / $rec * 100; } ?> <div class="sp-row"> <div class="sp-50 sp-first"> <div style="float:left;"> <div id="myStat" class="chartid" data-dimension="150" data-text="<?php echo floor($p); ?> %" data-info="Total Opens" data-width="15" data-fontsize="30" data-percent="<?php echo floor($p); ?> " data-fgcolor="#61a9dc" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php echo $rec; ?> " data-part="<?php echo $click; ?> " data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div> </div> <div style="text-align:center;"> <h5><?php _e('Total', 'sendpress'); ?> </h5> <?php echo $click; ?> </div> </div> <div class="sp-50"> <?php $ou = 0; if ($stat_type == 'new') { $ou = SPNL()->db("Subscribers_Url")->clicks_total_email_id($report->ID); } else { $ou = SendPress_Data::get_clicks_unique_total($report->ID); } $px = $ou / $rec * 100; ?> <div style="float:left;"> <div id="myStat" class="chartid" data-dimension="150" data-text="<?php echo floor($px); ?> %" data-info="Unique Opens" data-width="15" data-fontsize="30" data-percent="35" data-fgcolor="#85d002" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php echo $rec; ?> " data-part="<?php echo $ou; ?> " data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div> </div> <div style="text-align:center;"> <h5><?php _e('Unique', 'sendpress'); ?> </h5> <?php echo $ou; ?> </div> </div> </div> <?php $this->panel_end(); ?> </div> </div> <?php $this->panel_end(); } ?> <div class="sp-row"> <div class="sp-33 sp-first"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php _e('Recent Subscribers', 'sendpress'); ?> </h3> </div> <div class="panel-body"> <table class="table table-striped table-condensed"> <tr> <th>Date</th> <th>List</th> <th><div style="text-align:right;">Email</div></th> </tr> <?php $recent = SendPress_Data::get_recent_subscribers(); foreach ($recent as $item) { echo "<tr>"; echo "<td>"; if (property_exists($item, 'subscriberID')) { $d = SendPress_Data::get_subscriber($item->subscriberID); if (property_exists($item, 'updated')) { echo date_i18n("m.d.y", strtotime($item->updated)); } echo "</td>"; echo "<td >"; if (property_exists($item, 'listID')) { echo get_the_title($item->listID); } echo "</td>"; echo "<td align='right'>"; if (is_object($d)) { echo $d->email . "<br>"; } echo "</td>"; echo "</tr>"; } } ?> </table> </div> </div> </div> <div class="sp-33"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php _e('Most Active Subscribers', 'sendpress'); ?> </h3> </div> <div class="panel-body"> <ul> <?php $recent = SPNL()->db("Subscribers_Tracker")->get_most_active(); // SendPress_Data::get_most_active_subscriber(); foreach ($recent as $item) { if (property_exists($item, 'subscriber_id')) { echo "<li>"; $d = SendPress_Data::get_subscriber($item->subscriber_id); if (is_object($d)) { echo $d->email; } echo "</li>"; } } ?> </ul> </div> </div> </div> <div class="sp-33"> <?php if (!defined('SENDPRESS_PRO_VERSION')) { ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php _e('Go Pro!', 'sendpress'); ?> </h3> </div> <div class="panel-body"> <ul> <li><a href="http://sendpress.com/purchase-pricing/"><?php _e('Advanced Reports', 'sendpress'); ?> </a></li> <li><a href="http://sendpress.com/purchase-pricing/"><?php _e('Check Spam Scores', 'sendpress'); ?> </a></li> <li><a href="http://sendpress.com/purchase-pricing/"><?php _e('Post Notifications', 'sendpress'); ?> </a></li> </ul> </div> </div> <?php } ?> </div> </div> <script> jQuery( document ).ready(function($) { $('.chartid').circliful(); }); </script> <!-- <div class="panel panel-default"> <div class="panel-body"> <h2>Welcome to SendPress</h2> </div> </div> --> <?php if (SendPress_Option::get('feedback') == 'yes' || SendPress_Option::get('allow_tracking') == 'yes') { SendPress_Tracking::data(); } }
function page_end() { $try_theme = SendPress_Option::use_theme_style(); do_action('sendpress_public_after'); if ($try_theme) { do_action('sendpress_public_view_scripts'); get_footer(); } else { ?> </div> </div> </div> </div> <script src="<?php echo SENDPRESS_URL; ?> js/jquery-1.9.1.min.js"></script> <script type='text/javascript' src='<?php echo SENDPRESS_URL; ?> bootstrap/js/bootstrap.js?ver=3.3.2'></script> <?php do_action('sendpress_public_view_scripts'); ?> </body> </html> <?php } }