本文整理汇总了PHP中NewsletterUsers::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsletterUsers::instance方法的具体用法?PHP NewsletterUsers::instance怎么用?PHP NewsletterUsers::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsletterUsers
的用法示例。
在下文中一共展示了NewsletterUsers::instance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instance
/**
* @return NewsletterUsers
*/
static function instance()
{
if (self::$instance == null) {
self::$instance = new NewsletterUsers();
}
return self::$instance;
}
示例2: get_option
$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: NewsletterControls
<?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: newsletter_activate
function newsletter_activate()
{
Newsletter::instance()->upgrade();
NewsletterUsers::instance()->upgrade();
NewsletterEmails::instance()->upgrade();
NewsletterSubscription::instance()->upgrade();
NewsletterStatistics::instance()->upgrade();
}
示例5: foreach
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: array
$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: get_test_subscribers
/**
* @deprecated
*/
function get_test_subscribers()
{
return NewsletterUsers::instance()->get_test_users();
}
示例8:
$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: update_option
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: NewsletterControls
<?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: NewsletterControls
<?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: die
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']);
}