コード例 #1
0
ファイル: users.php プロジェクト: ilke-zilci/newcomers-wp
 /**
  * @return NewsletterUsers
  */
 static function instance()
 {
     if (self::$instance == null) {
         self::$instance = new NewsletterUsers();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: index-old.php プロジェクト: taeche/SoDoEx
$options_main = get_option('newsletter_main');
$lists = array('' => 'Any');
for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
    if (empty($options_lists['list_' . $i])) {
        continue;
    }
    $lists['' . $i] = '(' . $i . ') ' . $options_lists['list_' . $i];
}
if ($controls->is_action('resend')) {
    $user = NewsletterUsers::instance()->get_user($controls->button_data);
    $opts = get_option('newsletter');
    $newsletter->mail($user->email, $newsletter->replace($opts['confirmation_subject'], $user), $newsletter->replace($opts['confirmation_message'], $user));
    $controls->messages = 'Activation email resent to ' . $user->email;
}
if ($controls->is_action('resend_welcome')) {
    $user = NewsletterUsers::instance()->get_user($controls->button_data);
    $opts = get_option('newsletter');
    $newsletter->mail($user->email, $newsletter->replace($opts['confirmed_subject'], $user), $newsletter->replace($opts['confirmed_message'], $user));
    $controls->messages = 'Welcome email resent.';
}
if ($controls->is_action('remove')) {
    $wpdb->query($wpdb->prepare("delete from " . $wpdb->prefix . "newsletter where id=%d", $controls->button_data));
    unset($controls->data['subscriber_id']);
}
if ($action == 'status') {
    newsletter_set_status($controls->data['subscriber_id'], $controls->data['subscriber_status']);
}
if ($controls->is_action('search')) {
    if (empty($controls->data['search_order'])) {
        $order = 'email';
    }
コード例 #3
0
ファイル: new.php プロジェクト: chicosilva/olharambiental
<?php

require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterUsers::instance();
if ($controls->is_action('save')) {
    $controls->data['status'] = 'C';
    $controls->data['sex'] = 'n';
    $user = $module->save_user($controls->data);
    if ($user === false) {
        $controls->errors = 'This email already exists.';
    } else {
        $controls->js_redirect($module->get_admin_page_url('edit') . '&id=' . $user->id);
        return;
    }
}
?>
<div class="wrap">
    <?php 
$help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module';
?>
    <?php 
include NEWSLETTER_DIR . '/header-new.php';
?>
    <div id="newsletter-title">
    <?php 
include NEWSLETTER_DIR . '/users/menu.inc.php';
?>

    <h2>New subscriber</h2>
</div>
コード例 #4
0
ファイル: plugin.php プロジェクト: blocher/oneholyname
function newsletter_activate()
{
    Newsletter::instance()->upgrade();
    NewsletterUsers::instance()->upgrade();
    NewsletterEmails::instance()->upgrade();
    NewsletterSubscription::instance()->upgrade();
    NewsletterStatistics::instance()->upgrade();
}
コード例 #5
0
ファイル: import.php プロジェクト: lenguyenitc/donations
                for ($i = 1; $i < NEWSLETTER_LIST_MAX; $i++) {
                    $subscriber['list_' . $i] = 0;
                }
                foreach ($controls->data['preferences'] as $i) {
                    $subscriber['list_' . $i] = 1;
                }
            }
            if ($mode == 'update') {
                $subscriber['name'] = $newsletter->normalize_name($data[1]);
                $subscriber['surname'] = $newsletter->normalize_name($data[2]);
                $subscriber['status'] = $controls->data['import_as'];
                foreach ($controls->data['preferences'] as $i) {
                    $subscriber['list_' . $i] = 1;
                }
            }
            NewsletterUsers::instance()->save_user($subscriber);
            $results .= '[UPDATED] ' . $line . "\n";
            $updated_count++;
        }
    }
    if ($error_count) {
        $controls->errors = "Import completed but with errors.";
    }
    $controls->messages = "Import completed: {$error_count} errors, {$added_count} added, {$updated_count} updated, {$skipped_count} skipped.";
}
?>

<div class="wrap">
    <?php 
$help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module';
?>
コード例 #6
0
ファイル: edit.php プロジェクト: taeche/SoDoEx
    $email['status'] = 'paused';
}
if ($controls->is_action('continue')) {
    $wpdb->update(NEWSLETTER_EMAILS_TABLE, array('status' => 'sending'), array('id' => $email_id));
    $email['status'] = 'sending';
}
if ($controls->is_action('abort')) {
    $wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set last_id=0, total=0, sent=0, status='new' where id=" . $email_id);
    $email['status'] = 'new';
    $email['total'] = 0;
    $email['sent'] = 0;
    $email['last_id'] = 0;
    $controls->messages = "Sending aborted.";
}
if ($controls->is_action('test')) {
    $users = NewsletterUsers::instance()->get_test_users();
    if (count($users) == 0) {
        $controls->errors = 'There are no test subscribers. Read more about test subscribers <a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
    } else {
        Newsletter::instance()->send(Newsletter::instance()->get_email($email_id), $users);
        $controls->messages .= 'Test emails sent to ' . count($users) . ' test subscribers. Read more about test subscribers <a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
    }
    $controls->messages .= '<br>If diagnostic emails are delivered but test emails are not, try to change the encoding to "base 64" on main configuration panel';
}
if ($email['editor'] == 0) {
    $x = strpos($controls->data['message'], '<body');
    // Some time the message in $nc->data is already cleaned up, it depends on action called
    if ($x !== false) {
        $x = strpos($controls->data['message'], '>', $x);
        $y = strpos($controls->data['message'], '</body>');
        $controls->data['message'] = substr($controls->data['message'], $x + 1, $y - $x - 1);
コード例 #7
0
ファイル: controls.php プロジェクト: lenguyenitc/donations
 /**
  * @deprecated
  */
 function get_test_subscribers()
 {
     return NewsletterUsers::instance()->get_test_users();
 }
コード例 #8
0
            $results .= '[INVALID] ' . $email . "\n";
            $error++;
            continue;
        }
        $user = NewsletterUsers::instance()->get_user($email);
        if ($user == null) {
            $results .= '[NOT FOUND] ' . $email . "\n";
            $not_found++;
            continue;
        }
        if ($user->status == 'B') {
            $results .= '[ALREADY BOUNCED] ' . $email . "\n";
            $already_bounced++;
            continue;
        }
        $r = NewsletterUsers::instance()->set_user_status($email, 'B');
        if ($r === 0) {
            $results .= '[BOUNCED] ' . $email . "\n";
            $marked++;
            continue;
        }
    }
    $controls->messages .= 'Total: ' . $total . '<br>';
    $controls->messages .= 'Bounce: ' . $marked . '<br>';
    $controls->messages .= 'Errors: ' . $error . '<br>';
    $controls->messages .= 'Not found: ' . $not_found . '<br>';
    $controls->messages .= 'Already bounced: ' . $already_bounced . '<br>';
}
?>

<div class="wrap" id="tnp-wrap">
コード例 #9
0
    update_option('newsletter_dismissed', array());
    $controls->messages = 'Notices restored.';
}
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)");
    }
コード例 #10
0
ファイル: csv.php プロジェクト: imeuro/escapelifestyle
<?php

require_once '../../../../wordpress/wp-load.php';
$newsletter = Newsletter::instance();
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
// TODO: Check the user capabilities
if (current_user_can('manage_options') || $newsletter->options['editor'] == 1 && current_user_can('manage_categories')) {
    $controls = new NewsletterControls();
    if ($controls->is_action('export')) {
        NewsletterUsers::instance()->export($controls->data);
    }
} else {
    die('Not allowed.');
}
コード例 #11
0
ファイル: csv.php プロジェクト: manhhung86it/builder-site
<?php

global $newsletter;
require_once '../../../../wp-load.php';
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
// TODO: Check the user capabilities
if (current_user_can('manage_options') || $newsletter->options['editor'] == 1 && current_user_can('manage_categories')) {
    $controls = new NewsletterControls();
    if ($controls->is_action('export')) {
        NewsletterUsers::instance()->export();
    }
} else {
    die('Not allowed.');
}
コード例 #12
0
ファイル: change.php プロジェクト: ilke-zilci/newcomers-wp
            die('Invalid sex value');
        }
        NewsletterUsers::instance()->set_user_field($user->id, 'sex', $value);
        break;
        // Should be managed by Feed by Mail
    // Should be managed by Feed by Mail
    case 'feed':
        if (isset($value) && ($value === '0' || $value === '1')) {
            NewsletterUsers::instance()->set_user_field($user->id, 'feed', $value);
        } else {
            die('Invalid feed value');
        }
        break;
}
if (strpos($field, 'preference_') === 0) {
    $idx = (int) substr($field, 11);
    $options_profile = get_option('newsletter_profile');
    if ($options_profile['list_' . $idx . '_status'] == 0) {
        die('Not allowed field.');
    }
    if (isset($value) && ($value === '0' || $value === '1')) {
        NewsletterUsers::instance()->set_user_field($user->id, 'list_' . $idx, $value);
    } else {
        die('Invalid preference value');
    }
}
if (isset($url)) {
    header("Location: {$url}");
} else {
    NewsletterSubscription::instance()->show_message('profile', $user, NewsletterSubscription::instance()->options['profile_saved']);
}