Ejemplo n.º 1
0
 function widget_newsletter_control()
 {
     // Get our options and see if we're handling a form submission.
     $options = get_option('newsletter_widget');
     if (!is_array($options)) {
         $options = array('title' => 'Newsletter subscription');
         $options = array('text' => '');
     }
     if ($_POST['newsletter-submit']) {
         // Remember to sanitize and format use input appropriately.
         $options['title'] = strip_tags(stripslashes($_POST['newsletter-title']));
         $options['text'] = stripslashes($_POST['newsletter-text']);
         $options['form'] = stripslashes($_POST['newsletter-form']);
         update_option('newsletter_widget', $options);
     }
     // Be sure you format your options to be valid HTML attributes.
     $title = htmlspecialchars($options['title'], ENT_QUOTES);
     $text = htmlspecialchars($options['text'], ENT_QUOTES);
     $form = htmlspecialchars($options['form'], ENT_QUOTES);
     // Here is our little form segment. Notice that we don't need a
     // complete form. This will be embedded into the existing form.
     echo 'Title<br /><input id="newsletter-title" name="newsletter-title" type="text" value="' . $title . '" />';
     echo '<br /><br />';
     echo 'Introduction<br /><textarea style="width: 350px;" id="newsletter-text" name="newsletter-text">' . $text . '</textarea>';
     if (newsletter_has_extras('1.0.2')) {
         echo 'Form number<br /><input id="newsletter-form" name="newsletter-form" type="text" value="' . $form . '" />';
     }
     echo '<input type="hidden" id="newsletter-submit" name="newsletter-submit" value="1" />';
 }
Ejemplo n.º 2
0
	function form($instance) {
                $title = esc_attr($instance['title']);
                $text = esc_attr($instance['text']);
                $form = esc_attr($instance['form']);
                // Here is our little form segment. Notice that we don't need a
                // complete form. This will be embedded into the existing form.
                ?>
                <p>
                  <label for="<?php echo $this->get_field_id('title'); ?>">Title</label><br />
                  <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
                </p>
                <p>
                  <label for="<?php echo $this->get_field_id('text'); ?>">Introduction</label><br />
                  <textarea id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
                </p>
                <?php if (newsletter_has_extras('1.0.2')): ?>
                  <p>
                    <label for="<?php echo $this->get_field_id('form'); ?>">Form number</label><br />
                    <input id="<?php echo $this->get_field_id('form'); ?>" name="<?php echo $this->get_field_name('form'); ?>" type="text" value="<?php echo $form; ?>" />
                  </p>
                <?php endif; ?>
                <?php
	}
Ejemplo n.º 3
0
/**
 * Sends out an email (html or text). From email and name is retreived from
 * Newsletter plugin options. Return false on error. If the subject is empty
 * no email is sent out without warning.
 * The function uses wp_mail() to really send the message.
 */
function newsletter_mail($to, &$subject, &$message, $html = true)
{
    global $newsletter_mailer, $newsletter_options_main;
    if ($subject == '') {
        newsletter_debug(__FUNCTION__, 'Subject empty, skipped');
        return true;
    }
    if (newsletter_has_extras('1.0.4')) {
        return newsletter_extra_mail($to, &$subject, &$message, $html);
    }
    $options = get_option('newsletter');
    $headers = "MIME-Version: 1.0\n";
    if ($html) {
        $headers .= "Content-type: text/html; charset=UTF-8\n";
    } else {
        $headers .= "Content-type: text/plain; charset=UTF-8\n";
    }
    // Special character are manager by wp_mail()
    $headers .= 'From: "' . $options['from_name'] . '" <' . $options['from_email'] . ">\n";
    $r = wp_mail($to, $subject, $message, $headers);
    if (!$r) {
        newsletter_error(__FUNCTION__, "wp_mail() failed");
    }
    return $r;
}
Ejemplo n.º 4
0
<div class="wrap">

<h2>Statistics</h2>

<?php if (!newsletter_has_extras('1.0.3')) { ?>
    <strong>You need the <a href="http://www.satollo.net/plugins/newsletter/extras">Newsletter Extras</a> installed to view statistics</strong>
<?php } else { ?>
    <?php require_once ABSPATH . 'wp-content/plugins/newsletter-extras/emails.php'; ?>
<?php } ?>

</div>
Ejemplo n.º 5
0
<?php

@(include_once 'commons.php');
?>

<div class="wrap">

<h2><?php 
_e('Newsletter SMTP', 'newsletter');
?>
</h2>

<?php 
if (newsletter_has_extras('1.0.4')) {
    ?>
    <?php 
    require_once ABSPATH . 'wp-content/plugins/newsletter-extras/smtp.php';
} else {
    ?>
    <strong>You need <a href="http://www.satollo.net/plugins/newsletter-extras">Newsletter Extras 1.0.4+</a> installed to configure SMTP</strong>
<?php 
}
?>

</div>