Find a member by e-mail-address

@param string $strEmail   The e-mail address
@param array  $arrOptions An optional options array

@return \Model|null The model or null if there is no member
168720
public static function findByEmail($strEmail, array $arrOptions = [])
	{
		$time = time();
		$t    = static::$strTable;

		$arrColumns = ["LOWER($t.email)=? AND ($t.start='' OR $t.start<$time) AND ($t.stop='' OR $t.stop>$time)"];

		return static::findOneBy($arrColumns, [$strEmail], $arrOptions);
	}
111127
private function __findAro($aro) {
        
        
        if(isset($aro->parent_id)) {
            $conditions = [
                'parent_id' => $aro->parent_id,
                'foreign_key' => $aro->foreign_key,
                'model' => $aro->model
            ];
        } else {
            $conditions = [
                'parent_id IS NULL',
                'foreign_key' => $aro->foreign_key,
                'model' => $aro->model
            ];
        }

        return $this->Acl->Aro->find('all', [
            'conditions' => $conditions,
            'recursive' => -1
        ])->count();
    }
8335
public function getByRef($sRef, $aData = [])
    {
        if (empty($aData['where'])) {
            $aData['where'] = [];
        }

        $aData['where'][] = [$this->sTableAlias . '.ref', $sRef];

        $aEmails = $this->getAll(null, null, $aData);

        return !empty($aEmails) ? reset($aEmails) : false;
    }
40544
public function findGmailUserByEmailAlias(string $emailAliasAddress)
    {
        /** @var GmailUserInterface $user */
        foreach ($this->gmailUsers as $user) {
            foreach ($user->getEmailAliases() as $emailAlias) {
                if ($emailAlias === $emailAliasAddress) {
                    return $user;
                }
            }
        }

        return;
    }
785574
public function findFile($strClass)
    {
        if (isset($this->classmap[$strClass])) {
            $strFile = $this->classmap[$strClass];
        }
        else {
            $strFile = $this->composerAutoloader->findFile($strClass);
        }

        if ($strFile && file_exists($strFile)) {
            return $strFile;
        }
        else {
            return null;
        }
    }
295323
public function getAdressesLieesAEvenement($params = array())
    {
        $html="";
        $req = "SELECT distinct idEvenementGroupeAdresse
				FROM _evenementAdresseLiee
				WHERE idEvenement=".$params['idEvenement']."";
        $res = $this->connexionBdd->requete($req);
        $a = new archiAdresse();
        while ($fetch = mysql_fetch_assoc($res)) {
            switch ($params['modeRetour']) {
                case 'affichageHTML':
                    $intituleAdresse = stripslashes($a->getIntituleAdresseFrom($fetch['idEvenementGroupeAdresse'], 'idEvenementGroupeAdresse', array('displayFirstTitreAdresse'=>true)));
                    $html.=$intituleAdresse."(<a style='cursor:pointer;' onclick=\"retirerGroupeAdresse(".$fetch['idEvenementGroupeAdresse'].")\">-</a>)<br>";
                    break;
                case 'optionsListeSelect':
                    $intituleAdresse = stripslashes($a->getIntituleAdresseFrom($fetch['idEvenementGroupeAdresse'], 'idEvenementGroupeAdresse', array('displayFirstTitreAdresse'=>true)));
                    $html.="<option value='".$fetch['idEvenementGroupeAdresse']."' SELECTED>".$intituleAdresse."</option>";
                    break;
                case 'affichageSurDetailEvenement':
                    $intituleAdresse = stripslashes($a->getIntituleAdresseFrom($fetch['idEvenementGroupeAdresse'], 'idEvenementGroupeAdresse', array('displayFirstTitreAdresse'=>true)));
                    $idAdresse = $a->getIdAdresseFromIdEvenementGroupeAdresse($fetch['idEvenementGroupeAdresse']);
                    $html.="<a href='".$this->creerUrl('', '', array('archiAffichage'=>'adresseDetail','archiIdAdresse'=>$idAdresse,'archiIdEvenementGroupeAdresse'=>$fetch['idEvenementGroupeAdresse']))."'>".$intituleAdresse."</a><br>";
                    break;
            }
        }
        return $html;
    }
1372841
public function findUserByEmail($sEmail)
    {
        if (empty($sEmail)) {
            return null;
        }

        return \Lovata\Buddies\Models\User::getByEmail($sEmail)->first();
    }
1193127
protected static function convertRouteStrToArray($strRoute)
    {
/*
        try {
            $route = @eval("return $strRoute;"); // security problem
        } catch (Exception $ex) {
            return false;
        }
*/
        $str = trim($strRoute);
        if (substr($str, 0, 1) == '[' && substr($str, -1, 1) == ']') {
            $str = trim($str, "[]");
        } else {
            static::$errorRouteConvert = "Array syntax: not found '[' or ']'";
            return false;
        }
        $array = [];
        $i = 0;
        $parts = explode(',', $str);
        foreach ($parts as $next) {
            $element = explode("=>", $next);
            if (is_array($element) && count($element) == 1) {
                $val = trim($element[0]);
                if ((substr($val, 0, 1) == '"' && substr($val, -1, 1) == '"')
                 || (substr($val, 0, 1) == "'" && substr($val, -1, 1) == "'")
                ) {
                    $array[$i++] = trim($val, "\"'");
                } else {
                    static::$errorRouteConvert = "Array element syntax: '$val'";
                    return false;
                }
            } elseif (is_array($element) && count($element) == 2) {
                $key = trim($element[0]);
                $val = trim($element[1]);
                if (
                    ((substr($key, 0, 1) == '"' && substr($key, -1, 1) == '"') ||
                     (substr($key, 0, 1) == "'" && substr($key, -1, 1) == "'"))
                 &&
                    ((substr($val, 0, 1) == '"' && substr($val, -1, 1) == '"') ||
                     (substr($val, 0, 1) == "'" && substr($val, -1, 1) == "'") ||
                     is_numeric($val))
                ) {
                    $array[trim($key, "\"'")] = trim($val, "\"'");
                } else {
                    static::$errorRouteConvert = "Array element syntax: '$key => $val'";
                    return false;
                }
            } else {
                static::$errorRouteConvert = "Array element syntax";
                return false;
            }
        }
        return $array;
    }
1116923
public function getContactsSuppressedSinceDate(
        $dateString,
        $select = 1000,
        $skip = 0
    ) {
        $url = $this->getApiEndpoint() . self::REST_CONTACTS_SUPPRESSED_SINCE
            . $dateString . '?select=' . $select . '&skip=' . $skip;
        $this->setUrl($url)
            ->setVerb('GET');

        $response = $this->execute();

        if (isset($response->message)) {
            $message = 'GET CONTACTS SUPPRESSED SINSE : ' . $dateString
                . ' select ' . $select . ' skip : ' . $skip . '   response : '
                . $response->message;
            $this->helper->debug('getContactsSuppressedSinceDate', [$message]);
        }

        return $response;
    }
204520
public static function tryParse(string $emailAddress): ?EmailAddressInterface
    {
        if (!self::myParse($emailAddress, $username, $host)) {
            return null;
        }

        return new self($username, $host);
    }
1022181
public function sendReminder($method = null)
    {
        if ($method) {
            if (!in_array($method, array('Email', 'Letter')))
                throw new InvalidFieldValueError("'method' must be either " .
                    "'Email' or 'Letter'");

            return $this->performEvent('remind', array('method' => $method));
        }

        return $this->performEvent('remind');
    }
1053788
public function findPublishedByAlias($strAlias, array $arrOptions=array())
	{
		$t = static::$strTable;

		$arrColumns = array("$t.alias=? AND $t.invisible=''");
	
		return static::findOneBy($arrColumns, $strAlias, $arrOptions);
	}
1130399
public function &options($strProperty){
		$strProperty = $this->_formatPropertyName($strProperty);
		if($this->hasProperty($strProperty)){
			if(array_key_exists($strProperty, $this->_arrOptions)){
				return $this->_arrOptions[$strProperty];
			}
		}
		return false;
	}
842240
private static function findByRel(array $a, $rel)
    {
        $relName = mb_strtolower($rel, 'UTF-8');
        foreach ($a as $name => $value) {
            if (mb_strtolower($name, 'UTF-8') === $relName) {
                return $value;
            }
        }
        
        return null;
    }
1197526
protected function getMailData($sTpl, array $aVars = [])
    {
        $sSubject = $sHtml = $sPlain = null;

        $aTplData = explode('######', $this->renderMail($sTpl, $aVars));
        $aTplData = array_map('trim', $aTplData);

        foreach ($aTplData as $sRow) {
            $aParts = array_map('trim', explode(':', $sRow, 2));

            switch (strtolower($aParts[0])) {
                case 'subject':
                    $sSubject = $aParts[1];
                    break;

                case 'html':
                    $sHtml = $aParts[1];
                    break;

                case 'plain':
                    $sPlain = $aParts[1];
                    break;

                default:
            }
        }

        if ($sSubject === null) {
            $sSubject = 'Missing subject';
        }

        if ($sHtml === null) {
            $sHtml = 'Missing html content';
        }

        if ($sPlain === null) {
            $oHtmlConverter = $this->getHtml2Text();
            $oHtmlConverter->setHtml($sHtml);
            $sPlain = $oHtmlConverter->getText();
        }

        return [
            'subject' => $sSubject,
            'html' => $sHtml,
            'plain' => $sPlain,
        ];
    }
830985
public function lookupColumnPropertyName($strColumnName){
		$objColumn = $this->getColumnByName($strColumnName);
		if ($objColumn)
			return $objColumn->PropertyName;
		else
			return null;
	}
260361
public function deleteReferral($strAccountSlug, $strAdvocateToken, $intReferralId) {
        $objWebClient = $this->getWebClient();

        $strUri = $this->getApiUrl() . '/accounts/' . $strAccountSlug . '/advocates/' . $strAdvocateToken . '/referrals/' . $intReferralId;
        $arrHeaders = $this->getHeaders();

        $objRequest = $objWebClient->delete($strUri, $arrHeaders);

        $this->objResponse = $objRequest->send();

        return $this->objResponse;
    }