当前位置: 首页>>代码示例>>PHP>>正文


PHP NewsletterSubscription::save方法代码示例

本文整理汇总了PHP中NewsletterSubscription::save方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsletterSubscription::save方法的具体用法?PHP NewsletterSubscription::save怎么用?PHP NewsletterSubscription::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NewsletterSubscription的用法示例。


在下文中一共展示了NewsletterSubscription::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: newsletter_unsubscribe_all_email

/**
 * Block an email address from all newsletters
 *
 * @param string $email The email address to block
 *
 * @return boolean True on success, false on failure
 */
function newsletter_unsubscribe_all_email($email)
{
    $result = false;
    if (!empty($email) && newsletter_is_email_address($email)) {
        // get subscription
        $subscription = newsletter_get_subscription($email);
        if (empty($subscription)) {
            $subscription = new NewsletterSubscription();
            $subscription->title = $email;
            if (!$subscription->save()) {
                return false;
            }
            // remove all existing subscriptions
            remove_entity_relationships($subscription->getGUID(), NewsletterSubscription::SUBSCRIPTION);
            // add to general blacklist
            $site = elgg_get_site_entity();
            $result = (bool) add_entity_relationship($subscription->getGUID(), NewsletterSubscription::GENERAL_BLACKLIST, $site->getGUID());
        }
    }
    return $result;
}
开发者ID:pleio,项目名称:newsletter,代码行数:28,代码来源:functions.php

示例2: trim

$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 ...");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>    
开发者ID:earthtravels,项目名称:maxtena,代码行数:31,代码来源:index.php


注:本文中的NewsletterSubscription::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。