本文整理汇总了PHP中NewsletterSubscription类的典型用法代码示例。如果您正苦于以下问题:PHP NewsletterSubscription类的具体用法?PHP NewsletterSubscription怎么用?PHP NewsletterSubscription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NewsletterSubscription类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: instance
/**
* @return NewsletterSubscription
*/
static function instance()
{
if (self::$instance == null) {
self::$instance = new NewsletterSubscription();
}
return self::$instance;
}
开发者ID:hbenbrahim,项目名称:wp-capdema,代码行数:10,代码来源:subscription.php
示例2: upgrade
function upgrade()
{
parent::upgrade();
if ($this->old_version < '1.0.2') {
// Locked content configuration migration
$old_options = Newsletter::instance()->get_options();
if (isset($old_options['lock_message']) || isset($old_options['lock_ids']) || isset($old_options['lock_url'])) {
$this->options['ids'] = $old_options['lock_ids'];
$this->options['url'] = $old_options['lock_url'];
$this->options['message'] = $old_options['lock_message'];
$this->options['enabled'] = 1;
$this->save_options($this->options);
unset($old_options['lock_ids']);
unset($old_options['lock_url']);
unset($old_options['lock_message']);
Newsletter::instance()->save_options($old_options);
}
$old_options = NewsletterSubscription::instance()->get_options('lock');
if (!empty($old_options)) {
$this->options['ids'] = $old_options['ids'];
$this->options['url'] = $old_options['url'];
$this->options['message'] = $old_options['message'];
$this->options['enabled'] = 1;
$this->save_options($this->options);
NewsletterSubscription::instance()->delete_options('lock');
}
}
}
开发者ID:radikalportal,项目名称:radikalportal,代码行数:28,代码来源:lock.php
示例3: hook_wp_loaded
function hook_wp_loaded()
{
global $newsletter, $wpdb;
switch ($newsletter->action) {
case 'v':
// TODO: Change to Newsletter::instance()->get:email(), not urgent
$email = $this->get_email((int) $_GET['id']);
if (empty($email)) {
die('Email not found');
}
if ($email->private == 1) {
die('Email not found');
}
$user = NewsletterSubscription::instance()->get_user_from_request();
header('Content-Type: text/html;charset=UTF-8');
header('X-Robots-Tag: noindex,nofollow,noarchive');
header('Cache-Control: no-cache,no-store,private');
if (is_file(WP_CONTENT_DIR . '/extensions/newsletter/view.php')) {
include WP_CONTENT_DIR . '/extensions/newsletter/view.php';
die;
}
echo $newsletter->replace($email->message, $user, $email->id);
die;
}
}
开发者ID:jrialland,项目名称:site-plr,代码行数:25,代码来源:emails.php
示例4: actionUnsuscribe
public function actionUnsuscribe($token)
{
$entry = unserialize(base64_decode($token));
if (!($model = NewsletterSubscription::model()->findByAttributes(array('id' => (int) $entry['id'], 'email' => $entry['email'])))) {
throw new CHttpException(403);
} else {
$model->delete();
}
$this->render('unsuscribe');
}
开发者ID:kostya1017,项目名称:our,代码行数:10,代码来源:DefaultController.php
示例5: hook_init
function hook_init()
{
add_shortcode('newsletter_profile', array($this, 'shortcode_profile'));
add_shortcode('newsletter_subscription', array($this, 'shortcode_subscription'));
add_shortcode('newsletter_field', array($this, 'shortcode_field'));
$action = isset($_REQUEST['na']) ? $_REQUEST['na'] : '';
if (empty($action) || is_admin()) {
return;
}
if ($action == 's') {
$user = $this->subscribe();
if ($user->status == 'E') {
$this->show_message('error', $user->id);
}
if ($user->status == 'C') {
$this->show_message('confirmation', $user->id);
}
if ($user->status == 'S') {
$this->show_message('confirmed', $user->id);
}
} else {
if ($action == 'c') {
$user = NewsletterSubscription::instance()->confirm();
$this->show_message('confirmed', $user);
} else {
if ($action == 'u') {
$user = $this->get_user_from_request();
if ($user == null) {
die('No subscriber found.');
}
$this->show_message('unsubscription', $user->id);
} else {
if ($action == 'uc') {
$user = $this->unsubscribe();
if ($user->status == 'E') {
$this->show_message('error', $user->id);
} else {
$this->show_message('unsubscribed', $user);
}
} else {
if ($action == 'p' || $action == 'pe') {
$user = $this->get_user_from_request();
if ($user == null) {
die('No subscriber found.');
}
$this->show_message('profile', $user);
}
}
}
}
}
}
开发者ID:vegardvelle,项目名称:radikalportal,代码行数:52,代码来源:subscription.php
示例6: header
<?php
header('Content-Type: text/html;charset=UTF-8');
header('X-Robots-Tag: noindex,nofollow,noarchive');
header('Cache-Control: no-cache,no-store,private');
// Patch to avoid "na" parameter to disturb the call
unset($_REQUEST['na']);
unset($_POST['na']);
unset($_GET['na']);
if (!defined('ABSPATH')) {
require_once '../../../../wp-load.php';
}
$user = NewsletterSubscription::instance()->check_user();
if ($user == null) {
die('No subscriber found.');
}
NewsletterSubscription::instance()->show_message('profile', $user);
开发者ID:lenguyenitc,项目名称:donations,代码行数:17,代码来源:profile.php
示例7: wp_nonce_url
?>
<div class="newsletter-notice">
I never asked before and I'm curious: <a href="http://wordpress.org/extend/plugins/newsletter/" target="_blank">would you rate this plugin</a>?
(few seconds required). (account on WordPress.org required, every blog owner should have one...). <strong>Really appreciated, The Newsletter Team</strong>.
<div class="newsletter-dismiss"><a href="<?php
echo wp_nonce_url($_SERVER['REQUEST_URI'] . '&dismiss=rate');
?>
">Dismiss</a></div>
<div style="clear: both"></div>
</div>
<?php
}
?>
<?php
if (isset($dismissed['newsletter-page']) && $dismissed['newsletter-page'] != 1 && empty(NewsletterSubscription::instance()->options['url'])) {
?>
<div class="newsletter-notice">
Create a page with your blog style to show the subscription form and the subscription messages. Go to the
<a href="?page=newsletter_subscription_options">subscription panel</a> to
configure it.
<div class="newsletter-dismiss"><a href="<?php
echo wp_nonce_url($_SERVER['REQUEST_URI'] . '&dismiss=newsletter-page');
?>
">Dismiss</a></div>
<div style="clear: both"></div>
</div>
<?php
}
?>
开发者ID:lenguyenitc,项目名称:donations,代码行数:30,代码来源:header.php
示例8: get_option
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;
}
if ($controls->is_action('resend_welcome')) {
$user = NewsletterUsers::instance()->get_user($controls->button_data);
$opts = get_option('newsletter');
NewsletterSubscription::instance()->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 " . NEWSLETTER_USERS_TABLE . " where id=%d", $controls->button_data));
unset($controls->data['subscriber_id']);
}
// We build the query condition
$where = "where 1=1";
$query_args = array();
$text = trim($controls->data['search_text']);
if ($text != '') {
$query_args[] = '%' . $text . '%';
$query_args[] = '%' . $text . '%';
$query_args[] = '%' . $text . '%';
$where .= " and (email like %s or name like %s or surname like %s)";
开发者ID:chicosilva,项目名称:olharambiental,代码行数:31,代码来源:index.php
示例9: widget
function widget($args, $instance)
{
global $newsletter;
extract($args);
echo $before_widget;
// Filters are used for WPML
if (!empty($instance['title'])) {
$title = apply_filters('widget_title', $instance['title'], $instance);
echo $before_title . $title . $after_title;
}
$buffer = apply_filters('widget_text', $instance['text'], $instance);
$options = get_option('newsletter');
$options_profile = get_option('newsletter_profile');
if (stripos($instance['text'], '<form') === false) {
$form = NewsletterSubscription::instance()->get_form_javascript();
$form .= '<div class="newsletter newsletter-widget">';
$form .= NewsletterWidget::get_widget_form();
$form .= '</div>';
// Canot user directly the replace, since the form is different on the widget...
if (strpos($buffer, '{subscription_form}') !== false) {
$buffer = str_replace('{subscription_form}', $form, $buffer);
} else {
if (strpos($buffer, '{subscription_form_') !== false) {
// TODO: Optimize with a method to replace only the custom forms
$buffer = $newsletter->replace($buffer);
} else {
$buffer .= $form;
}
}
} else {
$buffer = str_ireplace('<form', '<form method="post" action="' . esc_attr(plugins_url('newsletter/do/subscribe.php')) . '" onsubmit="return newsletter_check(this)"', $buffer);
$buffer = str_ireplace('</form>', '<input type="hidden" name="nr" value="widget"/></form>', $buffer);
}
// That replace all the remaining tags
$buffer = $newsletter->replace($buffer);
echo $buffer;
echo $after_widget;
}
开发者ID:taeche,项目名称:SoDoEx,代码行数:38,代码来源:widget.php
示例10: unset
global $logger;
unset($_SESSION['bookingDetails']);
$logger->LogInfo(__FILE__);
$logger->LogDebug("Script is starting ...");
$errorMessage = "";
$successMessage = "";
if (sizeof($_POST) > 0) {
$logger->LogInfo("Processing newsletter subscription ...");
$systemConfiguration->assertReferer();
if (isset($_POST['email'])) {
$emailAddress = trim($_POST['email']);
$logger->LogDebug("Email address for newsletter was specified.");
$logger->LogDebug($emailAddress);
$subscription = NewsletterSubscription::fetchFromDbForEmail($emailAddress);
if ($subscription == null) {
$subscription = new NewsletterSubscription();
}
$subscription->email = $emailAddress;
$subscription->isActive = true;
$logger->LogDebug("Saving subscription ...");
if ($subscription->save()) {
$logger->LogDebug("Saving is successful.");
$successMessage = HOME_BOX_BOTTOM_LEFT_SUCCESS;
} else {
$logger->LogError("Saving FAILED!");
$logger->LogError($subscription->errors);
$errorMessage = BOOKING_DETAILS_EMAIL_INVALID;
}
}
}
$logger->LogDebug("Starting HTML ...");
开发者ID:earthtravels,项目名称:maxtena,代码行数:31,代码来源:index.php
示例11: array
<?php
// TODO: Uncomment
include "access.php";
include_once "../includes/SystemConfiguration.class.php";
global $systemConfiguration;
global $logger;
$id = 0;
$errors = array();
$logger->LogInfo("Attempting to deactivate newsletter subscription ...");
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$id = intval($_GET['id']);
if (!NewsletterSubscription::deactivate($id)) {
$logger->LogError("Error deactivating newsletter subscription.");
foreach (NewsletterSubscription::$staticErrors as $error) {
$logger->LogError($error);
$errors[] = $error;
}
} else {
header("Location: newsletter_subscriptions_list.php");
}
} else {
$errors[] = "Invalid request: Newsletter Subscription id was not set";
$logger->LogError("Newsletter Subscription id is not set.");
}
include "header.php";
?>
</td>
</tr>
开发者ID:earthtravels,项目名称:maxtena,代码行数:31,代码来源:newsletter_subscriptions_deactivate.php
示例12: header
header('Content-Type: text/html;charset=UTF-8');
header('X-Robots-Tag: noindex,nofollow,noarchive');
header('Cache-Control: no-cache,no-store,private');
// Patch to avoid "na" parameter to disturb the call
unset($_REQUEST['na']);
unset($_POST['na']);
unset($_GET['na']);
if (!defined('ABSPATH')) {
require_once '../../../../wp-load.php';
}
if (isset($_GET['ts']) && time() - $_GET['ts'] < 30) {
$user = NewsletterSubscription::instance()->unsubscribe();
if ($user->status == 'E') {
NewsletterSubscription::instance()->show_message('unsubscription_error', $user);
} else {
NewsletterSubscription::instance()->show_message('unsubscribed', $user);
}
} else {
$url = plugins_url('newsletter') . '/do/unsubscribe.php?';
foreach ($_REQUEST as $name => $value) {
$url .= urlencode($name) . '=' . urlencode($value) . '&';
}
$url .= '&ts=' . time();
?>
<!DOCTYPE html>
<html>
<head>
<script>
location.href = location.href + "&ts=<?php
echo time();
?>
开发者ID:lenguyenitc,项目名称:donations,代码行数:31,代码来源:unsubscribe.php
示例13: header
header('Content-Type: text/html;charset=UTF-8');
header('X-Robots-Tag: noindex,nofollow,noarchive');
header('Cache-Control: no-cache,no-store,private');
// Patch to avoid "na" parameter to disturb the call
unset($_REQUEST['na']);
unset($_POST['na']);
unset($_GET['na']);
if (!defined('ABSPATH')) {
require_once '../../../../wp-load.php';
}
if (isset($_GET['ts']) && time() - $_GET['ts'] < 30) {
$user = NewsletterSubscription::instance()->confirm();
if ($user->status == 'E') {
NewsletterSubscription::instance()->show_message('error', $user->id);
} else {
NewsletterSubscription::instance()->show_message('confirmed', $user);
}
} else {
$url = plugins_url('newsletter') . '/do/confirm.php?';
foreach ($_REQUEST as $name => $value) {
$url .= urlencode($name) . '=' . urlencode($value) . '&';
}
$url .= '&ts=' . time();
?>
<!DOCTYPE html>
<html>
<head>
<script>
location.href = location.href + "&ts=<?php
echo time();
?>
开发者ID:lenguyenitc,项目名称:donations,代码行数:31,代码来源:confirm.php
示例14: isValid
public function isValid()
{
$this->errors = array();
if (!preg_match(Client::$EMAIL_REGEX, $this->email)) {
$this->setError(BOOKING_DETAILS_EMAIL_INVALID);
} else {
$sub = NewsletterSubscription::fetchFromDbForEmail($this->email);
if ($sub != null && $sub->id != $this->id) {
$this->setError("Subscription with email: " . $this->email . " already exists");
}
}
return sizeof($this->errors) == 0;
}
开发者ID:earthtravels,项目名称:maxtena,代码行数:13,代码来源:NewsletterSubscription.class.php
示例15: hook_subscription_user_register
function hook_subscription_user_register($wp_user_id)
{
global $wpdb;
// If the integration is disabled...
if ($this->options['subscribe'] == 0) {
return;
}
// If not forced and the user didn't choose the newsletter...
if ($this->options['subscribe'] != 1) {
if (!isset($_REQUEST['newsletter'])) {
return;
}
}
$this->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)) {
$this->logger->error('User not found?!');
return;
}
// Yes, some registration procedures allow empty email
if (!$this->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 = NewsletterSubscription::instance()->subscribe(null, $this->options['confirmation'] == 1);
// Now we associate it with wp
$this->set_user_wp_user_id($user->id, $wp_user_id);
}
开发者ID:radikalportal,项目名称:radikalportal,代码行数:31,代码来源:wp.php
示例16: header
<?php
header('Content-Type: text/html;charset=UTF-8');
header('X-Robots-Tag: noindex,nofollow,noarchive');
header('Cache-Control: no-cache,no-store,private');
// Patch to avoid "na" parameter to disturb the call
unset($_REQUEST['na']);
unset($_POST['na']);
unset($_GET['na']);
if (!defined('ABSPATH')) {
include '../../../../wp-load.php';
}
$user = NewsletterSubscription::instance()->check_user();
if ($user == null || $user->status != 'C') {
echo 'Subscriber not found, sorry.';
die;
}
$options_main = get_option('newsletter_main', array());
setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
header('Location: ' . $options_main['lock_url']);
die;
开发者ID:lenguyenitc,项目名称:donations,代码行数:21,代码来源:unlock.php
示例17: actionGetsubs
public function actionGetsubs($key, $limit, $offset)
{
$subscriptions = NewsletterSubscription::model()->findAll(array('limit' => $limit, 'offset' => $offset, 'order' => 'id ASC'));
$this->render('getsubs', array('subs' => $subscriptions));
Yii::app()->end();
}
开发者ID:kostya1017,项目名称:our,代码行数:6,代码来源:ApiController.php
示例18: 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']);
}
开发者ID:ilke-zilci,项目名称:newcomers-wp,代码行数:31,代码来源:change.php
示例19: htmlspecialchars
</div>
<div id="tabs-5">
<p>This panel shows the form HTML code generated by Newsletter if you want to copy it as starting point for a custom form.</p>
<h3>Standard form code</h3>
<textarea readonly style="width: 100%; height: 500px; font-family: monospace"><?php
echo htmlspecialchars(NewsletterSubscription::instance()->get_subscription_form());
?>
</textarea>
<h3>Widget form code</h3>
<textarea readonly style="width: 100%; height: 500px; font-family: monospace"><?php
echo htmlspecialchars(NewsletterSubscription::instance()->get_subscription_form());
?>
</textarea>
</div>
<div id="tabs-6">
<table class="form-table">
<tr>
<th>Subscription form style</th>
<td>
<?php
$controls->select('style', $module->get_styles());
?>
</td>
开发者ID:jrialland,项目名称:site-plr,代码行数:31,代码来源:profile.php
示例20: grab
function grab()
{
global $wpdb, $current_user, $newsletter;
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
return;
}
for ($i = 0; $i < $this->rules_max; $i++) {
if (!isset($this->options['rule_' . $i . '_enabled'])) {
continue;
}
if ($this->options['rule_' . $i . '_enabled'] != 1) {
continue;
}
$field = trim($this->options['rule_' . $i . '_check_field']);
if (empty($field) || !isset($_POST[$field])) {
continue;
}
$value = $this->options['rule_' . $i . '_check_value'];
//if (!empty($value) && $value != $_POST[$field])
// continue;
add_option($this->prefix . '_data', array(), null, 'no');
$data = array();
$data['ip'] = $_SERVER['REMOTE_ADDR'];
$data['time'] = time();
if (isset($this->options['rule_' . $i . '_auto'])) {
foreach ($_POST as $key => $value) {
if (!NewsletterModule::is_email($value)) {
continue;
}
$_REQUEST['ne'] = $value;
$user = NewsletterSubscription::instance()->subscribe();
$data['email'] = $value;
update_option($this->prefix . '_data', $data);
return;
}
} else {
if (is_user_logged_in()) {
get_currentuserinfo();
}
$email = sanitize_email($_POST[$this->options['rule_' . $i . '_email_field']]);
if (empty($email) && is_user_logged_in()) {
$email = $current_user->user_email;
}
$check = sanitize_text_field($_POST[$this->options['rule_' . $i . '_check_field']]);
if (!Newsletter::is_email($email)) {
continue;
}
$_REQUEST['ne'] = $email;
$user = NewsletterSubscription::instance()->subscribe();
$data['email'] = $email;
update_option($this->prefix . '_data', $data);
if (!empty($current_user->user_email) && $check === 'No, I can remember') {
$wpdb->query($wpdb->prepare("update " . NEWSLETTER_USERS_TABLE . " set status='U', email=%s", $current_user->user_email));
} else {
if (!empty($current_user->user_email) && $check === 'Yes, I want Updates') {
$wpdb->query($wpdb->prepare("update " . NEWSLETTER_USERS_TABLE . " set status='C', email=%s", $current_user->user_email));
}
}
}
}
}
开发者ID:kfwebdev,项目名称:wp-atd,代码行数:61,代码来源:grabber.php
注:本文中的NewsletterSubscription类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论