Exemplo n.º 1
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);
 }
 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 );
     */
 }
Exemplo n.º 3
0
 static function set_default_style($id)
 {
     if (false == get_post_meta($id, 'body_bg', true)) {
         $default_styles_id = SendPress_Data::get_template_id_by_slug('user-style');
         if (false == get_post_meta($default_styles_id, 'body_bg', true)) {
             $default_styles_id = SendPress_Data::get_template_id_by_slug('default-style');
         }
         $default_post = get_post($default_styles_id);
         update_post_meta($id, 'body_bg', get_post_meta($default_post->ID, 'body_bg', true));
         update_post_meta($id, 'body_text', get_post_meta($default_post->ID, 'body_text', true));
         update_post_meta($id, 'body_link', get_post_meta($default_post->ID, 'body_link', true));
         update_post_meta($id, 'header_bg', get_post_meta($default_post->ID, 'header_bg', true));
         update_post_meta($id, 'header_text_color', get_post_meta($default_post->ID, 'header_text_color', true));
         //update_post_meta( $id , 'header_text',  get_post_meta( $default_post->ID , 'header_text', true) );
         update_post_meta($id, 'content_bg', get_post_meta($default_post->ID, 'content_bg', true));
         update_post_meta($id, 'content_text', get_post_meta($default_post->ID, 'content_text', true));
         update_post_meta($id, 'sp_content_link_color', get_post_meta($default_post->ID, 'sp_content_link_color', true));
         update_post_meta($id, 'content_border', get_post_meta($default_post->ID, 'content_border', true));
         update_post_meta($id, 'upload_image', get_post_meta($default_post->ID, 'upload_image', true));
     }
 }
Exemplo n.º 4
0
 public static function jaiminho_define_opt_in_email()
 {
     $optin = SendPress_Data::get_template_id_by_slug('double-optin');
     $my_post = array('ID' => $optin, 'post_title' => "Por favor responda para entrar na lista de emails da *|SITE:TITLE|*", 'post_content' => "Olá! \n\n\t\t\t\tFalta pouco para podermos enviar para você e-mail do site *|SITE:TITLE|*, mas antes disto precisamos que você confirme que você realmente quer receber nossas informações.\n\n\t\t\t\tSe você quer receber informações do *|SITE:TITLE|* no seu e-mail, você só precisa clicar no linque abaixo. Muito obrigado! \n\t\t\t\t———————————————————————————————————\n\t\t\t\tCONFIRME UTILIZANDO O LINQUE ABAIXO: \n\n\t\t\t\t*|SP:CONFIRMLINK|* \n\n\t\t\t\tClique no linque acima para nos dar permissão de te enviar\n\t\t\t\tinformações. É rápido e fácil! Se você não conseguir clicar, \n\t\t\t\tcopie e cole o linque o seu navegador. \n\t\t\t\t———————————————————————————————————\n\n\t\t\t\tSe você não quiser receber e-mails, simplesmente ignore esta mensagem.");
     wp_update_post($my_post);
 }
Exemplo n.º 5
0
    if (!defined('SENDPRESS_STYLER_PAGE')) {
        SendPress_Admin::redirect('Emails');
    }
}
$default_styles_id = SendPress_Data::get_template_id_by_slug('user-style');
if (isset($emailID)) {
    if (false == get_post_meta($default_styles_id, 'body_bg', true)) {
        $default_styles_id = SendPress_Data::get_template_id_by_slug('default-style');
    }
    $display_content = $post->post_content;
    //$display_content = apply_filters('the_content', $display_content);
    //$display_content = str_replace(']]>', ']]>', $display_content);
} else {
    $post = get_post($default_styles_id);
    $post_id = $post->ID;
    $default_styles_id = SendPress_Data::get_template_id_by_slug('default-style');
    $display_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas eget libero nisi. Donec pretium pellentesque rutrum. Fusce viverra dapibus nisi in aliquet. Aenean quis convallis quam. Praesent eu lorem mi, in congue augue. Fusce vitae elementum sapien. Vivamus non nisi velit, interdum auctor nulla. Morbi at sem nec ligula gravida elementum. Morbi ornare est et nunc tristique posuere.

Morbi iaculis fermentum magna, <a href="#">nec laoreet erat commodo vel</a>. Donec arcu justo, varius at porta eget, aliquet varius ipsum. Aliquam at lacus magna. Curabitur ullamcorper viverra turpis, vitae egestas mi tincidunt sed. Quisque fringilla adipiscing feugiat. In magna lectus, lacinia in suscipit sit amet, varius sed justo. Suspendisse vehicula, magna vitae porta pretium, massa ipsum commodo metus, eget feugiat massa leo in elit.';
}
$default_post = get_post($default_styles_id);
/*
if(!isset($post)){

	$post = $default_post;
}
*/
if (isset($post) && false == get_post_meta($post->ID, 'body_bg', true)) {
    update_post_meta($post->ID, 'body_bg', get_post_meta($default_post->ID, 'body_bg', true));
    update_post_meta($post->ID, 'body_text', get_post_meta($default_post->ID, 'body_text', true));
    update_post_meta($post->ID, 'body_link', get_post_meta($default_post->ID, 'body_link', true));
Exemplo n.º 6
0
 function the_content($content)
 {
     global $post;
     $optin = SendPress_Data::get_template_id_by_slug('double-optin');
     if ($post->post_type == 'sptemplates' && $post->ID == $optin) {
         $content .= "";
     }
     return $content;
 }
        function html($sp)
        {
            $optin = SendPress_Data::get_template_id_by_slug('double-optin');
            $dpost = get_post($optin);
            ?>
		<form method="post" id="post">
<!--
<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>
-->
		<br class="clear">
		<br class="clear">
		<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title"><?php 
            _e('Public Page Settings', 'sendpress');
            ?>
</h3>
  </div>
  <div class="panel-body">
<div class="boxer form-box">
	

	<br><b><?php 
            _e('Use theme styles', 'sendpress');
            ?>
:&nbsp;&nbsp;&nbsp;<input type="radio" value="yes" <?php 
            if (SendPress_Option::get('try-theme') == 'yes') {
                echo "checked='checked'";
            }
            ?>
 name="try-theme"> Yes&nbsp;&nbsp;&nbsp;<input type="radio" value="no" <?php 
            if (SendPress_Option::get('try-theme') == 'no') {
                echo "checked='checked'";
            }
            ?>
 name="try-theme"> <?php 
            _e('No', 'sendpress');
            ?>
</b>
	<br><?php 
            _e('This will attempt to use the WordPress theme functions', 'sendpress');
            ?>
 <code>get_header</code> <?php 
            _e('and', 'sendpress');
            ?>
 <code>get_footer</code> <?php 
            _e('to build the SendPress default public pages', 'sendpress');
            ?>
.
	<br><hr>
	<div class="sp-row">
			<div class="sp-33 sp-first"><b><?php 
            _e('Manage Page', 'sendpress');
            ?>
</b><br>
				<div class='well'>
					<?php 
            _e('This is the page subscribers are directed to to manage their subscriptions to your lists', 'sendpress');
            ?>
.
					<br><br>
					<?php 
            $ctype = SendPress_Option::get('manage-page');
            ?>
					<input type="radio" name="manage-page" value="default" <?php 
            if ($ctype == 'default') {
                echo "checked='checked'";
            }
            ?>
 /> <?php 
            _e('Use Default SendPress Page', 'sendpress');
            ?>
<br><br>
					<input type="radio" name="manage-page" value="custom"  <?php 
            if ($ctype == 'custom') {
                echo "checked='checked'";
            }
            ?>
/> <?php 
            _e('Redirect to', 'sendpress');
            ?>
 
					<select name="manage-page-id"> 
					 	<option value="">
					 	<?php 
            $cpageid = SendPress_Option::get('manage-page-id');
            ?>
						<?php 
            echo esc_attr(__('Select page'));
            ?>
</option> 
						 <?php 
            $pages = get_pages();
            foreach ($pages as $page) {
                $s = '';
                if ($cpageid == $page->ID) {
                    $s = "selected";
                }
                $option = '<option value="' . $page->ID . '" ' . $s . '>';
                $option .= $page->post_title;
                $option .= '</option>';
                echo $option;
            }
            ?>
						</select>

					<br><br>
					<a class="btn btn-default" href="<?php 
            echo site_url();
            ?>
?sendpress=manage"><?php 
            _e('View Page', 'sendpress');
            ?>
</a>
				</div>

			</div>

			<div class="sp-33"><b><?php 
            _e('Confirmation Page', 'sendpress');
            ?>
</b><br>
			<div class='well'>
			<?php 
            _e('Select the page a new subcriber will be redirected to after they click the confirmation link in the Double Opt-in Email', 'sendpress');
            ?>
.<br><br>
			<?php 
            $ctype = SendPress_Option::get('confirm-page');
            ?>
			<input type="radio" name="confirm-page" value="default" <?php 
            if ($ctype == 'default') {
                echo "checked='checked'";
            }
            ?>
 /> <?php 
            _e('Use Default SendPress Page', 'sendpress');
            ?>
<br><br>
			<input type="radio" name="confirm-page" value="custom"  <?php 
            if ($ctype == 'custom') {
                echo "checked='checked'";
            }
            ?>
/> <?php 
            _e('Redirect to', 'sendpress');
            ?>
 <select name="confirm-page-id"> 
 <option value="">
 	<?php 
            $cpageid = SendPress_Option::get('confirm-page-id');
            echo esc_attr(__('Select page'));
            ?>
</option> 
 <?php 
            $pages = get_pages();
            foreach ($pages as $page) {
                $s = '';
                if ($cpageid == $page->ID) {
                    $s = "selected";
                }
                $option = '<option value="' . $page->ID . '" ' . $s . '>';
                $option .= $page->post_title;
                $option .= '</option>';
                echo $option;
            }
            ?>
</select><br><br>
<a class="btn btn-default" href="<?php 
            echo site_url();
            ?>
?sendpress=confirm"><?php 
            _e('View Page', 'sendpress');
            ?>
</a>
</div></div>

			<div class="sp-33"><b><?php 
            _e('Post Page', 'sendpress');
            ?>
</b><br>
				<div class='well'>
					<?php 
            _e('This is the page shown by default if you are using a custom form to post subscriber data. This can also be set per list on each lists form page', 'sendpress');
            ?>
.
					<br><br>
					<a class="btn btn-default" href="<?php 
            echo site_url();
            ?>
?sendpress=post"><?php 
            _e('Post Page', 'sendpress');
            ?>
</a>
				</div>

			</div>

	</div>

</div>
	
	</div></div>

	<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title"><?php 
            _e('Double Opt-in Email', 'sendpress');
            ?>
</h3>
  </div>
  <div class="panel-body">	
<div class="boxer form-box">
	
	<div style="float: right; width: 45%;"><br>
		<b><?php 
            _e('Subject', 'sendpress');
            ?>
</b><br>
		<input type="text" name="subject" class="regular-text sp-text" style="width: 100%;" value="<?php 
            echo stripcslashes($dpost->post_title);
            ?>
"/>
		<br><br><b><?php 
            _e('Body', 'sendpress');
            ?>
</b><br>
		<?php 
            if (strpos($dpost->post_content, '*|SP:CONFIRMLINK|*') == false) {
                echo "<div class='alert alert-error'>Missing <b>*|SP:CONFIRMLINK|*</b> in body content.</div>";
            }
            ?>
		<textarea style="width:100%; padding: 8px;" rows="21" name="body"><?php 
            remove_filter('the_content', 'wpautop');
            global $post;
            $post = $dpost;
            $content = apply_filters('the_content', $dpost->post_content);
            $content = str_replace(']]>', ']]&gt;', $content);
            echo stripcslashes($content);
            ?>
</textarea>

	</div>	
	<div style="width: 45%; margin-right: 10%">
		<br><b><?php 
            _e('Send Double Opt-in Email', 'sendpress');
            ?>
:&nbsp;&nbsp;&nbsp;<input type="radio" value="yes" <?php 
            if (SendPress_Option::get('send_optin_email') == 'yes') {
                echo "checked='checked'";
            }
            ?>
 name="optin"> Yes&nbsp;&nbsp;&nbsp;<input type="radio" value="no" <?php 
            if (SendPress_Option::get('send_optin_email') == 'no') {
                echo "checked='checked'";
            }
            ?>
 name="optin"> No</b>
			<br><?php 
            _e('Keep the spammers, robots and other riff-raff off your list', 'sendpress');
            ?>
. <br><?php 
            _e('Read more about why to use double opt-in on out support site', 'sendpress');
            ?>
.
			<br><br><br>
			


			<br>
			<b><?php 
            _e('Quick Tags', 'sendpress');
            ?>
</b>: <?php 
            _e('work in both subject and body', 'sendpress');
            ?>
.
			<div class='well'>
				<b>*|SP:CONFIRMLINK|*</b> <?php 
            _e('This is required to be in the body of the email', 'sendpress');
            ?>
.
				<hr>
				*|SITE:TITLE|* - <?php 
            _e('Add Website title to the email', 'sendpress');
            ?>
.
				<hr>
				*|EMAIL|* - <?php 
            _e('Add the email the user signed up with', 'sendpress');
            ?>
.
			</div>
		<!--
		<p><input type="text" class="regular-text" style="width: 100%;"/></p>
		-->
		<b>Select your template</b>:
					<select name="confirm-notification-template">
					<?php 
            echo '<option value="0">Default Template</option>';
            $args = array('post_type' => 'sp_template', 'post_status' => array('sp-standard'));
            $template_id = SendPress_Option::get('confirm-notification-template', 0);
            $the_query = new WP_Query($args);
            if ($the_query->have_posts()) {
                echo '<optgroup label="SendPress Templates">';
                while ($the_query->have_posts()) {
                    $the_query->the_post();
                    $temp_id = $the_query->post->ID;
                    $s = '';
                    if ($temp_id == $template_id) {
                        $s = 'selected';
                    }
                    echo '<option value="' . $temp_id . '" ' . $s . '>' . get_the_title() . '</option>';
                }
                echo '</optgroup>';
            }
            wp_reset_postdata();
            $args = array('post_type' => 'sp_template', 'post_status' => array('sp-custom'));
            $the_query = new WP_Query($args);
            if ($the_query->have_posts()) {
                echo '<optgroup label="Custom Templates">';
                while ($the_query->have_posts()) {
                    $the_query->the_post();
                    $temp_id = $the_query->post->ID;
                    $s = '';
                    if ($temp_id == $template_id) {
                        $s = 'selected';
                    }
                    echo '<option value="' . $temp_id . '" ' . $s . '>' . get_the_title() . '</option>';
                }
                wp_reset_postdata();
                echo '</optgroup>';
            }
            ?>
					
					</select>
				</p>
		<br class="clear">
		<br class="clear">

	</div>
</div></div></div>
<!--
<div class="boxer form-box">
	<h2>General Form Post Settings</h2>
	<div style="float: right; width: 45%;"><br>
		<b>Page Text</b><br>
		<textarea style="width:100%; padding: 8px;" rows="21" name="post-page-text"></textarea>

	</div>	
<div style="width: 45%; margin-right: 10%"><br>
	<div class='well'>
<?php 
            $ctype = SendPress_Option::get('post-page');
            ?>
<input type="radio" name="post-page" value="default" <?php 
            if ($ctype == 'default') {
                echo "checked='checked'";
            }
            ?>
 /> Use Default SendPress Page<br><br>
			<input type="radio" name="post-page" value="custom"  <?php 
            if ($ctype == 'custom') {
                echo "checked='checked'";
            }
            ?>
/> Redirect to <select name="post-page-id"> 
 <option value="">
 	<?php 
            $cpageid = SendPress_Option::get('post-page-id');
            echo esc_attr(__('Select page'));
            ?>
</option> 
 <?php 
            $pages = get_pages();
            foreach ($pages as $page) {
                $s = '';
                if ($cpageid == $page->ID) {
                    $s = "selected";
                }
                $option = '<option value="' . $page->ID . '" ' . $s . '>';
                $option .= $page->post_title;
                $option .= '</option>';
                echo $option;
            }
            ?>
</select>

</div>
</div>
	<br class="clear">
</div>
-->

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