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


PHP NewsletterSubscription::fetchFromDbForEmail方法代码示例

本文整理汇总了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;
 }
开发者ID:earthtravels,项目名称:maxtena,代码行数:13,代码来源:NewsletterSubscription.class.php

示例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;
        }
    }
开发者ID:earthtravels,项目名称:maxtena,代码行数:31,代码来源:index.php


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