本文整理汇总了PHP中NewsletterControls类的典型用法代码示例。如果您正苦于以下问题:PHP NewsletterControls类的具体用法?PHP NewsletterControls怎么用?PHP NewsletterControls使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NewsletterControls类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: NewsletterControls
<?php
@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
$module = NewsletterSubscription::instance();
// TODO: Remove and use the $module->options.
$options = get_option('newsletter', array());
if ($controls->is_action()) {
if ($controls->is_action('save')) {
$defaults = $module->get_default_options();
if (empty($controls->data['profile_text'])) {
$controls->data['profile_text'] = $defaults['profile_text'];
}
// Without the last curly bracket since there can be a form number apended
if (empty($controls->data['subscription_text'])) {
$controls->data['subscription_text'] = $defaults['subscription_text'];
}
if (empty($controls->data['confirmation_text'])) {
$controls->data['confirmation_text'] = $defaults['confirmation_text'];
}
if (empty($controls->data['confirmation_subject'])) {
$controls->data['confirmation_subject'] = $defaults['confirmation_subject'];
}
if (empty($controls->data['confirmation_message'])) {
$controls->data['confirmation_message'] = $defaults['confirmation_message'];
}
if (empty($controls->data['confirmed_text'])) {
$controls->data['confirmed_text'] = $defaults['confirmed_text'];
}
if (empty($controls->data['confirmed_subject'])) {
$controls->data['confirmed_subject'] = $defaults['confirmed_subject'];
示例2: NewsletterControls
<?php
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterUsers::instance();
$options = stripslashes_deep($_POST['options']);
$options_lists = get_option('newsletter_profile');
$options_profile = get_option('newsletter_profile');
$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']);
示例3: NewsletterControls
<?php
@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
if ($controls->is_action('feed_enable')) {
delete_option('newsletter_feed_demo_disable');
$controls->messages = 'Feed by Mail demo panels enabled. On next page reload it will show up.';
}
if ($controls->is_action('feed_disable')) {
update_option('newsletter_feed_demo_disable', 1);
$controls->messages = 'Feed by Mail demo panel disabled. On next page reload it will disappear.';
}
?>
<div class="wrap main-index">
<?php
$help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter';
?>
<?php
include NEWSLETTER_DIR . '/header-new.php';
?>
<div id="newsletter-title">
<h2>Welcome and Support</h2>
<p>
With my horrible English, everything can be found starting from <a href="http://www.thenewsletterplugin.com/plugins/newsletter" target="_blank">Newsletter Official page</a>
and every configuration panel has some included documentation just to avoid the most common mistakes.
</p>
</div>
<div class="newsletter-separator"></div>
示例4: load_plugin_textdomain
<?php
if (function_exists('load_plugin_textdomain')) {
load_plugin_textdomain('newsletter-statistics', false, 'newsletter/statistics/languages');
load_plugin_textdomain('newsletter', false, 'newsletter/languages');
}
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$module = NewsletterStatistics::instance();
$controls = new NewsletterControls();
$emails = Newsletter::instance()->get_emails();
if (!$controls->is_action()) {
$controls->data = $module->options;
}
if ($controls->is_action('save')) {
$module->save_options($controls->data);
$controls->messages = 'Saved.';
}
?>
<div class="wrap">
<?php
$help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter/statistics-module';
?>
<?php
include NEWSLETTER_DIR . '/header-new.php';
?>
<div id="newsletter-title">
<h2>Configuration and Email List</h2>
示例5: 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>
示例6: NewsletterControls
<?php
@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
$module = NewsletterSubscription::instance();
if (!$controls->is_action()) {
$controls->data = $module->get_options('profile');
} else {
if ($controls->is_action('save')) {
$module->merge_options($controls->data, 'profile');
$controls->add_message_saved();
}
}
$status = array(0 => 'Disabled/Private use', 1 => 'Only on profile page', 2 => 'Even on subscription forms', '3' => 'Hidden');
?>
<div class="wrap" id="tnp-wrap">
<?php
include NEWSLETTER_DIR . '/tnp-header.php';
?>
<div id="tnp-heading">
<h2><?php
_e('Lists', 'newsletter');
?>
</h2>
<p>
Preferences are on/off choices users can select during subscription and change on their profile.
示例7: NewsletterControls
<?php
@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
$module = NewsletterSubscription::instance();
if (!$controls->is_action()) {
$controls->data = get_option('newsletter_forms');
}
if ($controls->is_action('save')) {
update_option('newsletter_forms', $controls->data);
$controls->add_message_saved();
}
?>
<div class="wrap" id="tnp-wrap">
<?php
include NEWSLETTER_DIR . '/tnp-header.php';
?>
<div id="tnp-heading">
<h2><?php
_e('Custom Forms', 'newsletter');
?>
</h2>
<p>
Here you can store your hand coded forms to recall them from short codes.
<a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-forms" target="_blank">Read more about forms</a>.
</p>
示例8: NewsletterControls
<?php
@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$module = Newsletter::instance();
$controls = new NewsletterControls();
if (!$controls->is_action()) {
$controls->data = $module->get_options('smtp');
} else {
if ($controls->is_action('save')) {
if ($controls->data['enabled'] && empty($controls->data['host'])) {
$controls->errors = 'The host must be set to enable the SMTP';
}
if (empty($controls->errors)) {
$module->save_options($controls->data, 'smtp');
$controls->messages .= __('Saved. Remember to test your changes right now!', 'newsletter');
}
}
if ($controls->is_action('test')) {
require_once ABSPATH . WPINC . '/class-phpmailer.php';
require_once ABSPATH . WPINC . '/class-smtp.php';
$mail = new PHPMailer();
ob_start();
$mail->IsSMTP();
$mail->SMTPDebug = true;
$mail->CharSet = 'UTF-8';
$message = 'This Email is sent by PHPMailer of WordPress';
$mail->IsHTML(false);
$mail->Body = $message;
$mail->From = $module->options['sender_email'];
$mail->FromName = $module->options['sender_name'];
if (!empty($module->options['return_path'])) {
示例9: stripslashes_deep
if ($action == 'save') {
$options = stripslashes_deep($_POST['options']);
$options['confirmed_url'] = trim($options['confirmed_url']);
if ($errors == null) {
update_option('newsletter', $options);
}
}
if ($action == 'reset') {
@(include_once dirname(__FILE__) . '/languages/en_US_options.php');
if (WPLANG != '') {
@(include_once dirname(__FILE__) . '/languages/' . WPLANG . '_options.php');
}
$options = array_merge($options, $newsletter_default_options);
update_option('newsletter', $options);
}
$nc = new NewsletterControls($options);
?>
<?php
if ($options['novisual'] != 1) {
?>
<script type="text/javascript" src="<?php
echo get_option('siteurl');
?>
/wp-content/plugins/newsletter/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "specific_textareas",
editor_selector : "visual",
theme : "advanced",
示例10: NewsletterControls
<?php
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterUsers::instance();
$options = $controls->data;
$options_lists = get_option('newsletter_profile');
$options_profile = get_option('newsletter_profile');
$options_main = get_option('newsletter_main');
// Move to base zero
if ($controls->is_action()) {
$controls->data['search_page'] = (int) $controls->data['search_page'] - 1;
$module->save_options($controls->data, 'search');
} else {
$controls->data = $module->get_options('search');
if (empty($controls->data['search_page'])) {
$controls->data['search_page'] = 0;
}
}
$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');
NewsletterSubscription::instance()->mail($user->email, $newsletter->replace($opts['confirmation_subject'], $user), $newsletter->replace($opts['confirmation_message'], $user));
$controls->messages = 'Activation email resent to ' . $user->email;
示例11: NewsletterControls
<?php
@(include_once 'commons.php');
$nc = new NewsletterControls();
$emails = $wpdb->get_results("select * from " . $wpdb->prefix . "newsletter_emails where type='email' order by id desc");
if ($nc->is_action('send')) {
$newsletter->hook_newsletter();
}
?>
<div class="wrap">
<h2>Messages</h2>
<?php
include dirname(__FILE__) . '/header.php';
?>
<form method="post" action="admin.php?page=newsletter/emails.php">
<?php
$nc->init();
?>
<p><a href="admin.php?page=newsletter/emails-edit.php&id=0" class="button">New message</a></p>
<p>
Delivery engine next run: <?php
echo wp_next_scheduled('newsletter') - time();
?>
seconds
<?php
$nc->button('send', 'Trigger now');
示例12: NewsletterControls
<?php
@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
$module = NewsletterSubscription::instance();
if (!$controls->is_action()) {
$controls->data = $module->get_options('template');
} else {
if ($controls->is_action('save')) {
$module->save_options($controls->data, 'template');
if (strpos($controls->data['template'], '{message}') === false) {
$controls->errors = 'Warning: the tag {message} is missing in your template';
}
$controls->messages = 'Saved.';
}
if ($controls->is_action('reset')) {
$controls->data['template'] = file_get_contents(dirname(__FILE__) . '/email.html');
$controls->messages = 'Done.';
}
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 {
$template = $controls->data['template'];
if (strpos($template, '{message}') === false) {
$template .= '{message}';
}
$message = '<p>This is a generic example of message embedded inside the template.</p>';
$message .= '<p>Subscriber data can be referenced by messages with tags. See the <a href="http://www.thenewsletterplugin.com">plugin documentation</a>.</p>';
$message .= '<p>First name: {name}</p>';
示例13: NewsletterControls
<?php
@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
if ($controls->is_action('save')) {
update_option('newsletter_log_level', $controls->data['log_level']);
update_option('newsletter_diagnostic', $controls->data);
$controls->messages = 'Loggin levels saved.';
}
if ($controls->is_action('reset_cron_calls')) {
update_option($module->prefix . '_cron_calls', false);
$controls->messages = 'Reset.';
}
if ($controls->is_action('check-versions')) {
$newsletter->hook_newsletter_extension_versions(true);
$controls->messages = 'Extensions data updated. Go to the plugins panel to see if there are updates available.';
}
if ($controls->is_action('trigger')) {
$newsletter->hook_newsletter();
$controls->messages = 'Delivery engine triggered.';
}
if ($controls->is_action('undismiss')) {
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');
示例14: NewsletterControls
<?php
/* @var $wpdb wpdb */
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterEmails::instance();
// Always required
$email = Newsletter::instance()->get_email((int) $_GET['id'], ARRAY_A);
if (empty($email)) {
echo 'Wrong email identifier';
return;
}
$email_id = $email['id'];
// If there is no action we assume we are enter the first time so we populate the
// $nc->data with the editable email fields
if (!$controls->is_action()) {
$controls->data = $email;
if (!empty($email['preferences'])) {
$controls->data['preferences'] = explode(',', $email['preferences']);
}
if (!empty($email['sex'])) {
$controls->data['sex'] = explode(',', $email['sex']);
}
$email_options = unserialize($email['options']);
if (is_array($email_options)) {
$controls->data = array_merge($controls->data, $email_options);
}
}
if ($controls->is_action('test') || $controls->is_action('save') || $controls->is_action('send') || $controls->is_action('editor')) {
// If we were editing with visual editor (==0), we must read the extra <body> content
if ($email['editor'] == 0) {
示例15: die
<?php
// Stops WP Super Cache which removes the logged_in cookie
$_GET['preview'] = 'true';
require_once '../../../../wp-load.php';
if (!is_user_logged_in()) {
die('No logged in user found. A plugin is almost surely removing the authentication cookies, usually a cache plugin. Try to report the issue on http://www.thenewsletterplugin.com forum.');
}
if (!current_user_can('manage_categories')) {
die('Not enough privileges');
}
if (Newsletter::instance()->options['editor'] != 1 && !current_user_can('manage_options')) {
die('Not enough privileges');
}
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterEmails::instance();
if ($controls->is_action('create')) {
$module->save_options($controls->data);
$email = array();
$email['status'] = 'new';
$email['subject'] = '';
//__('Here the email subject', 'newsletter-emails');
$email['track'] = 1;
$theme_options = $module->get_current_theme_options();
$theme_url = $module->get_current_theme_url();
$theme_subject = '';
ob_start();
include $module->get_current_theme_file_path('theme.php');
$email['message'] = ob_get_clean();
if (!empty($theme_subject)) {