本文整理汇总了PHP中SendPress_Option::is_double_optin方法的典型用法代码示例。如果您正苦于以下问题:PHP SendPress_Option::is_double_optin方法的具体用法?PHP SendPress_Option::is_double_optin怎么用?PHP SendPress_Option::is_double_optin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SendPress_Option
的用法示例。
在下文中一共展示了SendPress_Option::is_double_optin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html
function html()
{
if (isset($_POST['sp-shortcode']) && strpos($_POST['sp-shortcode'], 'SC-') !== false) {
$cls = str_replace('-', '_', trim($_POST['sp-shortcode']));
call_user_func(array('SendPress_' . $cls, "form_post"), '');
} else {
$post_options = array('list', 'email', 'firstname', 'lastname', 'return', 'status');
$user_info = array();
foreach ($post_options as $opt) {
$user_info[$opt] = isset($_POST['sp_' . $opt]) ? $_POST['sp_' . $opt] : false;
}
$valid_user = array();
//foreach()
if (isset($user_info['list'])) {
if (!is_array($user_info['list'])) {
$user_info['list'] = array($user_info['list']);
}
$data_error = false;
if ($user_info['status'] !== false) {
$valid_user['status'] = $user_info['status'];
} else {
$valid_user['status'] = 2;
}
if ($user_info['email'] !== false && is_email($user_info['email'])) {
$valid_user['email'] = $user_info['email'];
} else {
$data_error = __('Invalid Email', 'sendpress');
}
if ($user_info['firstname'] !== false) {
$valid_user['firstname'] = $user_info['firstname'];
} else {
$valid_user['firstname'] = '';
}
if ($user_info['lastname'] !== false) {
$valid_user['lastname'] = $user_info['lastname'];
} else {
$valid_user['lastname'] = '';
}
$status = false;
if ($data_error == false) {
$list = implode(",", $user_info['list']);
$custom = apply_filters('sendpress_subscribe_to_list_custom_fields', array(), $_POST);
$status = SendPress_Data::subscribe_user($list, $valid_user['email'], $valid_user['firstname'], $valid_user['lastname'], $valid_user['status'], $custom);
if ($status == false) {
$data_error = __('Problem with subscribing user.', 'sendpress');
}
}
$post_responce = get_post_meta($user_info['list'][0], 'post-page', true);
if ($post_responce == false) {
$post_responce = 'default';
}
if ($user_info['return'] != false) {
$post_responce = $user_info['return'];
}
$optin = SendPress_Option::is_double_optin();
if (isset($_POST['redirect']) && $_POST['redirect'] > 0) {
$plink = get_permalink($_POST['redirect']);
if ($plink != "") {
wp_redirect(esc_url_raw($plink));
exit;
}
}
switch ($post_responce) {
case "json":
//Respond to post with json data
if ($status == false || $data_error != false) {
// { success: true/false, list: listid , name: listname, optin: true/false }
$info = array("success" => false, "error" => $data_error, "list" => $user_info['list']);
}
if ($status) {
$info = array("success" => true, "error" => $data_error, "list" => $user_info['list'], "optin" => $optin, "email" => $valid_user['email']);
}
$encoded = json_encode($info);
header('Content-type: application/json');
exit($encoded);
break;
case "custom":
$post_redirect = get_post_meta($user_info['list'][0], 'post-page-id', true);
if ($post_redirect == false) {
$post_redirect = site_url();
} else {
$plink = get_permalink($post_redirect);
if ($plink != "") {
wp_safe_redirect(esc_url_raw($plink));
exit;
}
}
wp_redirect(esc_url_raw($post_redirect));
exit;
break;
case "redirect":
$post_redirect = get_post_meta($user_info['list'][0], 'post-redirect', true);
if ($post_redirect == false) {
$post_redirect = site_url();
}
wp_redirect(esc_url_raw($post_redirect));
exit;
break;
default:
$this->default_page($status, $data_error);
//.........这里部分代码省略.........
示例2: subscribe_user
static function subscribe_user($listid, $email, $first, $last, $status = 2, $custom = array())
{
$success = false;
$subscriberID = SendPress_Data::add_subscriber(array('firstname' => $first, 'lastname' => $last, 'email' => $email));
//SendPress_Error::log($subscriberID);
if (false === $subscriberID) {
return false;
}
$args = array('post_type' => 'sendpress_list', 'numberposts' => -1, 'offset' => 0, 'orderby' => 'post_title', 'order' => 'DESC');
$lists = get_posts($args);
$listids = explode(',', $listid);
$already_subscribed = false;
if ($status == 2 && SendPress_Option::is_double_optin()) {
$inlists = SendPress_Data::get_active_list_ids_for_subscriber($subscriberID);
//SendPress_Error::log($inlists);
if ($inlists) {
$already_subscribed = true;
} else {
$status = 1;
SendPress_Manager::send_optin($subscriberID, $listids, $lists);
}
}
foreach ($lists as $list) {
if (in_array($list->ID, $listids)) {
$current_status = SendPress_Data::get_subscriber_list_status($list->ID, $subscriberID);
if (empty($current_status) || isset($current_status->status) && $current_status->status < 2) {
$success = SendPress_Data::update_subscriber_status($list->ID, $subscriberID, $status);
} else {
$success = true;
}
foreach ($custom as $key => $value) {
SendPress_Data::update_subscriber_meta($subscriberID, $key, $value, $list->ID);
}
}
}
if ($success == false) {
return false;
}
return array('success' => $success, 'already' => $already_subscribed);
}
示例3: is_double_optin
function is_double_optin()
{
_deprecated_function(__FUNCTION__, '0.8.9', 'SendPress_Option::is_double_optin()');
return SendPress_Option::is_double_optin();
}