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


PHP Email::LoadArrayByAddress方法代码示例

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


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

示例1: IsAvailableForPublicRegistration

 public static function IsAvailableForPublicRegistration($strAddress)
 {
     $strAddress = trim(strtolower($strAddress));
     // Go through all potential active registrations
     foreach (Email::LoadArrayByAddress($strAddress) as $objEmail) {
         if ($objEmail->Person->PublicLogin) {
             return false;
         }
     }
     // If we are here, then there are no emails associated with publiclogin-linked people
     return true;
 }
开发者ID:alcf,项目名称:chms,代码行数:12,代码来源:Email.class.php

示例2: btnCheck_Click

 protected function btnCheck_Click($strFormId, $strControlId, $strParameter)
 {
     $this->lblResult->Text = '';
     $objEmailArray = Email::LoadArrayByAddress($this->txtEmail->Text);
     if (count($objEmailArray) > 0) {
         $this->lblResult->Text .= "Found email objects<br><br>";
         $intPersonIdArray = array();
         foreach ($objEmailArray as $objEmail) {
             $objPerson = Person::LoadByPrimaryEmailId($objEmail->Id);
             if ($objPerson) {
                 $intPersonIdArray[] = $objPerson->Id;
             }
         }
         $this->lblResult->Text .= "<h3>GROUPS</h3>";
         $objGroupCursor = Group::QueryCursor(QQ::All());
         while ($objGroup = Group::InstantiateCursor($objGroupCursor)) {
             $objGroupParticipationArr = $objGroup->GetGroupParticipationArray();
             foreach ($objGroupParticipationArr as $objGroupParticipant) {
                 if (in_array($objGroupParticipant->PersonId, $intPersonIdArray)) {
                     $this->lblResult->Text .= sprintf("%s is in %s: %s<br>", $this->txtEmail->Text, $objGroup->Ministry->Name, $objGroup->Name);
                     break;
                 }
             }
         }
         $this->lblResult->Text .= "<br><h3>COMMUNICATION LISTS</h3>";
         $objCommuncationsCursor = CommunicationList::QueryCursor(QQ::All());
         while ($objCommunicationList = CommunicationList::InstantiateCursor($objCommuncationsCursor)) {
             $objCommListArray = $objCommunicationList->GetMemberAsArray();
             foreach ($objCommListArray as $objComListEntry) {
                 if ($objComListEntry[3] == $this->txtEmail->Text) {
                     $this->lblResult->Text .= sprintf("%s is in %s: %s<br>", $this->txtEmail->Text, $objCommunicationList->Ministry->Name, $objCommunicationList->Name);
                     break;
                 }
             }
         }
     } else {
         $this->lblResult->Text .= "No email object found<br>";
     }
 }
开发者ID:alcf,项目名称:chms,代码行数:39,代码来源:tools.php

示例3: QCliParameterProcessor

<?php

// Get arguments
$objParameters = new QCliParameterProcessor('bounceback', 'Checking for Bounceback emails');
$objParameters->AddDefaultParameter('file', QCliParameterType::String, 'The csv file that contains the email addresses that bounced');
$objParameters->Run();
$txtSrcFile = $objParameters->GetDefaultValue('file');
// read file
if (is_file($txtSrcFile)) {
    $lineArray = file($txtSrcFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $isFirst = true;
    foreach ($lineArray as $line) {
        $objEmailArray = Email::LoadArrayByAddress(trim($line));
        if ($objEmailArray) {
            printf("Found email: %s\n", trim($line));
            foreach ($objEmailArray as $objEmail) {
                $objPerson = Person::LoadByPrimaryEmailId($objEmail->Id);
                if ($objPerson) {
                    printf("Deleting email: %s from %s %s\n", trim($line), $objPerson->FirstName, $objPerson->LastName);
                    $objPerson->PrimaryEmail->Delete();
                    // If there's a secondary email associated with the user set it as primary
                    $objSecondaryEmailArray = Email::LoadArrayByPersonId($objPerson->Id);
                    if (count($objSecondaryEmailArray) >= 1) {
                        foreach ($objSecondaryEmailArray as $objSecondEmail) {
                            printf("    Found secondary email object...%s\n", $objSecondEmail->Address);
                            if ($objSecondEmail->Address != trim($line)) {
                                $objPerson->PrimaryEmail = $objSecondEmail;
                                $objPerson->PrimaryEmail->SetAsPrimary();
                                printf("    Set email: %s as the new primary email.\n", $objSecondEmail->Address);
                                break;
                            }
开发者ID:alcf,项目名称:chms,代码行数:31,代码来源:clear-bounceback-emails.cli.php

示例4: btnUnsubscribe_Click

 protected function btnUnsubscribe_Click()
 {
     $objCommunicationListEntry = CommunicationListEntry::LoadByEmail($this->txtEmail->Text);
     $objEmailArray = Email::LoadArrayByAddress($this->txtEmail->Text);
     foreach ($objEmailArray as $objEmail) {
         $objPerson = Person::LoadByPrimaryEmailId($objEmail->Id);
         if ($objPerson != null) {
             $strUnsubscribedList = '';
             $success = false;
             foreach ($this->chkBtnListArray as $objItem) {
                 if ($objItem->Checked) {
                     $this->objList = CommunicationList::LoadByToken($objItem->Name);
                     if ($this->objList) {
                         $bFound = false;
                         if ($this->objList->IsPersonAssociated($objPerson)) {
                             $this->objList->UnassociatePerson($objPerson);
                             // If church newletter is the one being unsubscribed, document reason.
                             if ($this->lstTerminationReason->SelectedValue == -1) {
                                 $objAttributeOption = new AttributeOption();
                                 $objAttributeOption->AttributeId = $this->objAttributeValue->AttributeId;
                                 $objAttributeOption->Name = trim($this->txtOther->Text);
                                 $objAttributeOption->Save();
                                 $objAttributeValue = AttributeValue::LoadByAttributeIdPersonId($this->objAttribute->Id, $objPerson->Id);
                                 if ($objAttributeValue) {
                                     $objAttributeValue->SingleAttributeOption = $objAttributeOption;
                                     $objAttributeValue->Save();
                                 } else {
                                     $objAttributeValue = new AttributeValue();
                                     $objAttributeValue->AttributeId = $this->objAttribute->Id;
                                     $objAttributeValue->PersonId = $objPerson->Id;
                                     $objAttributeValue->SingleAttributeOption = $objAttributeOption;
                                     $objAttributeValue->Save();
                                     $objPerson->AssociateAttributeValue($objAttributeValue);
                                 }
                             } else {
                                 $objAttributeValue = AttributeValue::LoadByAttributeIdPersonId($this->objAttribute->Id, $objPerson->Id);
                                 if ($objAttributeValue) {
                                     $objAttributeValue->SingleAttributeOptionId = $this->lstTerminationReason->SelectedValue;
                                     $objAttributeValue->Save();
                                 } else {
                                     $objAttributeValue = new AttributeValue();
                                     $objAttributeValue->AttributeId = $this->objAttribute->Id;
                                     $objAttributeValue->PersonId = $objPerson->Id;
                                     $objAttributeValue->SingleAttributeOptionId = $this->lstTerminationReason->SelectedValue;
                                     $objAttributeValue->Save();
                                     $objPerson->AssociateAttributeValue($objAttributeValue);
                                 }
                             }
                             $strUnsubscribedList .= $objItem->Text . ',';
                             $success = true;
                             $bFound = true;
                         }
                         if (!$bFound) {
                             $this->lblMessage->Text = '(Person Entry) You cannot Unsubscribe because you are not subscribed to the ' . $objItem->Text . ' Mailing List.';
                             $this->lblMessage->Visible = true;
                         }
                     }
                 }
             }
             if ($success) {
                 $strUnsubscribedList = substr($strUnsubscribedList, 0, strlen($strUnsubscribedList) - 1);
                 QApplication::Redirect('/unsubscribe/success.php/' . urlencode($strUnsubscribedList) . '/' . $objPerson->Id);
             }
         }
     }
     if ($objCommunicationListEntry) {
         $strUnsubscribedList = '';
         $success = false;
         $bChecked = false;
         foreach ($this->chkBtnListArray as $objItem) {
             if ($objItem->Checked) {
                 $this->objList = CommunicationList::LoadByToken($objItem->Name);
                 if ($this->objList) {
                     $bFound = false;
                     if ($objCommunicationListEntry != null) {
                         if ($this->objList->IsCommunicationListEntryAssociated($objCommunicationListEntry)) {
                             $this->objList->UnassociateCommunicationListEntry($objCommunicationListEntry);
                             $strUnsubscribedList .= $objItem->Text . ',';
                             $success = true;
                             $bFound = true;
                         }
                     }
                     if (!$bFound) {
                         $this->lblMessage->Text = '(CommunicationsEntry) You cannot Unsubscribe because you are not subscribed to the ' . $objItem->Text . ' Mailing List.';
                         $this->lblMessage->Visible = true;
                     }
                 }
             }
         }
         if ($success) {
             $strUnsubscribedList = substr($strUnsubscribedList, 0, strlen($strUnsubscribedList) - 1);
             QApplication::Redirect('/unsubscribe/success.php/' . urlencode($strUnsubscribedList));
         }
     }
     $bChecked = false;
     foreach ($this->chkBtnListArray as $objItem) {
         if ($objItem->Checked) {
             $bChecked = true;
             break;
         }
//.........这里部分代码省略.........
开发者ID:alcf,项目名称:chms,代码行数:101,代码来源:index.php

示例5: QCliParameterProcessor

<?php

// Get arguments
$objParameters = new QCliParameterProcessor('email', 'Email to check against');
$objParameters->AddDefaultParameter('email', QCliParameterType::String, 'The email address to check for in group and email lists');
$objParameters->Run();
$txtEmail = $objParameters->GetDefaultValue('email');
$objEmailArray = Email::LoadArrayByAddress($txtEmail);
if (count($objEmailArray) > 0) {
    print "Found email objects\n";
    print "\n";
    $intPersonIdArray = array();
    foreach ($objEmailArray as $objEmail) {
        $objPerson = Person::LoadByPrimaryEmailId($objEmail->Id);
        if ($objPerson) {
            $intPersonIdArray[] = $objPerson->Id;
        }
    }
    print "GROUPS\n";
    $objGroupCursor = Group::QueryCursor(QQ::All());
    QDataGen::DisplayForEachTaskStart('Checking for email in Group Lists', Group::CountAll());
    while ($objGroup = Group::InstantiateCursor($objGroupCursor)) {
        QDataGen::DisplayForEachTaskNext('Checking for email in Group Lists');
        $objGroupParticipationArr = $objGroup->GetGroupParticipationArray();
        foreach ($objGroupParticipationArr as $objGroupParticipant) {
            if (in_array($objGroupParticipant->PersonId, $intPersonIdArray)) {
                printf("\n%s is in %s: %s\n", $txtEmail, $objGroup->Ministry->Name, $objGroup->Name);
                break;
            }
        }
    }
开发者ID:alcf,项目名称:chms,代码行数:31,代码来源:check-user-participation.cli.php

示例6: btnSubscribe_Click

 protected function btnSubscribe_Click()
 {
     $objCommunicationListEntry = CommunicationListEntry::LoadByEmail($this->txtEmail->Text);
     if (!$objCommunicationListEntry) {
         // create new entry and add to the communications list
         $objCommunicationListEntry = new CommunicationListEntry();
         $objCommunicationListEntry->Email = $this->txtEmail->Text;
         $objCommunicationListEntry->FirstName = $this->txtFirstName->Text;
         $objCommunicationListEntry->LastName = $this->txtLastName->Text;
         $objCommunicationListEntry->Save();
     }
     $strSubscribedList = '';
     $success = false;
     foreach ($this->chkBtnListArray as $objItem) {
         if ($objItem->Checked) {
             $this->objList = CommunicationList::LoadByToken($objItem->Name);
             if ($this->objList) {
                 if ($this->objList->IsCommunicationListEntryAssociated($objCommunicationListEntry)) {
                     $this->lblMessage->Text .= 'You are already subscribed to the "' . $objItem->Name . '" list';
                     $this->lblMessage->ForeColor = 'red';
                     $this->lblMessage->Visible = true;
                 } else {
                     // See if Person exists in Noah, and if so, then associate. Else associate the Communications Entry
                     $bFoundPerson = false;
                     $emailArray = Email::LoadArrayByAddress($this->txtEmail->Text);
                     foreach ($emailArray as $email) {
                         $objPerson = Person::LoadByPrimaryEmailId($email->Id);
                         if ($objPerson) {
                             if (!$this->objList->IsPersonAssociated($objPerson)) {
                                 $bFoundPerson = true;
                                 $this->objList->AssociatePerson($objPerson);
                             } else {
                                 $this->lblMessage->Text .= 'You are already subscribed to the "' . $objItem->Name . '" list';
                                 $this->lblMessage->ForeColor = 'red';
                                 $this->lblMessage->Visible = true;
                             }
                         }
                     }
                     if (!$bFoundPerson) {
                         $this->objList->AssociateCommunicationListEntry($objCommunicationListEntry);
                     }
                     $strSubscribedList .= $objItem->Name . ',';
                     $success = true;
                 }
             }
         } else {
             $this->lblMessage->Text .= 'You must select a list to subscribe to.';
             $this->lblMessage->ForeColor = 'red';
             $this->lblMessage->Visible = true;
         }
     }
     if ($success) {
         $strSubscribedList = substr($strSubscribedList, 0, strlen($strSubscribedList) - 1);
         // Send confirmation email here.
         $this->SendMessage($strSubscribedList);
         QApplication::Redirect('/subscribe/success.php/subscribed/' . urlencode($strSubscribedList));
     }
 }
开发者ID:alcf,项目名称:chms,代码行数:58,代码来源:index.php

示例7: btnAdd_Click

 public function btnAdd_Click()
 {
     $strEmail = trim(strtolower($this->txtEmail->Text));
     // Is this already a person?
     if (count($objEmailArray = Email::LoadArrayByAddress($strEmail, QQ::OrderBy(QQN::Email()->Id)))) {
         $objPersonToAdd = null;
         // If anyone in the resulting array has this email as "Primary" -- that person gets assigne
         foreach ($objEmailArray as $objEmail) {
             if (!$objPersonToAdd && $objEmail->Person->PrimaryEmailId == $objEmail->Id) {
                 $objPersonToAdd = $objEmail->Person;
             }
         }
         // Otherwise, assign the first person in the resultset
         if ($objPersonToAdd) {
             $this->objArrayToAdd[] = $objPersonToAdd;
         } else {
             $this->objArrayToAdd[] = $objEmailArray[0]->Person;
         }
         // No -- Is already an Entry?
     } else {
         if ($objEntry = CommunicationListEntry::LoadByEmail($strEmail)) {
             if ($strName = trim($this->txtFirstName->Text)) {
                 $objEntry->FirstName = $strName;
             }
             if ($strName = trim($this->txtMiddleName->Text)) {
                 $objEntry->MiddleName = $strName;
             }
             if ($strName = trim($this->txtLastName->Text)) {
                 $objEntry->LastName = $strName;
             }
             $this->objArrayToAdd[] = $objEntry;
             // No -- Add a New Entry
         } else {
             $objEntry = new CommunicationListEntry();
             $objEntry->FirstName = trim($this->txtFirstName->Text);
             $objEntry->MiddleName = trim($this->txtMiddleName->Text);
             $objEntry->LastName = trim($this->txtLastName->Text);
             $objEntry->Email = $strEmail;
             $this->objArrayToAdd[] = $objEntry;
         }
     }
     $this->dtgMembers->Refresh();
     $this->txtFirstName->Text = null;
     $this->txtMiddleName->Text = null;
     $this->txtLastName->Text = null;
     $this->txtEmail->Text = null;
     $this->txtEmail->Focus();
 }
开发者ID:alcf,项目名称:chms,代码行数:48,代码来源:add.php

示例8: Reconcile

 /**
  * Given data points supplied this will attempt to reconcile this PublicLogin record to an actual person... or if not possible,
  * it will create a new person record.
  * 
  * There are several stesp to this process.
  * First, do a Search of All People for the given Email
  * 		- if 1 and only 1 person was found:
  * 			+ Check the personal details of that persons record
  * 				- If matched against First/Last or Nickname/Last, setup the match
  * 				- If matched against DOB and/or Gender and/or Mobile, setup the match and update the name
  * 				- If not matched, create as new
  * 		- if no people were found
  * 			+ in all the DB, do a search to find matches against First/Last or Nickname/Last AND any address
  * 				- if exactly one is found, setup the match
  * 				- if non were found, create as new
  * 				- if multiple were found, find the first one that also match DOB and/or Gender and/or Mobile (or if none just find the first one) and setup the match
  * 		- if multiple people were found
  * 			+ WITHIN the set of found people, do a search to find matches against First/Last or Nickname/Last AND any address
  * 				- if exactly one is found, setup the match
  * 				- if non were found, create as new
  * 				- if multiple were found, find the first one that also match DOB and/or Gender and/or Mobile (or if none just find the first one) and setup the match
  * 
  * It will then check and see if the Person found (if any) already has a login object... if so, it will return that found Person record and do nothing further.
  * 
  * Otherwise, it will then update all data accordingly (including creating a new Person record, if needed) and return the Person that was created.
  * 
  * @param string $strPassword
  * @param string $strQuestion
  * @param string $strAnswer
  * @param string $strHomePhone
  * @param string $strMobilePhone
  * @param Address $objHomeAddress
  * @param Address $objMailingAddress optional
  * @param QDateTime $dttDateOfBirth optional
  * @param string $strGenderFlag optional
  * @return Person the person that was matched
  */
 public function Reconcile($strPassword, $strQuestion, $strAnswer, $strHomePhone, $strMobilePhone, Address $objHomeAddress, Address $objMailingAddress = null, QDateTime $dttDateOfBirth = null, $strGenderFlag = null)
 {
     // Try and Find a Person based on Email
     $objPersonArray = array();
     foreach (Email::LoadArrayByAddress($this->strEmailAddress) as $objEmail) {
         $objPersonArray[] = $objEmail->Person;
     }
     // Let's try and find a single Person object to reconcile for
     // 1 and only 1 person was found with the email
     if (count($objPersonArray) == 1) {
         if ($objPersonArray[0]->IsNameMatch($this->FirstName, $this->LastName)) {
             $objPerson = $objPersonArray[0];
         } else {
             if ($objPersonArray[0]->ScoreDobGenderMobileMatch($dttDateOfBirth, $strGenderFlag, $strMobilePhone) > 0) {
                 $objPerson = $objPersonArray[0];
             } else {
                 $objPerson = null;
             }
         }
         // MORE than one person was found with the email
     } else {
         if (count($objPersonArray)) {
             // Go through each of them and find a name-match and address-match
             $objMatchedPersonArray = array();
             foreach ($objPersonArray as $objPerson) {
                 if ($objPerson->IsNameAndAddressMatch($this->FirstName, $this->LastName, $objHomeAddress, $objMailingAddress)) {
                     $objMatchedPersonArray[] = $objPerson;
                 }
             }
             if (count($objMatchedPersonArray) == 1) {
                 $objPerson = $objMatchedPersonArray[0];
             } else {
                 if (!count($objMatchedPersonArray)) {
                     $objPerson = null;
                 } else {
                     $objPerson = $objMatchedPersonArray[0];
                     $intCurrentScore = 0;
                     foreach ($objMatchedPersonArray as $objMatchedPerson) {
                         $intScore = $objMatchedPerson->ScoreDobGenderMobileMatch($dttDateOfBirth, $strGenderFlag, $strMobilePhone);
                         if ($intScore > $intCurrentScore) {
                             $intCurrentScore = $intScore;
                             $objPerson = $objMatchedPerson;
                         }
                     }
                 }
             }
             // NO ONE was found with the email
         } else {
             // First pull the ones with Name Matched
             $objPersonArray = Person::LoadArrayByNameMatch($this->FirstName, $this->LastName);
             // Go through each of those and find address-match records
             $objMatchedPersonArray = array();
             foreach ($objPersonArray as $objPerson) {
                 if ($objPerson->IsNameAndAddressMatch($this->FirstName, $this->LastName, $objHomeAddress, $objMailingAddress)) {
                     $objMatchedPersonArray[] = $objPerson;
                 }
             }
             if (count($objMatchedPersonArray) == 1) {
                 $objPerson = $objMatchedPersonArray[0];
             } else {
                 if (!count($objMatchedPersonArray)) {
                     $objPerson = null;
                 } else {
//.........这里部分代码省略.........
开发者ID:alcf,项目名称:chms,代码行数:101,代码来源:ProvisionalPublicLogin.class.php


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