public static function add_test_subscribers($post)
 {
     if (isset($post['count'])) {
         $count = $post['count'];
         for ($c = 0; $c < $count; $c++) {
             EZP_CS_Query_Utility::add_new_subscriber("person-{$c}", "{$c}@gmail.com");
         }
     } else {
         EZP_CS_Utility::debug('Count parameter not set for add_test_subscribers!');
     }
 }
                            EZP_CS_Utility::debug('add_new_subscriber:Error saving subscriber entity to deleting email and contact');
                            $email->delete();
                            $contact->delete();
                        }
                    } else {
                        EZP_CS_Utility::debug('add_new_subscriber:Error saving email entity so deleting contact');
                        $contact->delete();
                    }
                } else {
                    EZP_CS_Utility::debug('add_new_subscriber:Error saving contact entity');
                }
            }
            return $error_text;
        }
        // Delete contact and all dependent data
        public static function purge_contact($contact_id)
        {
            $subscriber = EZP_CS_Subscriber_Entity::get_by_contact_id($contact_id);
            if ($subscriber != null) {
                $subscriber->delete();
            }
            $emails = EZP_Email_Entity::get_by_contact_id($contact_id);
            foreach ($email as $email) {
                /* @var $email EZP_Email_Entity */
                $email->delete();
            }
            EZP_Contact_Entity::delete_by_id($contact_id);
        }
    }
    EZP_CS_Query_Utility::init();
}
<div class="wrap">

    <div id="easypie-cs-options" class="inside">

        <?php 
$_wpnonce = wp_create_nonce('easy-pie-cs-change-subscribers');
$current_page_idx = 0;
$prev_page_idx = 0;
$next_page_idx = 1;
if (isset($_GET['page_idx'])) {
    $current_page_idx = $_GET['page_idx'];
    $prev_page_idx = $current_page_idx > 0 ? $current_page_idx - 1 : 0;
    $next_page_idx = $current_page_idx + 1;
}
$subscribers = EZP_CS_Query_Utility::get_subscriber_list($current_page_idx);
?>
        <div class="postbox" style="margin-top:12px;" >
            <div class="inside" id="easy-pie-cs-postbox-inside" >
                <h2>Create a newsletter using your subscriber list</h2>
                <h3 style="margin-top:25px; margin-bottom:10px;">Step 1. Save subscriber list as a CSV file to your local hard drive.</h3>
                <button style="margin:0px; font-size:1.1em; font-weight:bold;" id="btn-export" type="button" onclick="location.href = ajaxurl + '?action=EZP_CS_export_all_subscribers&_wpnonce=<?php 
echo $_wpnonce;
?>
';
                        return false;"><?php 
EZP_CS_Utility::_e('Save');
?>
</button>
                <h3 style="margin-top:40px;margin-bottom:10px;">Step 2. Import CSV file into an email marketing service.</h3>
                <p>Import the saved CSV file into one of the following providers or use your own.</p>
$prev_page_idx = 0;
$next_page_idx = 1;
if (isset($_GET['page_idx'])) {
    $current_page_idx = $_GET['page_idx'];
    $prev_page_idx = $current_page_idx > 0 ? $current_page_idx - 1 : 0;
    $next_page_idx = $current_page_idx + 1;
}
$subscribers = EZP_CS_Query_Utility::get_subscriber_list($current_page_idx);
$next_url = admin_url("admin.php?page=easy-pie-coming-soon-subscribers&page_idx={$next_page_idx}");
$prev_url = admin_url("admin.php?page=easy-pie-coming-soon-subscribers&page_idx={$prev_page_idx}");
if ($current_page_idx == 0) {
    $prev_disabled = 'disabled';
} else {
    $prev_disabled = '';
}
$num_pages = EZP_CS_Query_Utility::get_subscriber_pages();
if ($next_page_idx >= $num_pages) {
    $next_disabled = 'disabled';
} else {
    $next_disabled = '';
}
if ($num_pages == 0) {
    $controls_display = 'none';
} else {
    $controls_display = 'block';
}
?>
        <div class="postbox" style="margin-top:12px;" >
            <div class="inside" id="easy-pie-cs-postbox-inside" >

                                
Esempio n. 5
0
 function ws_export_all_subscribers()
 {
     if (isset($_REQUEST['_wpnonce'])) {
         $_wpnonce = $_REQUEST['_wpnonce'];
         if (wp_verify_nonce($_wpnonce, 'easy-pie-cs-change-subscribers')) {
             header("Pragma: public");
             header("Expires: 0");
             header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
             header("Cache-Control: private", false);
             header("Content-Type: application/octet-stream");
             header("Content-Disposition: attachment; filename=\"subscribers.csv\";");
             header("Content-Transfer-Encoding: binary");
             $subscribers = EZP_CS_Query_Utility::get_subscriber_list(-1);
             echo "Name, Email Address, Date\r\n";
             foreach ($subscribers as $subscriber) {
                 if ($subscriber->subscription_date != '') {
                     //   $localized_date = date_i18n(get_option('date_format'), strtotime($subscriber->subscription_date));
                     $date_text = date('n/j/Y', strtotime($subscriber->subscription_date));
                 } else {
                     //   $localized_date = '';
                     $date_text = '';
                 }
                 echo "{$subscriber->friendly_name}, {$subscriber->email_address}, {$date_text}\r\n";
             }
             exit;
         } else {
             EZP_CS_Utility::debug("ws_export_all_subscribers: Security violation. Nonce doesn't properly match!");
         }
     } else {
         EZP_CS_Utility::debug("ws_export_all_subscribers: Security violation. Nonce doesn't exist!");
     }
 }
Esempio n. 6
0
<?php

$global = EZP_CS_Global_Entity::get_instance();
$set_index = $global->active_set_index;
$set = EZP_CS_Set_Entity::get_by_id($set_index);
$display = EZP_CS_Display_Entity::get_by_id($set->display_index);
$content = EZP_CS_Content_Entity::get_by_id($set->content_index);
$config = EZP_CS_Config_Entity::get_by_id($global->config_index);
$error_display = 'none';
$error_text = '';
$js_thank_you = "var thankYouDisplayed=false;";
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $subscriber = new EZP_CS_Subscriber_Entity();
    $error_text = EZP_CS_Query_Utility::add_new_subscriber($_POST['ezp_cs_name'], $_POST['ezp_cs_email']);
    if ($error_text == null) {
        $js_thank_you = "var thankYouDisplayed=true;";
        $initial_section_display = 'none';
        $thank_you_section_display = 'block';
    } else {
        $error_display = 'block';
        $initial_section_display = 'block';
        $thank_you_section_display = 'none';
    }
} else {
    $initial_section_display = 'block';
    $thank_you_section_display = 'none';
}
?>
<!DOCTYPE html>
<html>
    <head>