Exemplo n.º 1
0
function sendit_single_ajax_content()
{
    $response = '';
    $post_id = $_POST['post_id'];
    $post = get_post($post_id);
    if ($_POST['content_type'] == 'post') {
        $response .= '<div class="title">';
        $response .= '<h2><a href="' . get_permalink($post_id) . '">' . apply_filters('the_title', $post->post_title) . '</a></h2>';
        $response .= '</div>';
        $response .= '<div class="body-text">';
        $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail');
        $url = $thumb['0'];
        $thumb_url = wp_get_attachment_url('thumbnail', true);
        $response .= '<a href="' . get_permalink($post_id) . '"><img src="' . $url . '" class="img-responsive alignleft" alt="' . apply_filters('the_title', $post->post_title) . '" /></a>';
        $response .= $post->post_content;
        $response .= '</div>';
    } else {
        $css = get_post_meta($post->ID, 'newsletter_css', TRUE);
        $header = '<!-- [template_id=' . $post->ID . '] -->';
        $header .= get_post_meta($post->ID, 'headerhtml', TRUE);
        //parse header shortcode...
        $header = str_replace('[style]', '<style>' . $css . '</style>', $header);
        //logo
        if (has_post_thumbnail($post->ID)) {
            $header_image = get_the_post_thumbnail($post->ID);
        } else {
            $header_image = '<img alt="" src="http://placehold.it/300x50/" />';
        }
        $header = str_replace('[logo]', $header_image, $header);
        $header = str_replace('[homeurl]', get_bloginfo('siteurl'), $header);
        $footer = get_post_meta($post->ID, 'footerhtml', TRUE);
        //build template scaffold
        $response .= $header;
        $response .= '<h2>' . __('Good Luck!', 'sendit') . '</h2>';
        $response .= '<p>' . __(' Start from here to edit your content') . '</p>';
        $response .= $footer;
    }
    if (is_plugin_active('sendit-css-inliner/sendit-pro-css-inliner.php')) {
        $response = inline_newsletter($css, $response);
    }
    $response = preg_replace('/(&Acirc;|&nbsp;)+/i', ' ', $response);
    echo $response;
    die(1);
}
Exemplo n.º 2
0
     		
     		<p><img alt="" src="http://placehold.it/200x200/" title="test" class="alignleft size-thumbnail wp-image-15">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p><div class="sendit_readmore"><a class="sendit_more_button">Read More</a></div><hr />
     		
     		
     			  		<h3><a href="#">Article 2</a></h3>

     		     		<p><img alt="" src="http://placehold.it/200x200/" title="test" class="alignleft size-thumbnail wp-image-15">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p><div class="sendit_readmore"><a class="sendit_more_button">Read More</a></div><hr />';
        if (function_exists('inline_newsletter')) {
            ?>
		
     		<div class="info">This preview is generated and parsed by Sendit Pro Inliner tool with all styles converted into inline.</div>
     	<?php 
        } else {
            ?>
     		<div class="warning"><h4>Buy Sendit Pro auto inliner tool</h4>
     		<p>Sendit Pro auto inliner tool will parse the HTML and convert all styles into inline styles.</p>
     		</div>     	
     	<?php 
        }
        ?>
	
		<?php 
        $template_content = $header . $dummy_content . $footer;
        //verify if inliner is installed
        if (function_exists('inline_newsletter')) {
            $template_content = inline_newsletter($css, $template_content);
        }
        echo $template_content;
    }
}
wp_footer();
Exemplo n.º 3
0
function send_newsletter($post_ID)
{
    $sendit = new Actions();
    $article = get_post($post_ID);
    $send_now = get_post_meta($post_ID, 'send_now', true);
    $sendit_list = get_post_meta($post_ID, 'sendit_list', true);
    $table_liste = SENDIT_LIST_TABLE;
    $list_detail = $sendit->GetListDetail($sendit_list);
    $subscribers = $sendit->GetSubscribers($sendit_list);
    //only confirmed
    $css = '';
    /*+++++++++++++++++++ TEMPLATE pro EMAIL +++++++++++++++++++++++++++++++++++++++++*/
    //to do: templatizer, if exixts get the template from template_id
    $header = $list_detail->header;
    $footer = $list_detail->footer;
    $css = '';
    include_once ABSPATH . 'wp-admin/includes/plugin.php';
    if (is_plugin_active('sendit-pro-template-manager/sendit-pro-template-manager.php')) {
        //custom post type template
        $template_id = get_post_meta($post_ID, 'template_id', true);
        $template = get_post($template_id);
        $title = $newsletter->post_title;
        //echo 'template id '.$template_id;
        $header = get_post_meta($template_id, 'headerhtml', true);
        $header = str_replace('[style]', '<style>' . $css . '</style>', $header);
        if (has_post_thumbnail($template_id)) {
            $header_image = get_the_post_thumbnail($template_id);
        } else {
            $header_image = '<img alt="" src="http://placehold.it/300x50/" />';
        }
        $header = str_replace('[logo]', $header_image, $header);
        $header = str_replace('[homeurl]', get_bloginfo('siteurl'), $header);
        $footer = get_post_meta($template_id, 'footerhtml', true);
        $content = apply_filters('the_content', $newsletter->post_content);
    }
    $email_from = $list_detail->email_lista;
    /*+++++++++++++++++++ HEADERS EMAIL +++++++++++++++++++++++++++++++++++++++++*/
    $email = $email_from;
    $headers = "MIME-Version: 1.0\n" . "From: " . $email . " <" . $email . ">\n" . "Content-Type: text/html; charset=\"" . get_option('blog_charset') . "\"\n";
    /*+++++++++++++++++++ CONTENT EMAIL +++++++++++++++++++++++++++++++++++++++++*/
    $title = $article->post_title;
    //$content = apply_filters('the_content',$article->post_content);
    $content = apply_filters('the_content', $article->post_content);
    //$newsletter_content=$header.$content.$footer;
    //new 2.1.2 content is already with footer and header
    $newsletter_content = $content;
    //CSS get template id comment tag parse and extract css.... v 2.2.2
    $get_template_id = getStylesheet($newsletter_content);
    $css_id = $get_template_id[1][0];
    $css = get_post_meta($css_id, 'newsletter_css', true);
    $readonline = get_permalink($post_ID);
    if ($send_now == 1) {
        foreach ($subscribers as $subscriber) {
            if (get_option('sendit_unsubscribe_link') == 'yes') {
                //aggiungo messaggio con il link di cancelazione che cicla il magic_string..
                $delete_link = "\n\t\t\t\t<center>\n\t \t\t\t-------------------------------------------------------------------------------\n\t\t\t\t<p>" . __('To unsubscribe, please click on the link below', 'sendit') . "<br />\n\t\t\t\t<a href=\"" . get_bloginfo('siteurl') . '/' . "?action=unsubscribe&c=" . $subscriber->magic_string . "\">" . __('Unsubscribe now', 'sendit') . "</a></p>\n\t\t\t\t</center>";
            } else {
                $delete_link = '';
            }
            //send the newsletter!
            //verify if inliner is installed
            if (is_plugin_active('sendit-css-inliner/sendit-pro-css-inliner.php')) {
                $newsletter_content = inline_newsletter($css, $newsletter_content);
                $response = preg_replace('/(&Acirc;|&nbsp;)+/i', ' ', $response);
            }
            if (is_plugin_active('sendit-pro-analytics-campaign/sendit-pro-analytics-campaign.php')) {
                $newsletter_content = AppendCampaignToString($newsletter_content);
            }
            wp_mail($subscriber->email, $title, $newsletter_content . $delete_link, $headers, $attachments);
        }
        //set to 5 status : sent with classic plugin
        update_post_meta($post_ID, 'send_now', '5');
    }
}
Exemplo n.º 4
0
                $header_image = get_the_post_thumbnail($template_id);
            } else {
                $header_image = '<img alt="" src="http://placehold.it/300x50/" />';
            }
            $header = str_replace('[logo]', $header_image, $header);
            $header = str_replace('[homeurl]', get_bloginfo('siteurl'), $header);
            $footer = get_post_meta($template_id, 'footerhtml', TRUE);
        }
        //plugin is active
        //$newsletter_content=$header.get_the_content().$footer;
        $newsletter_content = get_the_content();
        //CSS get template id comment tag parse and extract css....
        $get_template_id = getStylesheet($newsletter_content);
        $css_id = $get_template_id[1][0];
        $css = get_post_meta($css_id, 'newsletter_css', true);
        //verify if inliner is installed
        if (function_exists('inline_newsletter')) {
            $newsletter_content = inline_newsletter($css, $newsletter_content);
        }
        //verify if analytics is installed
        if (function_exists('AppendCampaignToString')) {
            echo AppendCampaignToString($newsletter_content);
        }
    }
} else {
    ?>
     <!-- Stuff to do if there are no posts-->
	<h2>No Newsletter</h2>
<?php 
}
wp_footer();