Return multiples Gravatar profiles based on the provided array of emails addresses.

@param array $aEmail The emails list to get the Gravatar profiles for.
@param string $sFormat The profile format to use.
@return array
977791
public static function profiles(array $aEmail, $sFormat = null)
    {
        $aProfils = [];

        foreach ($aEmail as $sEmail) {
            $gravatarProfil = (new Profile())
                ->setEmail($sEmail)
                ->setFormat($sFormat);

            $aProfils[$sEmail] = $gravatarProfil;
        }

        return $aProfils;
    }
1266831
public function getSalesDataForSubscribersWithOrderStatusesAndBrand($emails, $websiteId)
    {
        $orderStatuses = $this->config->getWebsiteConfig(
            Config::XML_PATH_CONNECTOR_SYNC_DATA_FIELDS_STATUS,
            $websiteId
        );
        $orderStatuses = explode(',', $orderStatuses);

        $orderCollection = $this->orderCollectionFactory->create()
            ->addFieldToSelect(['customer_email'])
            ->addExpressionFieldToSelect('total_spend', 'SUM({{grand_total}})', 'grand_total')
            ->addExpressionFieldToSelect('number_of_orders', 'COUNT({{*}})', '*')
            ->addExpressionFieldToSelect('average_order_value', 'AVG({{grand_total}})', 'grand_total')
            ->addFieldToFilter('customer_email', ['in' => $emails]);

        $columns = $this->buildCollectionColumns();
        $orderCollection->getSelect()
            ->columns($columns)
            ->group('customer_email');

        if (! empty($orderStatuses)) {
            $orderCollection->getSelect()->where('status in (?)', $orderStatuses);
        }

        $orderArray = [];
        foreach ($orderCollection as $item) {
            $orderArray[$item->getCustomerEmail()] = $item->toArray(
                [
                    'total_spend',
                    'number_of_orders',
                    'average_order_value',
                    'last_order_date',
                    'first_order_id',
                    'last_order_id',
                    'last_increment_id',
                    'product_id_for_first_brand',
                    'product_id_for_last_brand',
                    'week_day',
                    'month_day',
                    'product_id_for_most_sold_product'
                ]
            );
        }

        return $orderArray;
    }
1073280
public function getByEmail($email)
    {
        $filter = new IteratorFilter();
        $filter->addRelation($this->getUserDefinition()->getEmail(), Relation::EQUAL, strtolower($email));
        return $this->getUser($filter);
    }
13805
protected function getToAddresses( Swift_Mime_Message $message )
	{
		$to = [];

		if ( $message->getTo() )
			$to = array_merge( $to, array_keys( $message->getTo() ) );

		if ( $message->getCc() )
			$to = array_merge( $to, array_keys( $message->getCc() ) );

		if ( $message->getBcc() )
			$to = array_merge( $to, array_keys( $message->getBcc() ) );

		return $to;
	}
692407
public static function emailEncode($sEmail)
	{
		$sEmail = bin2hex($sEmail);
		$sEmail = chunk_split($sEmail, 2, '%');
		$sEmail = '%' . substr($sEmail, 0, strlen($sEmail) - 1);
		return $sEmail;
	}
297009
private function getEmailObject($emails)
    {
        // Try to find an email address which is primary and verified.
        foreach ($emails as $email) {
            if ($email[ 'primary' ] && $email[ 'verified' ]) {
                return $email;
            }
        }

        // Try to find an email address which is primary.
        foreach ($emails as $email) {
            if ($email[ 'primary' ]) {
                return $email;
            }
        }

        return $emails[ 0 ];
    }
682897
public function JSObfuscateEmails($html)
    {
        $this->list = ArrayList::create();
        $regex_email = '[:_a-z0-9-+]+(\.[_a-z0-9-+]+)*@[a-z0-9-]+(\.[a-z0-9]+)*(\.[a-z]{2,4})';
        $regex_attributes = "((?:\w+\s*=\s*)(?:\w+|\"[^\"]*\"|'[^']*'))*?";
        $regex_email_query = "(?:\?[A-Za-z0-9_= %\.\-\~\_\&;\!\*\(\)\'#&]*)?)";
        $regex_email_href = "href\s*=\s*(['\"])mailto:(".$regex_email.$regex_email_query."\\2";
        $whitespace = "\s*";
        $tag_regex = "/<a\s+".$regex_attributes/* 1 */.$whitespace.$regex_email_href/* 3,5,6 */.$whitespace.$regex_attributes/* 7 */.">(.*?)<\/a>/i";
        $tag_replacement = "/<a\s+".$regex_attributes/* 1 */.$whitespace.$regex_email_href/* 3,5,6 */.$whitespace.$regex_attributes/* 7 */.">(.*?)<\/a>/i";

        // First we convert all a tag Emails
        $html = preg_replace_callback($tag_regex, "self::callbackTag", $html);

        // Then we convert all plain text Emails
        $plaintext_regex = "/\b(?<!value=['\"])".$regex_email."\b(?<!['\"])/i";
        $html = preg_replace_callback($plaintext_regex, "self::callbackPlainText", $html);

        $list = array();
        foreach ($this->list as $email) {
            $list[$email->getID()] = $email->getObfuscatedEmail();
        }
        $list = Convert::array2json($list);
        $script = "<script type='text/javascript'>
        window.addEventListener('DOMContentLoaded', function(){
            var emaillist = $list;
            setTimeout(function(){
                $('a[data-obfuscate]').each(function(index){
                    var emailid = $(this).data('obfuscate'),
                        email = emaillist[emailid];
                    if(email != 'undefined') {
                        $(this).attr('href', 'mailto:' + email[1] + '@' + email[0]).attr('data-obfuscate', '');
                    }
                });
                $('span[data-obfuscate]').each(function(index){
                    var emailid = $(this).data('obfuscate'),
                        email = emaillist[emailid];
                    if(email != 'undefined') {
                        $(this).html(email[1] + '@' + email[0]);
                    }
                });
            }, 2000);
        });
        </script>";
        $html = str_ireplace('</body>', $script.'</body>', $html);
        return $html;
    }
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);
	}
593824
public function getContactData($addressData, $contact)
    {
        $result = array();
        // if account is set, take account's name
        if ($addressData && isset($addressData['firstName']) && isset($addressData['lastName'])) {
            $result['firstName'] = $addressData['firstName'];
            $result['lastName'] = $addressData['lastName'];
            $result['fullName'] = $result['firstName'] . ' ' . $result['lastName'];
            if (isset($addressData['title'])) {
                $result['title'] = $addressData['title'];
            }
            if (isset($addressData['salutation'])) {
                $result['salutation'] = $addressData['salutation'];
            }
        } else {
            if ($contact) {
                $result['firstName'] = $contact->getFirstName();
                $result['lastName'] = $contact->getLastName();
                $result['fullName'] = $contact->getFullName();
                $result['salutation'] = $contact->getFormOfAddress();
                if ($contact->getTitle() !== null) {
                    $result['title'] = $contact->getTitle()->getTitle();
                }
            } else {
                throw new MissingOrderAttributeException('firstName, lastName or contact');
            }
        }

        return $result;
    }
850427
protected function sortMail($mail)
    {
        // Can't sort an empty array.
        if (count($mail) === 0) {
            return [];
        }

        // To, subject and body keys must be present.
        // Empty strings are ignored when matching so adding them is harmless.
        foreach ($mail as $key => $row) {
            if (!array_key_exists('to', $row)) {
                $mail[$key]['to'] = '';
            }
            if (!array_key_exists('subject', $row)) {
                $mail[$key]['subject'] = '';
            }
            if (!array_key_exists('body', $row)) {
                $mail[$key]['body'] = '';
            }
        }

        // Obtain a list of columns.
        foreach ($mail as $key => $row) {
            if (array_key_exists('to', $row)) {
                $to[$key] = $row['to'];
            }
            if (array_key_exists('subject', $row)) {
                $subject[$key] = $row['subject'];
            }
            if (array_key_exists('body', $row)) {
                $body[$key] = $row['body'];
            }
        }

        // Add $mail as the last parameter, to sort by the common key.
        array_multisort($to, SORT_ASC, $subject, SORT_ASC, $body, SORT_ASC, $mail);
        return $mail;
    }
1249969
public function checkIfEmailExists($sEmail)
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
        $masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
        $iShopId = $myConfig->getShopId();
        $blExists = false;

        $sQ = 'select oxshopid, oxrights, oxpassword from oxuser where oxusername = ' . $masterDb->quote($sEmail);
        if (($sOxid = $this->getId())) {
            $sQ .= " and oxid <> " . $masterDb->quote($sOxid);
        }
        $oRs = $masterDb->select($sQ, false);
        if ($oRs != false && $oRs->count() > 0) {
            if ($this->_blMallUsers) {
                $blExists = true;
                if ($oRs->fields[1] == 'user' && !$oRs->fields[2]) {
                    // password is not set - allow to override
                    $blExists = false;
                }
            } else {
                $blExists = false;
                while (!$oRs->EOF) {
                    if ($oRs->fields[1] != 'user') {
                        // exists admin with same login - must not allow
                        $blExists = true;
                        break;
                    } elseif ($oRs->fields[0] == $iShopId && $oRs->fields[2]) {
                        // exists same login (with password) in same shop
                        $blExists = true;
                        break;
                    }

                    $oRs->fetchRow();
                }
            }
        }

        return $blExists;
    }
601263
public static function findIdentityByUsernameOrEmail($usernameOrEmail) {
    if (filter_var($usernameOrEmail, FILTER_VALIDATE_EMAIL)) {
      return self::findUserByEmail($usernameOrEmail);
    }
    return User::findIdentityByUsername($usernameOrEmail);
  }
47718
private function getLoggingEmails($mail, $parts)
    {
        $emailAddresses = $this->flattenEmailAddresses(
            $this->getAllEmailAddresses($parts)
        );

        $messageIds = [];
        $headers    = $mail->getHeaders();
        if (!empty($headers) && $headers->has('message-id')) {
            $messageId = $headers->get('message-id');
            if ($messageId instanceof ArrayIterator) {
                foreach ($messageId as $header) {
                    /** @var $header HeaderInterface */
                    $messageIds[] = $header->getFieldValue();
                }
            } elseif ($messageId instanceof HeaderInterface) {
                $messageIds = [$messageId->getFieldValue()];
            }
        }

        /*
         * Also strip < and > from message id to only return the email-like id
         */
        $messageIds = array_map(function ($messageId) {
            return trim($messageId, " \t\n\r\0\x0B<>");
        }, $messageIds);

        return array_merge($emailAddresses, $messageIds);
    }
529347
public function setFormat($sFormat = null)
    {
        if (null === $sFormat) {
            return $this;
        }

        if (!in_array($sFormat, $this->aValidFormats)) {
            $message = sprintf(
                'The format "%s" is not a valid one, profile format for Gravatar can be: %s',
                $sFormat,
                implode(', ', $this->aValidFormats)
            );

            throw new InvalidProfileFormatException($message);
        }

        $this->sFormat = $sFormat;

        return $this;
    }
412223
public function findUserByUsernameOrEmail($usernameOrEmail)
    {
        if (filter_var($usernameOrEmail, FILTER_VALIDATE_EMAIL)) {
            return $this->findUserByEmail($usernameOrEmail);
        }

        return $this->findUserByUsername($usernameOrEmail);
    }
476748
public static function find_by_email($email, $exclude = array())
	{
		if (empty($email))
		{
			return false;
		}

		$query = self::all()
			->whereEquals('email', $email);

		if (!empty($exclude[0]))
		{
			foreach ($exclude as $e)
			{
				$query->where('auth_domain_id', '!=', $e);
			}
		}

		$rows = $query->rows();

		$results = array();

		foreach ($rows as $row)
		{
			$result = $row->toArray();
			$result['auth_domain_name'] = $row->domain->get('authenticator');

			$results[] = $result;
		}

		if (empty($results))
		{
			return false;
		}

		return $results;
	}
516017
private function getAccessLevels($email)
    {
        foreach ($this->hostedDomains as $hostedDomain) {
            if (preg_match('/'.$hostedDomain['domain_name'].'$/', $email)) {
                return $hostedDomain['access_levels'];
            }
        }

        return null;
    }