示例#1
0
 /**
  * @return NewsletterEmails
  */
 static function instance()
 {
     if (self::$instance == null) {
         self::$instance = new NewsletterEmails();
     }
     return self::$instance;
 }
示例#2
0
文件: theme.php 项目: jekv/devia
<?php

require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterEmails::instance();
if ($controls->is_action('theme')) {
    $controls->merge($module->themes->get_options($controls->data['theme']));
    $module->save_options($controls->data);
}
if ($controls->data == null) {
    $controls->data = $module->get_options();
}
function newsletter_emails_update_options($options)
{
    add_option('newsletter_emails', '', null, 'no');
    update_option('newsletter_emails', $options);
}
function newsletter_emails_update_theme_options($theme, $options)
{
    $x = strrpos($theme, '/');
    if ($x !== false) {
        $theme = substr($theme, $x + 1);
    }
    add_option('newsletter_emails_' . $theme, '', null, 'no');
    update_option('newsletter_emails_' . $theme, $options);
}
function newsletter_emails_get_options()
{
    $options = get_option('newsletter_emails', array());
    return $options;
}
示例#3
0
function newsletter_activate()
{
    Newsletter::instance()->upgrade();
    NewsletterUsers::instance()->upgrade();
    NewsletterEmails::instance()->upgrade();
    NewsletterSubscription::instance()->upgrade();
    NewsletterStatistics::instance()->upgrade();
}
示例#4
0
<?php

include '../../../../wp-load.php';
if (!check_admin_referer('view')) {
    die('Only the administrator can view the preview');
}
// Used by theme code
$theme_options = NewsletterEmails::instance()->get_current_theme_options();
$theme_url = NewsletterEmails::instance()->get_current_theme_url();
header('Content-Type: text/html;charset=UTF-8');
include NewsletterEmails::instance()->get_current_theme_file_path('theme.php');
示例#5
0
}
if ($controls->is_action('trigger_followup')) {
    NewsletterFollowup::instance()->send();
    $controls->messages = 'Follow up delivery engine triggered.';
}
if ($controls->is_action('engine_on')) {
    wp_clear_scheduled_hook('newsletter');
    wp_schedule_event(time() + 30, 'newsletter', 'newsletter');
    $controls->messages = 'Delivery engine reactivated.';
}
if ($controls->is_action('upgrade')) {
    // TODO: Compact them in a call to Newsletter which should be able to manage the installed modules
    Newsletter::instance()->upgrade();
    NewsletterUsers::instance()->upgrade();
    NewsletterSubscription::instance()->upgrade();
    NewsletterEmails::instance()->upgrade();
    NewsletterStatistics::instance()->upgrade();
    if (method_exists('NewsletterFollowup', 'upgrade')) {
        NewsletterFollowup::instance()->upgrade();
    }
    $controls->messages = 'Upgrade forced!';
}
if ($controls->is_action('upgrade_old')) {
    $row = $wpdb->get_row("select * from " . NEWSLETTER_USERS_TABLE . " limit 1");
    if (!isset($row->id)) {
        $row = $wpdb->query("alter table " . NEWSLETTER_USERS_TABLE . " drop primary key");
        $row = $wpdb->query("alter table " . NEWSLETTER_USERS_TABLE . " add column id int not null auto_increment primary key");
        $row = $wpdb->query("alter table " . NEWSLETTER_USERS_TABLE . " add unique email (email)");
    }
    $controls->messages = 'Done.';
}
示例#6
0
<div class="wrap">

    <?php 
//$help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter/newsletters-module';
?>
    <?php 
//include NEWSLETTER_DIR . '/header-new.php';
?>

    <div id="newsletter-title">
        <h2><?php 
_e('Create a newsletter', 'newsletter-emails');
?>
            <a class="add-new-h2" href="<?php 
echo NewsletterEmails::instance()->get_admin_page_url('theme');
?>
"><?php 
_e('Back to newsletter themes', 'newsletter-emails');
?>
</a>
        </h2>
    </div>
    <div class="newsletter-separator"></div>

    <?php 
$controls->show();
?>

    <form method="post" action="<?php 
echo $module->get_admin_page_url('new');