本文整理汇总了PHP中NewsletterControls::is_action方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsletterControls::is_action方法的具体用法?PHP NewsletterControls::is_action怎么用?PHP NewsletterControls::is_action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsletterControls
的用法示例。
在下文中一共展示了NewsletterControls::is_action方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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>
示例2: dirname
<?php
require_once dirname(__FILE__) . '/controls.php';
$module = NewsletterGrabber::$instance;
$controls = new NewsletterControls();
if (!$controls->is_action()) {
$controls->data = $module->options;
} else {
if ($controls->is_action('save')) {
$module->save_options($controls->data);
$controls->messages = 'Saved.';
}
if ($controls->is_action('refresh')) {
}
if ($controls->is_action('empty')) {
update_option($module->prefix . '_record', array());
}
}
?>
<div class="wrap">
<h2>Newsletter Grabber Extension</h2>
<?php
$controls->show();
?>
<p>
示例3: NewsletterControls
<?php
@(include_once 'commons.php');
$nc = new NewsletterControls();
if (isset($_GET['id'])) {
$nc->load($wpdb->prefix . 'newsletter_emails', $_GET['id']);
if (empty($nc->data['id'])) {
$nc->data['status'] = 'new';
$nc->data['subject'] = 'Here the email subject';
$nc->data['message'] = '<p>An empty email to start.</p>';
$nc->data['theme'] = 'blank';
}
} else {
if ($nc->is_action('save') || $nc->is_action('send')) {
$nc->save($wpdb->prefix . 'newsletter_emails');
}
if ($nc->is_action('send')) {
// Fake value representing the WordPress users as target
if ($nc->data['list'] == -1) {
$query = "select count(*) from " . $wpdb->prefix . "users " . $nc->data['query'];
} else {
if (!empty($nc->data['query'])) {
$query = "select count(*) from " . $wpdb->prefix . "newsletter " . $nc->data['query'];
} else {
$query = "select count(*) from " . $wpdb->prefix . "newsletter where status='C'";
if ($nc->data['list'] != 0) {
$query .= " and list_" . $nc->data['list'] . "=1";
}
if (!empty($nc->data['sex'])) {
$query .= " and sex='" . $nc->data['sex'] . "'";
}
示例4: NewsletterControls
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']);
}
示例5: NewsletterControls
<?php
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterEmails::instance();
// Always required
$email_id = $_GET['id'];
$email = Newsletter::instance()->get_email($email_id, ARRAY_A);
// 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) {
$x = strpos($email['message'], '<body');
if ($x !== false) {
$x = strpos($email['message'], '>', $x);
$email['message'] = substr($email['message'], 0, $x + 1) . $controls->data['message'] . '</body></html>';
} else {
示例6: die
// 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)) {
$email['subject'] = $theme_subject;
}
示例7: NewsletterControls
<?php
if (function_exists('load_plugin_textdomain')) {
load_plugin_textdomain('newsletter-emails', false, 'newsletter/emails/languages');
load_plugin_textdomain('newsletter', false, 'newsletter/languages');
}
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 this theme has no intermediate options...
if (!file_exists($module->get_current_theme_file_path('theme-options.php'))) {
$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)) {
$email['subject'] = $theme_subject;
}
ob_start();
include $module->get_current_theme_file_path('theme-text.php');
$email['message_text'] = ob_get_clean();
$email['type'] = 'message';
示例8: NewsletterControls
<?php
@(include_once 'commons.php');
$nc = new NewsletterControls();
if (isset($_GET['id'])) {
$nc->load($wpdb->prefix . 'newsletter', $_GET['id']);
if (empty($nc->data['id'])) {
$nc->data['status'] = 'C';
$nc->data['token'] = md5(rand());
}
} else {
if ($nc->is_action('save')) {
for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
if (!isset($nc->data['list_' . $i])) {
$nc->data['list_' . $i] = 0;
}
}
$nc->save($wpdb->prefix . 'newsletter');
}
}
$nc->errors($errors);
$nc->messages($messages);
$options_profile = get_option('newsletter_profile');
?>
<div class="wrap">
<h2>Newsletter Subscriber Editing</h2>
<p><a href="admin.php?page=newsletter/users.php">Back to the list</a></p>
<form method="post" action="admin.php?page=newsletter/users-edit.php">
<?php
$nc->init();
?>
示例9: 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.');
}
示例10: dirname
<?php
require_once dirname(__FILE__) . '/controls.php';
$module = NewsletterMandrill::$instance;
$controls = new NewsletterControls();
if (!$controls->is_action()) {
$controls->data = $module->options;
} else {
if ($controls->is_action('save')) {
$module->save_options($controls->data);
$controls->messages = 'Saved.';
}
if ($controls->is_action('trigger')) {
$res = $module->bounce();
if (!empty($module->mandrill_result)) {
$controls->errors = $module->mandrill_result;
} else {
$controls->messages = $module->bounce_result;
}
}
if ($controls->is_action('reset')) {
$module->save_last_run(0);
$controls->messages = 'Done.';
}
if ($controls->is_action('smtp_test')) {
$message['html'] = "<!DOCTYPE html>\n";
$message['html'] .= "This is the rich text (HTML) version of a test message sent via Mandrill.</p>\n";
$message['html'] .= "This is a <strong>bold text</strong></p>\n";
$message['html'] .= "This is a <a href='http://www.satollo.net'>link to www.satollo.net</a></p>\n";
$message['text'] = 'This is the TEXT version of a test message sent via Mandrill. You should see this message only if you email client does not support the rich text (HTML) version.';
if ($controls->data['api'] == 1) {
示例11: NewsletterControls
<?php
@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
if (!$controls->is_action()) {
$controls->data = get_option('newsletter_main');
} else {
if ($controls->is_action('remove')) {
$wpdb->query("delete from " . $wpdb->prefix . "options where option_name like 'newsletter%'");
$wpdb->query("drop table " . $wpdb->prefix . "newsletter, " . $wpdb->prefix . "newsletter_stats, " . $wpdb->prefix . "newsletter_emails, " . $wpdb->prefix . "newsletter_work");
echo 'Newsletter plugin destroyed. Please, deactivate it now.';
return;
}
if ($controls->is_action('save')) {
$errors = null;
// Validation
$controls->data['sender_email'] = $newsletter->normalize_email($controls->data['sender_email']);
if (!$newsletter->is_email($controls->data['sender_email'])) {
$controls->errors .= 'The sender email address is not correct.<br>';
}
$controls->data['return_path'] = $newsletter->normalize_email($controls->data['return_path']);
if (!$newsletter->is_email($controls->data['return_path'], true)) {
$controls->errors .= 'Return path email is not correct.<br>';
}
$controls->data['php_time_limit'] = (int) $controls->data['php_time_limit'];
if ($controls->data['php_time_limit'] == 0) {
unset($controls->data['php_time_limit']);
}
//$controls->data['test_email'] = $newsletter->normalize_email($controls->data['test_email']);
//if (!$newsletter->is_email($controls->data['test_email'], true)) {
// $controls->errors .= 'Test email is not correct.<br />';
示例12: NewsletterControls
<?php
@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
$module = NewsletterWp::instance();
if (!$controls->is_action()) {
$controls->data = $module->options;
} else {
if ($controls->is_action('save')) {
//$module->merge_options($controls->data);
unset($controls->data['align_wp_users_status']);
$module->save_options($controls->data);
$controls->add_message_saved();
}
if ($controls->is_action('align_wp_users')) {
ignore_user_abort(true);
set_time_limit(0);
// TODO: check if the user is already there
$wp_users = $wpdb->get_results("select id, user_email, user_login from {$wpdb->users}");
$count = 0;
foreach ($wp_users as &$wp_user) {
// A subscriber is already there with the same wp_user_id? Do Nothing.
$nl_user = $module->get_user_by_wp_user_id($wp_user->id);
if (!empty($nl_user)) {
continue;
}
// A subscriber has the same email? Align them if not already associated to another wordpress user
$nl_user = $module->get_user($module->normalize_email($wp_user->user_email));
if (!empty($nl_user)) {
if (empty($nl_user->wp_user_id)) {
//$module->logger->info('Linked');
示例13: NewsletterControls
<?php
@(include_once NEWSLETTER_INCLUDES_DIR . '/controls.php');
$controls = new NewsletterControls();
$module = Newsletter::instance();
if (!$controls->is_action()) {
$controls->data = get_option('newsletter_main');
} else {
if ($controls->is_action('remove')) {
}
}
?>
<div class="wrap" id="tnp-wrap">
<?php
include NEWSLETTER_DIR . '/tnp-header.php';
?>
<div id="tnp-heading">
<h2><?php
_e('General Settings', 'newsletter');
?>
</h2>
</div>
<div id="tnp-body">
示例14: 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'];
示例15: NewsletterControls
<?php
@(include_once 'commons.php');
$nc = new NewsletterControls();
if (!$nc->is_action()) {
$nc->data = get_option('newsletter_main');
} else {
if ($nc->is_action('remove')) {
$wpdb->query("delete from " . $wpdb->prefix . "options where option_name like 'newsletter%'");
$wpdb->query("drop table " . $wpdb->prefix . "newsletter, " . $wpdb->prefix . "newsletter_stats, " . $wpdb->prefix . "newsletter_emails, " . $wpdb->prefix . "newsletter_profiles, " . $wpdb->prefix . "newsletter_work");
echo 'Newsletter plugin destroyed. Please, deactivate it now.';
return;
}
if ($nc->is_action('save')) {
$errors = null;
// Validation
$nc->data['sender_email'] = $newsletter->normalize_email($nc->data['sender_email']);
if (!$newsletter->is_email($nc->data['sender_email'])) {
$errors = __('Sender email is not correct');
}
$nc->data['return_path'] = $newsletter->normalize_email($nc->data['return_path']);
if (!$newsletter->is_email($nc->data['return_path'], true)) {
$errors = __('Return path email is not correct');
}
// With some providers the return path must be left empty
//if (empty($options['return_path'])) $options['return_path'] = $options['sender_email'];
$nc->data['test_email'] = $newsletter->normalize_email($nc->data['test_email']);
if (!$newsletter->is_email($nc->data['test_email'], true)) {
$errors = __('Test email is not correct');
}
$nc->data['reply_to'] = $newsletter->normalize_email($nc->data['reply_to']);