function save()
 {
     //$this->security_check();
     $saveid = SPNL()->validate->_int('post_ID');
     update_post_meta($saveid, 'send_date', date('Y-m-d H:i:s'));
     $email_post = get_post($saveid);
     $subject = SendPress_Option::get('current_send_subject_' . $saveid);
     $info = SendPress_Option::get('current_send_' . $saveid);
     $slug = SendPress_Data::random_code();
     $new_id = SendPress_Posts::copy($email_post, $subject, $slug, SPNL()->_report_post_type);
     SendPress_Posts::copy_meta_info($new_id, $saveid);
     $lists = implode(',', $info['listIDS']);
     update_post_meta($new_id, '_send_time', $info['send_at']);
     update_post_meta($new_id, '_send_lists', $lists);
     update_post_meta($new_id, '_stat_type', 'new');
     $count = 0;
     if (get_post_meta($saveid, 'istest', true) == true) {
         update_post_meta($new_id, '_report_type', 'test');
     }
     update_post_meta($new_id, '_sendpress_subject', $subject);
     if (isset($info['testemails']) && $info['testemails'] != false) {
         foreach ($info['testemails'] as $email) {
             $go = array('from_name' => 'Josh', 'from_email' => '*****@*****.**', 'to_email' => $email['email'], 'emailID' => $new_id, 'subscriberID' => 0, 'subject' => $subject, 'listID' => 0);
             SPNL()->add_email_to_queue($go);
             $count++;
         }
     }
     update_post_meta($new_id, '_send_count', $count);
     SendPress_Admin::redirect('Emails_Send_Queue', array('emailID' => $new_id));
 }
 function save($post, $sp)
 {
     $saveid = $_POST['post_ID'];
     update_post_meta($saveid, 'send_date', date('Y-m-d H:i:s'));
     $email_post = get_post($saveid);
     $subject = SendPress_Option::get('current_send_subject_' . $saveid);
     $info = SendPress_Option::get('current_send_' . $saveid);
     $slug = SendPress_Data::random_code();
     $new_id = SendPress_Posts::copy($email_post, $subject, $slug, $sp->_report_post_type);
     SendPress_Posts::copy_meta_info($new_id, $saveid);
     $lists = implode(',', $info['listIDS']);
     update_post_meta($new_id, '_send_time', $info['send_at']);
     update_post_meta($new_id, '_send_lists', $lists);
     update_post_meta($new_id, '_stat_type', 'new');
     $count = 0;
     if (get_post_meta($saveid, 'istest', true) == true) {
         update_post_meta($new_id, '_report_type', 'test');
     }
     update_post_meta($new_id, '_sendpress_subject', $subject);
     /*
     
             if(isset($info['listIDS'])){
                // foreach($info['listIDS'] as $list_id){
         $_email = SendPress_Data::get_active_subscribers_lists($info['listIDS']); //$sp->get_active_subscribers( $list_id );
     
         foreach($_email as $email){
            
              $go = array(
                 'from_name' => '',
                 'from_email' => '',
                 'to_email' => $email->email,
                 'emailID'=> $new_id,
                 'subscriberID'=> $email->subscriberID,
                 //'to_name' => $email->fistname .' '. $email->lastname,
                 'subject' => '',
                 'listID'=> $email->listid
                 );
            
             $sp->add_email_to_queue($go);
             $count++;
     
         }
     
     
               //  }
             }
     */
     if (isset($info['testemails']) && $info['testemails'] != false) {
         foreach ($info['testemails'] as $email) {
             $go = array('from_name' => 'Josh', 'from_email' => '*****@*****.**', 'to_email' => $email['email'], 'emailID' => $new_id, 'subscriberID' => 0, 'subject' => $subject, 'listID' => 0);
             $sp->add_email_to_queue($go);
             $count++;
         }
     }
     update_post_meta($new_id, '_send_count', $count);
     // update_post_meta($new_id,'_send_data', $info );
     SendPress_Admin::redirect('Emails_Send_Queue', array('emailID' => $new_id));
     //wp_redirect( '?page=sp-queue' );
 }
 function save()
 {
     $postdata = get_post($_GET['templateID']);
     $new_post = SendPress_Posts::copy($postdata, $_POST['post_title'], '', '');
     SendPress_Posts::copy_meta_info($new_post, $_GET['templateID']);
     update_post_meta($new_post, '_template_type', 'clone');
     update_post_meta($new_post, '_guid', '');
     SendPress_Admin::redirect('Emails_Tempstyle', array('templateID' => $new_post));
 }
 static function send_optin($subscriberID, $listids, $lists)
 {
     //SendPress_Error::log('send optin');
     $subscriber = SendPress_Data::get_subscriber($subscriberID);
     $l = '';
     $optin_id = 0;
     foreach ($lists as $list) {
         if (in_array($list->ID, $listids)) {
             $l .= $list->post_title . " <br>";
             if ($optin_id === 0) {
                 $o = get_post_meta($list->ID, 'opt-in-id', true);
                 if ($o === "") {
                     $o = 0;
                 }
                 if ($o > 0) {
                     $optin_id = $o;
                 }
             }
         }
     }
     //	add_filter( 'the_content', array( $this, 'the_content') );
     $optin = $optin_id > 0 ? $optin_id : SendPress_Data::get_template_id_by_slug('double-optin');
     $user = SendPress_Data::get_template_id_by_slug('user-style');
     SendPress_Posts::copy_meta_info($optin, $user);
     SendPress_Email_Cache::build_cache_for_system_email($optin);
     $go = array('from_name' => 'queue', 'from_email' => 'queue', 'to_email' => $subscriber->email, 'emailID' => intval($optin), 'subscriberID' => intval($subscriberID), 'subject' => '', 'listID' => 0);
     $id = SendPress_Data::add_email_to_queue($go);
     SPNL()->load("Subscribers_Tracker")->add(array('subscriber_id' => intval($subscriberID), 'email_id' => intval($optin), 'tracker_type' => SendPress_Enum_Tracker_Type::Confirm));
     $confirm_email = SendPress_Data::get_single_email_from_queue_by_id($id);
     SendPress_Email_Cache::build_cache_for_system_email($confirm_email->id);
     $confirm_email->is_confirm = true;
     SendPress_Queue::send_the_queue($confirm_email);
     /*
     $message = new SendPress_Email();
     $message->id($optin);
     $message->subscriber_id($subscriberID);
     $message->remove_links(true);
     $message->purge(true);
     $html = $message->html();
     $message->purge(false);
     $text = $message->text();
     
     $code = array(
     		"id"=>$subscriberID,
     		"listids"=> implode(',',$listids),
     		"view"=>"confirm"
     	);
     $code = SendPress_Data::encrypt( $code );
     
     if( SendPress_Option::get('old_permalink') || !get_option('permalink_structure') ){
     	$link = home_url() ."?sendpress=".$code;
     } else {
     	$link = home_url() ."/sendpress/".$code;
     }
     
     $href = $link;
     $html_href = "<a href='". $link  ."'>". $link  ."</a>";
     
     
     $html = str_replace("*|SP:CONFIRMLINK|*", $html_href , $html );
     $text = str_replace("*|SP:CONFIRMLINK|*", $href , $text );
     $text = nl2br($text);
     $sub =  $message->subject();
     SPNL()->load("Subscribers_Tracker")->add( array('subscriber_id' => intval( $subscriberID ), 'email_id' => intval( $optin), 'tracker_type' => SendPress_Enum_Tracker_Type::Confirm ) );
     //SendPress_Data::register_event( 'confirm_sent', $subscriberID );			
     SendPress_Manager::send( $subscriber->email, $sub , $html, $text, false );
     */
 }
Ejemplo n.º 5
0
 static function send_manage_subscription($subscriberID, $listids, $lists)
 {
     $subscriber = SendPress_Data::get_subscriber($subscriberID);
     $l = '';
     foreach ($lists as $list) {
         if (in_array($list->ID, $listids)) {
             $l .= $list->post_title . " <br>";
         }
     }
     //	add_filter( 'the_content', array( $this, 'the_content') );
     $optin = SendPress_Data::get_template_id_by_slug('double-optin');
     $user = SendPress_Data::get_template_id_by_slug('user-style');
     SendPress_Posts::copy_meta_info($optin, $user);
     $message = new SendPress_Email();
     $message->id($optin);
     $message->subscriber_id($subscriberID);
     $message->remove_links(true);
     $message->purge(true);
     $html = $message->html();
     $message->purge(false);
     $text = $message->text();
     $code = array("id" => $subscriberID, "listids" => implode(',', $listids), "view" => "confirm");
     $code = SendPress_Data::encrypt($code);
     if (SendPress_Option::get('old_permalink') || !get_option('permalink_structure')) {
         $link = home_url() . "?sendpress=" . $code;
     } else {
         $link = home_url() . "/sendpress/" . $code;
     }
     $href = $link;
     $html_href = "<a href='" . $link . "'>" . $link . "</a>";
     $html = str_replace("*|SP:CONFIRMLINK|*", $html_href, $html);
     $text = str_replace("*|SP:CONFIRMLINK|*", $href, $text);
     $text = nl2br($text);
     $sub = $message->subject();
     SendPress_Data::register_event('confirm_sent', $subscriberID);
     SendPress_Manager::send($subscriber->email, $sub, $html, $text, false);
 }
        }
        wp_redirect(esc_url_raw(admin_url('admin.php?page=' . SPNL()->validate->page($_GET['page']))));
        break;
    case 'delete-reports-bulk':
        $email_delete = $_GET['report'];
        foreach ($email_delete as $emailID) {
            $email = SPNL()->validate->int($emailID);
            if ($email > 0) {
                SendPress_Posts::report_delete($emailID);
            }
        }
        wp_redirect(esc_url_raw(admin_url('admin.php?page=' . SPNL()->validate->page($_GET['page']))));
        break;
    case 'delete-email':
        $email = SPNL()->validate->int($emailID);
        if ($email > 0) {
            SendPress_Posts::delete($email);
        }
        wp_redirect(esc_url_raw(admin_url('admin.php?page=' . SPNL()->validate->page($_GET['page']))));
        break;
    case 'delete-emails-bulk':
        $email_delete = $_GET['email'];
        foreach ($email_delete as $emailID) {
            $email = SPNL()->validate->int($emailID);
            if ($email > 0) {
                SendPress_Posts::delete($email);
            }
        }
        wp_redirect(esc_url_raw(admin_url('admin.php?page=' . SPNL()->validate->page($_GET['page']))));
        break;
}
Ejemplo n.º 7
0
     SendPress_Option::set('linkedin', $linkedin);
     SendPress_Option::set('facebook', $facebook);
     SendPress_Option::set('twitter', $twitter);
     SendPress_Option::set('fromemail', $fromemail);
     SendPress_Option::set('fromname', $fromname);
     wp_redirect(esc_url_raw(admin_url('admin.php?page=sp-settings')));
     break;
 case 'save-send-confirm':
     $saveid = $_POST['post_ID'];
     update_post_meta($saveid, 'send_date', date('Y-m-d H:i:s'));
     $email_post = get_post($saveid);
     $subject = SendPress_Option::get('current_send_subject_' . $saveid);
     $info = SendPress_Option::get('current_send_' . $saveid);
     $slug = $this->random_code();
     $new_id = SendPress_Posts::copy($email_post, $subject, $slug, $this->_report_post_type);
     SendPress_Posts::copy_meta_info($new_id, $saveid);
     $this->log('ADD QUEUE');
     $count = 0;
     if (isset($info['listIDS'])) {
         foreach ($info['listIDS'] as $list_id) {
             $_email = $this->get_active_subscribers($list_id);
             foreach ($_email as $email) {
                 $go = array('from_name' => 'Josh', 'from_email' => '*****@*****.**', 'to_email' => $email->email, 'emailID' => $new_id, 'subscriberID' => $email->subscriberID, 'subject' => $subject, 'listID' => $list_id);
                 $this->add_email_to_queue($go);
                 $count++;
             }
         }
     }
     if (isset($info['testemails'])) {
         foreach ($info['testemails'] as $email) {
             $go = array('from_name' => 'Josh', 'from_email' => '*****@*****.**', 'to_email' => $email['email'], 'emailID' => $new_id, 'subscriberID' => 0, 'subject' => $subject, 'listID' => 0);
Ejemplo n.º 8
0
 function add_custom_post()
 {
     SendPress_Posts::email_post_type($this->_email_post_type);
     SendPress_Posts::report_post_type($this->_report_post_type);
     SendPress_Posts::template_post_type();
     SendPress_Posts::list_post_type();
     do_action('sendpress_custom_post_types_created', $this);
 }