本文整理汇总了PHP中NewsletterControls::save方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsletterControls::save方法的具体用法?PHP NewsletterControls::save怎么用?PHP NewsletterControls::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsletterControls
的用法示例。
在下文中一共展示了NewsletterControls::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'] . "'";
}
示例2: NewsletterControls
@(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();
?>
<?php
$nc->hidden('id');