static function send_manage_subscription($subscriberID, $listids, $lists)
 {
     $subscriber = SendPress_Data::get_subscriber($subscriberID);
     SendPress_Email_Cache::build_cache_for_system_email($optin);
 }
        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 html($sp)
    {
        ?>
	<div id="taskbar" class="lists-dashboard rounded group">
		<form id="subscriber-edit" method="post">
	<div style="float:right;" >
	<input type="submit" class="btn btn-primary btn-large " id="subscriber-save" value="<?php 
        _e('Save', 'sendpress');
        ?>
"/>
</div> 
		
	<h2><?php 
        _e('Edit Subscriber', 'sendpress');
        ?>
</h2>
	</div>
<?php 
        $sub = SendPress_Data::get_subscriber($_GET['subscriberID']);
        ?>
<div class="boxer">
	<div class="boxer-inner">
		<div class="spmedia">
			<div class="media-image">
		<?php 
        echo get_avatar($sub->email, $size = '96');
        ?>
		</div>
		<div class="media-body">
	
		<input type="hidden" name="listID" value="<?php 
        echo SPNL()->validate->int($_GET['listID']);
        ?>
" />
	    <input type="hidden" name="subscriberID" value="<?php 
        echo SPNL()->validate->int($_GET['subscriberID']);
        ?>
" />
	    <strong><?php 
        _e('Email', 'sendpress');
        ?>
</strong>: <input type="text" name="email" class="regular-text sp-text" value="<?php 
        echo $sub->email;
        ?>
" /><br><br>
	    <strong><?php 
        _e('Firstname', 'sendpress');
        ?>
</strong>: <input type="text" class="regular-text sp-text" name="firstname" value="<?php 
        echo $sub->firstname;
        ?>
" /><br><br>
	    <strong><?php 
        _e('Lastname', 'sendpress');
        ?>
</strong>: <input type="text" class="regular-text sp-text" name="lastname" value="<?php 
        echo $sub->lastname;
        ?>
" /><br>
	    <br>
<input type="checkbox" id="delete-this-user" name="delete-this-user" value="yes"/> Checking this box will remove this subscriber and all related data from the system.<br><br>

	  
	   <?php 
        wp_nonce_field($sp->_nonce_value);
        ?>

	
	</div></div>
	<?php 
        ?>

	<h3>Subscriptions</h3>
	<div class="well">
		<table class=" table table-bordered table-striped">
			<tr>
				<th>List Name</th>
				<th>Status</th>
			</tr>
			<?php 
        global $post;
        $args = array('post_type' => 'sendpress_list', 'post_status' => array('publish', 'draft'), 'posts_per_page' => 100, 'order' => 'ASC', 'orderby' => 'title');
        $postslist = get_posts($args);
        foreach ($postslist as $post) {
            setup_postdata($post);
            ?>
 
			
				<tr>
					<td><?php 
            the_title();
            ?>
</td>
					<td><?php 
            $info = SendPress_Data::get_subscriber_list_status($post->ID, $_GET['subscriberID']);
            if (isset($info) && $info !== false) {
                $cls = '';
                if ($info->statusid == 1) {
                    $cls = 'badge-warning';
                }
                if ($info->statusid == 2) {
                    $cls = 'badge-success';
                }
                if ($info->statusid == 3) {
                    $cls = 'badge-important';
                }
                if ($info->statusid == 4) {
                    $cls = 'badge-inverse';
                }
                echo "<span class='badge {$cls}'>&nbsp;</span> ";
                $this->status_select($info->statusid, $post->ID);
                $this->pn_select($_GET['subscriberID'], $post->ID);
            } else {
                echo '<span class="badge">&nbsp;</span> ';
                $this->status_select(0, $post->ID);
            }
            ?>
 </td>
				</tr>

			</div>
		<?php 
        }
        wp_reset_postdata();
        ?>
</table>


	
	    		 
</div>
</form>
<h3>Subscriber Actions and Events</h3>
	<div class="well">
		<?php 
        if (!defined("SENDPRESS_PRO_VERSION")) {
            _e('This feature requires SendPress Pro.', 'sendpress');
        } else {
            do_action('sendpress_subscriber_events_view', $_GET['subscriberID']);
        }
        ?>
	</div>

	


</div>
</div>



	<?php 
    }
예제 #4
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);
 }
예제 #5
0
 function subject()
 {
     // Get any existing copy of our transient data
     //if ( false === ( $email_subject = get_transient( 'sendpress_report_subject_'. $this->id() ) ) || ($this->purge() == true) ) {
     // It wasn't there, so regenerate the data and save the transient
     if (!$this->post_info) {
         $this->post_info = get_post($this->id());
     }
     if ($this->post_info->post_type == 'sp_newsletters' || $this->post_info->post_type == 'sp_report') {
         $email_subject = get_post_meta($this->id(), '_sendpress_subject', true);
     } else {
         $email_subject = $this->post_info->post_title;
     }
     $email_subject = SendPress_Template::tag_replace($email_subject);
     //	set_transient( 'sendpress_report_subject_'. $this->id(), $email_subject , 60*60*2);
     // Get any existing copy of our transient data
     //}
     $subscriber = SendPress_Data::get_subscriber($this->subscriber_id());
     if (!is_null($subscriber)) {
         $email_subject = str_replace("*|FNAME|*", $subscriber->firstname, $email_subject);
         $email_subject = str_replace("*|LNAME|*", $subscriber->lastname, $email_subject);
         $email_subject = str_replace("*|EMAIL|*", $subscriber->email, $email_subject);
         $email_subject = str_replace("*|ID|*", $subscriber->subscriberID, $email_subject);
     }
     return $email_subject;
 }
 static function build_unsibscribed_notification($data)
 {
     $unsubscribe_body = '';
     $options = SendPress_Option::get('notification_options');
     switch ($options['unsubscribed']) {
         case 0:
             if ($data && $data['type'] === 'unsubscribed') {
                 $list = SendPress_Data::get_list_details($data['listID']);
                 $sub = SendPress_Data::get_subscriber($data['subscriberID']);
                 $unsubscribe_body = $sub->email . ' has unsubscribed from your list "' . $list->post_title . '".';
             }
             break;
         case 1:
             //$count = SendPress_Data::get_subscriber_event_count_day(date('Y-m-d'),'unsubscribed');
             $count = SendPress_Data::get_subscriber_count(date('Y-m-d H:i:s', strtotime('-1 day')), date('Y-m-d H:i:s'), 3);
             $unsubscribe_body = 'You had ' . $count . ' users unsubscribe today.';
             break;
         case 2:
             if (false === ($sendpress_weekly_check = get_transient('sendpress_weekly_unsubscribed_check'))) {
                 // It wasn't there, so regenerate the data and save the transient
                 if (date('w') === get_option('start_of_week', 0)) {
                     $count = SendPress_Data::get_subscriber_count(date('Y-m-d H:i:s', strtotime('-1 week')), date('Y-m-d H:i:s'), 3);
                     //$count = SendPress_Data::get_subscriber_event_count_week(date('Y-m-d', strtotime(date('Y-m-d')." -1 week")),date('Y-m-d'),'unsubscribed');
                     $unsubscribe_body = 'You had ' . $count . ' people unsubscribe last week.';
                     set_transient('sendpress_weekly_unsubscribed_check', true, WEEK_IN_SECONDS);
                 }
             }
             break;
         case 3:
             if (false === ($sendpress_monthly_check = get_transient('sendpress_monthly_unsubscribed_check'))) {
                 if (intval(date('j')) === 1) {
                     //get subscribers for for the last month
                     $count = SendPress_Data::get_subscriber_count(date('Y-m-d H:i:s', strtotime('-1 month')), date('Y-m-d H:i:s'), 3);
                     //$count = SendPress_Data::get_subscriber_event_count_month(date('j', strtotime(date('j')." -1 month")),'unsubscribed');
                     $unsubscribe_body = 'You had ' . $count . ' people unsubscribe last month.<br><br>';
                     set_transient('sendpress_monthly_unsubscribed_check', true, MONTH_IN_SECONDS);
                 }
             }
             break;
     }
     return $unsubscribe_body;
 }
    private static function manage_subscription($options)
    {
        //debug
        // $link_data = array(
        // 	"id"=>23,
        // 	"report"=>0,
        // 	"urlID"=> '0',
        // 	"view"=>"manage",
        // 	"listID"=>"0",
        // 	"action"=>""
        // );
        // $code = SendPress_Data::encrypt( $link_data );
        // $link =  SendPress_Manager::public_url($code);
        // print_r($link);
        $_nonce_value = 'sendpress-is-awesome';
        $info = self::data();
        //SendPress_Error::log($info->id);
        //print_r($info);
        if (!isset($info->id)) {
            $info = new stdClass();
            $info->id = '';
        }
        $s = $info->id;
        //SendPress_Error::log($s);
        extract($options);
        if (is_numeric($s)) {
            $sub = SendPress_Data::get_subscriber($s);
            if ($sub == false) {
                $sub = new stdClass();
                $sub->email = '*****@*****.**';
                $sub->join_date = date("F j, Y, g:i a");
            }
            // print_r($sub);
            ?>
			<link rel="stylesheet" type="text/css" href="<?php 
            echo SENDPRESS_URL;
            ?>
/css/manage-front-end.css">
			<div class="sendpress-content">
				<h4>Manage Subscriptions</h4>
				<div class="subscriber-info">
					<b><?php 
            _e('Email', 'sendpress');
            ?>
</b>
					<?php 
            echo $sub->email;
            ?>
<br>
					<b><?php 
            _e('Signup Date', 'sendpress');
            ?>
</b>
					<?php 
            echo $sub->join_date;
            ?>
				</div>
				<?php 
            if (self::handle_unsubscribes()) {
                ?>
					<div class="alert alert-block alert-info">
		 				<h4 class="alert-heading"><?php 
                _e('Saved', 'sendpress');
                ?>
!</h4>
		 				<?php 
                _e('Your subscriptions have been updated. Thanks.', 'sendpress');
                ?>
					</div>
					<?php 
            }
            ?>
				
				<p><?php 
            _e('You are subscribed to the following lists:', 'sendpress');
            ?>
</p>
				<?php 
            $info->action = "update";
            $key = SendPress_Data::encrypt($info);
            $query_var = '';
            if (get_query_var('spms')) {
                $query_var = "?spms=" . $key;
            } elseif (get_query_var('sendpress')) {
                $query_var = "?sendpress=" . $key;
            }
            ?>
				<form action="<?php 
            echo $query_var;
            ?>
" method="post">
				<?php 
            wp_nonce_field(SendPress_Data::nonce());
            ?>
				<input type="hidden" name="subscriberid" id="subscriberid" value="<?php 
            echo $s;
            ?>
" />

				<table cellpadding="0" cellspacing="0" class="table table-condensed table-striped table-bordered">
					<tr>
						<th  ><?php 
            _e('Subscribed', 'sendpress');
            ?>
</th>
						<th  ><?php 
            _e('Unsubscribed', 'sendpress');
            ?>
</th>
						<th  ><?php 
            _e('List', 'sendpress');
            ?>
</th>
						<th class="hidden-phone">Updated</th>
						<th class="hidden-phone">Other Info</th>
					</tr>
				<?php 
            $lists = SendPress_Data::get_lists(apply_filters('sendpress_modify_manage_lists', array('meta_query' => array(array('key' => 'public', 'value' => true)))), false);
            foreach ($lists as $list) {
                $subscriber = SendPress_Data::get_subscriber_list_status($list->ID, $s);
                ?>
				  	<tr>
				  	<?php 
                $checked = isset($subscriber->statusid) && $subscriber->statusid == 2 ? 'checked' : '';
                echo '<td><input type="radio" class="xbutton" data-list="' . $list->ID . '" name="subscribe_' . $list->ID . '" ' . $checked . ' value="2"></td>';
                $checked = isset($subscriber->statusid) && $subscriber->statusid == 3 ? 'checked' : '';
                echo '<td><input type="radio" class="xbutton" data-list="' . $list->ID . '" name="subscribe_' . $list->ID . '" ' . $checked . ' value="3"></td>';
                ?>
				  	<td><?php 
                echo $list->post_title;
                ?>
</td>
				  	<td class="hidden-phone"><span id="list_<?php 
                echo $list->ID;
                ?>
"><?php 
                if (isset($subscriber->updated)) {
                    echo $subscriber->updated;
                } else {
                    _e('Never Subscribed', 'sendpress');
                }
                ?>
</span>
					</td>
					<td class="hidden-phone">
						<?php 
                if (is_object($subscriber)) {
                    if ($subscriber->statusid != 3 && $subscriber->statusid != 2) {
                        echo $subscriber->status;
                    }
                }
                ?>
					</td>
				  	<tr>	
				    <?php 
            }
            ?>

				</table>
				<br>
				<?php 
            do_action('sendpress_manage_notifications', $info);
            ?>

				<input type="submit" class="btn btn-primary" value="<?php 
            _e('Save My Settings', 'sendpress');
            ?>
"/>
				</form>
			</div>
			<?php 
        }
    }
예제 #8
0
 function getSubscriber($subscriberID, $listID = false)
 {
     _deprecated_function(__FUNCTION__, '0.8.7', 'SendPress_Data::get_subscriber($subscriberID, $listID)');
     return SendPress_Data::get_subscriber($subscriberID, $listID);
 }
        function html($sp)
        {
            //SendPress_Template_Manager::update_template_content();
            SendPress_Tracking::event('Overview Tab');
            //print_r( SendPress_Data::get_subcribers_by_meta('test','test') );
            //echo wp_next_scheduled('wysija_cron_queue') . 'asdf';
            //SPNL()->db->subscribers_tracker->add( array('subscriber_id'=> 101, 'email_id'=> 20 ) );
            //SPNL()->db->subscribers_url->add_update( array('subscriber_id'=> 101, 'email_id'=> 20 , 'url_id' => 123 ) );
            //SPNL()->log->add(  'Email Skiped' , 'Email test',' did not have any Text.', 'sending');
            //print_r(_get_cron_array());
            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');
            //if ( $hide )
            //	$classes .= ' hidden';
            /*
            $args = array( 'post_type' => 'sendpress_list','numberposts'     => -1,
            	    'offset'          => 0,
            	    'orderby'         => 'post_title',
            	    'order'           => 'DESC', );
            		$lists = get_posts( $args );
            $sp->send_optin(1,array('1','2','3'),$lists);
            */
            list($display_version) = explode('-', $wp_version);
            //SendPress_Template_Manager::update_template_content();
            /*
            
            
            
            echo spnl_do_email_tags( 'here is some {subscriber_list} content that should run tags' , 0 , 0 );
            
            
            SPNL()->log->add('Bad Email','This email can not be sent');
            echo "<pre>";
            print_r( SPNL()->log->get_logs() );
            echo "</pre>";
            */
            ?>
<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_subscribed_events();
            foreach ($recent as $item) {
                echo "<tr>";
                echo "<td>";
                if (property_exists($item, 'subscriberID')) {
                    $d = SendPress_Data::get_subscriber($item->subscriberID);
                    if (property_exists($item, 'eventdate')) {
                        echo date_i18n("m.d.y", strtotime($item->eventdate));
                    }
                    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 = SendPress_Data::get_most_active_subscriber();
            foreach ($recent as $item) {
                if (property_exists($item, 'subscriberID')) {
                    echo "<li>";
                    $d = SendPress_Data::get_subscriber($item->subscriberID);
                    if (is_object($d)) {
                        echo $d->email;
                    }
                    echo "</li>";
                }
            }
            ?>
	  	</ul>
	  </div>
	</div>
</div>
<div class="sp-33">
	<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>
</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();
            }
        }