本文整理汇总了PHP中NewsletterModule::is_email方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsletterModule::is_email方法的具体用法?PHP NewsletterModule::is_email怎么用?PHP NewsletterModule::is_email使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsletterModule
的用法示例。
在下文中一共展示了NewsletterModule::is_email方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: email
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.';
}
if ($controls->is_action('delete_transient')) {
delete_transient($_POST['btn']);
// Found blogs where timeout has been lost and the transient never deleted
delete_option('_transient_newsletter_main_engine');
delete_option('_transient_timeout_newsletter_main_engine');
$controls->messages = 'Deleted.';
}
if ($controls->is_action('test')) {
if (!NewsletterModule::is_email($controls->data['test_email'])) {
$controls->errors = 'The test email address is not set or is not correct.';
}
if (empty($controls->errors)) {
if ($controls->data['test_email'] == $module->options['sender_email']) {
$controls->messages .= '<strong>Warning:</strong> you are using as test email the same address configured as sender in main configuration. Test can fail because of that.<br>';
}
// Direct WordPress email
$text = 'This is a simple test email sent directly with the WordPress mailing functionality' . "\r\n" . 'in the same way WordPress sends notifications of new comment or registered users.' . "\r\n\r\n" . 'This email is in pure text format and the sender should be wordpress@youdomain.tld' . "\r\n" . '(but it can be forced to be different with specific plugins.';
$r = wp_mail($controls->data['test_email'], 'WordPress test email at ' . date(DATE_ISO8601), $text);
$controls->messages .= 'Email sent with WordPress: ';
if ($r) {
$controls->messages .= '<strong>SUCCESS</strong><br>';
} else {
global $phpmailer;
$controls->messages .= '<strong>FAILED</strong> (' . $phpmailer->ErrorInfo . ')<br>';
示例2: newsletter_subscription_user_register
function newsletter_subscription_user_register($wp_user_id)
{
global $wpdb, $newsletter;
$module = NewsletterSubscription::instance();
// If the integration is disabled...
if ($module->options['subscribe_wp_users'] == 0) {
return;
}
// If not forced and the user didn't choose the newsletter...
if ($module->options['subscribe_wp_users'] != 1) {
if (!isset($_REQUEST['newsletter'])) {
return;
}
}
$module->logger->info('Adding a registered WordPress user (' . $wp_user_id . ')');
$wp_user = $wpdb->get_row($wpdb->prepare("select * from {$wpdb->users} where id=%d limit 1", $wp_user_id));
if (empty($wp_user)) {
$module->logger->error('User not found?!');
return;
}
// Yes, some registration procedures allow empty email
if (!NewsletterModule::is_email($wp_user->user_email)) {
return;
}
$_REQUEST['ne'] = $wp_user->user_email;
$_REQUEST['nr'] = 'registration';
// Upon registration there is no last name and first name, sorry.
// $status is determined by the opt in
$user = $module->subscribe(null, $module->options['wp_send_confirmation'] == 1);
// Now we associate it with wp
$module->set_user_wp_user_id($user->id, $wp_user_id);
}
示例3: record
function record()
{
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
return;
}
if (is_admin() && strpos($_SERVER['REQUEST_URI'], 'admin.php') !== false) {
return;
}
if (!isset($this->options['record'])) {
return;
}
if (!current_user_can('manage_options')) {
return;
}
// Check if there is an email
foreach ($_POST as $key => $value) {
if (!NewsletterModule::is_email($value)) {
continue;
}
add_option($this->prefix . '_record', '', null, 'no');
update_option($this->prefix . '_record', stripslashes_deep($_POST));
return;
}
}