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