Пример #1
0
 public function draw_stat_panel()
 {
     global $post;
     $data = array();
     $data['mail_stat_data'] = TmMS_Statistic::get_mail_stat_data($post->ID);
     $data['referred_by_link'] = TmMS_Statistic::get_stat('referred_by_link', array('mail_id' => $post->ID));
     echo $this->draw_html('admin/pt_mail_subscriber/stat_panel', $data);
 }
Пример #2
0
 public function send_one_letter()
 {
     $user_id = (int) $_REQUEST['user_id'];
     $post_id = (int) $_REQUEST['post_id'];
     $settings = TmMS_Settings::get_settings();
     $site_url = site_url();
     //***
     $email = "";
     if ($user_id != 0) {
         $email = get_user_option('user_email', $user_id);
     } else {
         $email = $_REQUEST['email'];
     }
     //***
     $content = $this->db_quotes_shield(array('content' => $_REQUEST['content']));
     $content = $content['content'];
     //change links for stat
     $pattern = '#href=([\'"]?)((?(?<![\'"])[^>\\s]+|.+?(?=\\1)))\\1#si';
     $links_array = array();
     $processed_links_array = array();
     if (preg_match_all($pattern, $content, $links_array)) {
         foreach ($links_array[0] as $link) {
             if (!empty($link) and $link != '#') {
                 //$link = str_replace('"', '', $link);
                 //$link = str_replace("'", '', $link);
                 $link = str_replace("href=", '', $link);
                 //***
                 if (!in_array($link, $processed_links_array) and !empty($link) and $link != '#') {
                     $c = substr_count($link, $site_url);
                     if ($c > 0) {
                         //$content=preg_replace($pattern, TmMS_Statistic::get_letter_link_url($link, array('user_id' => $user_id, 'mail_id' => $post_id)), $content);
                         $content = str_replace($link, TmMS_Statistic::get_letter_link_url($link, array('user_id' => $user_id > 0 ? $user_id : uniqid(), 'mail_id' => $post_id)) . '"', $content);
                         $processed_links_array[] = $link;
                     }
                 }
                 //***
             }
         }
         $content = str_replace('"?', '?', $content);
     }
     //**** add unsubscribe link
     if ($user_id > 0) {
         $content .= "<br />";
         $content .= '<center>' . __("To stop receiving these emails, you may", 'newsplus') . ": " . "<a href='" . home_url() . "/?p=" . $settings['user_subscribe_page_id'] . "'>" . __('Manage your subscriptions', 'newsplus') . "</a></center>";
     }
     //*************************
     $attachments = array();
     $headers = 'MIME-Version: 1.0' . "\r\n";
     $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
     //$headers .= 'To: <' . $email . '>' . "\r\n";
     $headers .= 'From: ' . (!empty($settings['name_from']) ? $settings['name_from'] : get_option("blogname")) . ' <' . (!empty($settings['senders_mail_address']) ? $settings['senders_mail_address'] : get_option("admin_email")) . '>' . "\r\n";
     add_filter('wp_mail_content_type', create_function('', 'return "text/html"; '));
     $result_data = array();
     $result_data['error'] = "";
     $subject = get_post_meta($post_id, 'email_subject', true);
     if (!wp_mail($email, !empty($subject) ? $subject : $settings['default_email_subject'], $content, $headers, $attachments)) {
         $result_data['error'] = "Email for " . $email . " has not been sent";
     } else {
         $stat_data = array('user_id' => $user_id, 'mail_id' => $post_id, 'groups' => implode(',', $_REQUEST['subscribe_groups']), 'time' => time());
         $this->statistic->update_stat('sent', $stat_data);
         $this->statistic->add_mail_stat_data($post_id, array());
     }
     echo json_encode($result_data);
     exit;
 }
Пример #3
0
 public function delete_account()
 {
     if (!current_user_can('manage_options')) {
         $user_id = get_current_user_id();
         wp_delete_user($user_id);
         TmMS_Statistic::update_stat('delete_account');
     }
     exit;
 }
Пример #4
0
</a></li>
	</ul><!--/ .dash-tabs-nav-->

	<div class="dash-tabs-container" style="height: 350px; overflow: hidden;">
		<div class="dash-tab-content" id="dash-tabs-1">
			<?php 
echo TmMS_Statistic::draw_pie_chart($subscribers_stat);
?>
		</div>
		<div class="dash-tab-content" id="dash-tabs-2">
			<?php 
if (isset($subscribers_by_themes)) {
    echo TmMS_Statistic::draw_pie_chart($subscribers_by_themes);
}
?>
		</div>
		<div class="dash-tab-content" id="dash-tabs-3">
			<?php 
echo TmMS_Statistic::draw_pie_chart($emails_sent_by_groups);
?>
		</div>
		<div class="dash-tab-content" id="dash-tabs-4">
			<?php 
echo TmMS_Statistic::draw_column_chart($deleted_accounts);
?>
		</div>
	</div><!--/ .dash-tabs-container-->

</div><!--/ .dash-tabs-->