本文整理匯總了PHP中MailSo\Base\Utils::IdnToAscii方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utils::IdnToAscii方法的具體用法?PHP Utils::IdnToAscii怎麽用?PHP Utils::IdnToAscii使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MailSo\Base\Utils
的用法示例。
在下文中一共展示了Utils::IdnToAscii方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* @access private
*
* @param string $sEmail
* @param string $sDisplayName = ''
* @param string $sRemark = ''
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
*/
private function __construct($sEmail, $sDisplayName = '', $sRemark = '')
{
if (!\MailSo\Base\Validator::NotEmptyString($sEmail, true)) {
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
}
$this->sEmail = \MailSo\Base\Utils::IdnToAscii(\trim($sEmail), true);
$this->sDisplayName = \trim($sDisplayName);
$this->sRemark = \trim($sRemark);
}
示例2: convertGoogleJsonContactToResponseContact
/**
* @param array $oItem
* @param array $aPics
*
* @return array|null
*/
private function convertGoogleJsonContactToResponseContact($oItem, &$aPics)
{
$mResult = null;
if (!empty($oItem['gd$email'][0]['address'])) {
$mEmail = \MailSo\Base\Utils::IdnToAscii($oItem['gd$email'][0]['address'], true);
if (\is_array($oItem['gd$email']) && 1 < \count($oItem['gd$email'])) {
$mEmail = array();
foreach ($oItem['gd$email'] as $oEmail) {
if (!empty($oEmail['address'])) {
$mEmail[] = \MailSo\Base\Utils::IdnToAscii($oEmail['address'], true);
}
}
}
$sImg = '';
if (!empty($oItem['link']) && \is_array($oItem['link'])) {
foreach ($oItem['link'] as $oLink) {
if ($oLink && isset($oLink['type'], $oLink['href'], $oLink['rel']) && 'image/*' === $oLink['type'] && '#photo' === \substr($oLink['rel'], -6)) {
$sImg = $oLink['href'];
break;
}
}
}
$mResult = array('email' => $mEmail, 'name' => !empty($oItem['title']['$t']) ? $oItem['title']['$t'] : '');
if (0 < \strlen($sImg)) {
$sHash = \RainLoop\Utils::EncodeKeyValues(array('url' => $sImg, 'type' => 'google_access_token'));
$mData = array();
if (isset($aPics[$sHash])) {
$mData = $aPics[$sHash];
if (!\is_array($mData)) {
$mData = array($mData);
}
}
if (\is_array($mEmail)) {
$mData = \array_merge($mData, $mEmail);
$mData = \array_unique($mData);
} else {
if (0 < \strlen($mEmail)) {
$mData[] = $mEmail;
}
}
if (\is_array($mData)) {
if (1 === \count($mData) && !empty($mData[0])) {
$aPics[$sHash] = $mData[0];
} else {
if (1 < \count($mData)) {
$aPics[$sHash] = $mData;
}
}
}
}
}
return $mResult;
}
示例3: SetParentEmail
/**
* @param string $sParentEmail
*
* @return void
*/
public function SetParentEmail($sParentEmail)
{
$this->sParentEmail = \trim(\MailSo\Base\Utils::IdnToAscii($sParentEmail, true));
}
示例4: RawAvatar
/**
* @return bool
*/
public function RawAvatar()
{
$sData = '';
$sRawKey = (string) $this->GetActionParam('RawKey', '');
$sRawKey = \urldecode($sRawKey);
$this->verifyCacheByKey($sRawKey);
if (0 < \strlen($sRawKey) && \preg_match('/^[^@]+@([^@]+)$/', $sRawKey)) {
$sEmail = \MailSo\Base\Utils::IdnToAscii($sRawKey, true);
$iCode = 0;
$sContentType = '';
$sData = $this->Http()->GetUrlAsString('http://gravatar.com/avatar/' . \md5($sEmail) . '.jpg?s=80&d=404', null, $sContentType, $iCode, $this->Logger(), 5, $this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''));
$sContentType = \strtolower(\trim($sContentType));
if (200 !== $iCode || empty($sData) || !\in_array($sContentType, array('image/jpeg', 'image/jpg', 'image/png'))) {
$sData = '';
$aMatch = array();
if (\preg_match('/^[^@]+@([a-z0-9\\-\\.]+)$/', $sEmail, $aMatch) && !empty($aMatch[1])) {
$sDomain = $aMatch[1];
if (\file_exists(APP_VERSION_ROOT_PATH . 'app/resources/images/services/' . $sDomain . '.png')) {
$sContentType = 'image/png';
$sData = \file_get_contents(APP_VERSION_ROOT_PATH . 'app/resources/images/services/' . $sDomain . '.png');
}
}
}
}
if (empty($sData) || empty($sContentType)) {
$sContentType = 'image/png';
$sData = \file_get_contents(APP_VERSION_ROOT_PATH . 'app/resources/images/empty-contact.png');
}
$this->cacheByKey($sRawKey);
\header('Content-Type: ' . $sContentType);
echo $sData;
return true;
}
示例5: SetEmail
/**
* @param string $sEmail
*
* @return \RainLoop\Identity
*/
public function SetEmail($sEmail)
{
$this->sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail, true);
return $this;
}
示例6: ClearUserData
/**
* @param string $sEmail
*
* @return bool
*/
public static function ClearUserData($sEmail)
{
if (0 < \strlen($sEmail)) {
$sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
$oStorageProvider = \RainLoop\Api::Actions()->StorageProvider();
if ($oStorageProvider && $oStorageProvider->IsActive()) {
$oStorageProvider->DeleteStorage($sEmail);
}
if (\RainLoop\Api::Actions()->AddressBookProvider() && \RainLoop\Api::Actions()->AddressBookProvider()->IsActive()) {
\RainLoop\Api::Actions()->AddressBookProvider()->DeleteAllContacts($sEmail);
}
return true;
}
return false;
}
示例7: ClearUserData
/**
* @param string $sEmail
*
* @return bool
*/
public static function ClearUserData($sEmail)
{
if (0 < \strlen($sEmail)) {
$sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
$oStorageProvider = \RainLoop\Api::Actions()->StorageProvider();
if ($oStorageProvider && $oStorageProvider->IsActive()) {
// TwoFactor Auth User Data
$oStorageProvider->Clear(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, \RainLoop\KeyPathHelper::TwoFactorAuthUserData($sEmail));
// Accounts list
$oStorageProvider->Clear(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, \RainLoop\KeyPathHelper::WebmailAccounts($sEmail));
// Contact sync data
$oStorageProvider->Clear($sEmail, \RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG, 'contacts_sync');
}
\RainLoop\Api::Actions()->SettingsProvider()->ClearByEmail($sEmail);
if (\RainLoop\Api::Actions()->AddressBookProvider() && \RainLoop\Api::Actions()->AddressBookProvider()->IsActive()) {
\RainLoop\Api::Actions()->AddressBookProvider()->DeleteAllContactsAndTags($sEmail);
}
return true;
}
return false;
}
示例8: Login
/**
* @param string $sLogin
* @param string $sPassword
* @param string $sProxyAuthUser = ''
* @param bool $bUseAuthPlainIfSupported = false
*
* @return \MailSo\Imap\ImapClient
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
*/
public function Login($sLogin, $sPassword, $sProxyAuthUser = '', $bUseAuthPlainIfSupported = false)
{
if (!\MailSo\Base\Validator::NotEmptyString($sLogin, true) || !\MailSo\Base\Validator::NotEmptyString($sPassword, true)) {
$this->writeLogException(new \MailSo\Base\Exceptions\InvalidArgumentException(), \MailSo\Log\Enumerations\Type::ERROR, true);
}
$sLogin = \trim($sLogin);
$sLogin = \MailSo\Base\Utils::IdnToAscii($sLogin);
$sPassword = $sPassword;
$this->sLogginedUser = $sLogin;
try {
if ($bUseAuthPlainIfSupported && $this->IsSupported('AUTH=PLAIN')) {
if ($this->oLogger) {
$this->oLogger->AddSecret(\base64_encode("" . $sLogin . "" . $sPassword));
}
$this->SendRequestWithCheck('AUTHENTICATE', array('PLAIN', \base64_encode("" . $sLogin . "" . $sPassword)));
} else {
if ($this->oLogger) {
$this->oLogger->AddSecret($this->EscapeString($sPassword));
}
$this->SendRequestWithCheck('LOGIN', array($this->EscapeString($sLogin), $this->EscapeString($sPassword)));
}
// else
// {
// $this->writeLogException(
// new \MailSo\Imap\Exceptions\LoginBadMethodException(),
// \MailSo\Log\Enumerations\Type::NOTICE, true);
// }
if (0 < \strlen($sProxyAuthUser)) {
$this->SendRequestWithCheck('PROXYAUTH', array($this->EscapeString($sProxyAuthUser)));
}
} catch (\MailSo\Imap\Exceptions\NegativeResponseException $oException) {
$this->writeLogException(new \MailSo\Imap\Exceptions\LoginBadCredentialsException($oException->GetResponses(), '', 0, $oException), \MailSo\Log\Enumerations\Type::NOTICE, true);
}
$this->bIsLoggined = true;
$this->aCapabilityItems = null;
return $this;
}
示例9: Vrfy
/**
* @return \MailSo\Smtp\SmtpClient
*
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
*/
public function Vrfy($sUser)
{
$sUser = \MailSo\Base\Utils::IdnToAscii(\MailSo\Base\Utils::Trim($sUser));
$this->sendRequestWithCheck('VRFY', array(250, 251, 252), $sUser);
return $this;
}
示例10: Load
/**
* @param string $sName
* @param bool $bFindWithWildCard = false
* @param bool $bCheckDisabled = true
*
* @return \RainLoop\Model\Domain|null
*/
public function Load($sName, $bFindWithWildCard = false, $bCheckDisabled = true)
{
$mResult = null;
$sDisabled = '';
$sFoundedValue = '';
$sRealFileName = $this->codeFileName($sName);
if (\file_exists($this->sDomainPath . '/disabled')) {
$sDisabled = @\file_get_contents($this->sDomainPath . '/disabled');
}
if (\file_exists($this->sDomainPath . '/' . $sRealFileName . '.ini') && (!$bCheckDisabled || 0 === \strlen($sDisabled) || false === \strpos(',' . $sDisabled . ',', ',' . \MailSo\Base\Utils::IdnToAscii($sName, true) . ','))) {
$aDomain = \RainLoop\Utils::CustomParseIniFile($this->sDomainPath . '/' . $sRealFileName . '.ini');
// fix misspellings (#119)
if (\is_array($aDomain)) {
if (isset($aDomain['smpt_host'])) {
$aDomain['smtp_host'] = $aDomain['smpt_host'];
}
if (isset($aDomain['smpt_port'])) {
$aDomain['smtp_port'] = $aDomain['smpt_port'];
}
if (isset($aDomain['smpt_secure'])) {
$aDomain['smtp_secure'] = $aDomain['smpt_secure'];
}
if (isset($aDomain['smpt_auth'])) {
$aDomain['smtp_auth'] = $aDomain['smpt_auth'];
}
}
//---
$mResult = \RainLoop\Model\Domain::NewInstanceFromDomainConfigArray($sName, $aDomain);
} else {
if ($bFindWithWildCard) {
$sNames = $this->getWildcardDomainsLine();
if (0 < \strlen($sNames)) {
if (\RainLoop\Plugins\Helper::ValidateWildcardValues(\MailSo\Base\Utils::IdnToUtf8($sName, true), $sNames, $sFoundedValue) && 0 < \strlen($sFoundedValue)) {
if (!$bCheckDisabled || 0 === \strlen($sDisabled) || false === \strpos(',' . $sDisabled . ',', ',' . $sFoundedValue . ',')) {
$mResult = $this->Load($sFoundedValue, false);
}
}
}
}
}
return $mResult;
}
示例11: FromJSON
/**
* @param array $aData
* @param bool $bAjax = false
*
* @return bool
*/
public function FromJSON($aData, $bAjax = false)
{
if (isset($aData['Id'], $aData['Email']) && !empty($aData['Email'])) {
$this->sId = $aData['Id'];
$this->sEmail = $bAjax ? \MailSo\Base\Utils::IdnToAscii($aData['Email'], true) : $aData['Email'];
$this->sName = isset($aData['Name']) ? $aData['Name'] : '';
$this->sReplyTo = !empty($aData['ReplyTo']) ? $aData['ReplyTo'] : '';
$this->sBcc = !empty($aData['Bcc']) ? $aData['Bcc'] : '';
$this->sSignature = !empty($aData['Signature']) ? $aData['Signature'] : '';
$this->bSignatureInsertBefore = isset($aData['SignatureInsertBefore']) ? $bAjax ? '1' === $aData['SignatureInsertBefore'] : !!$aData['SignatureInsertBefore'] : true;
return true;
}
return false;
}
示例12: UpdateInstance
/**
* @param string $sIncHost
* @param int $iIncPort
* @param int $iIncSecure
* @param bool $bIncShortLogin
* @param string $sOutHost
* @param int $iOutPort
* @param int $iOutSecure
* @param bool $bOutShortLogin
* @param bool $bOutAuth
* @param string $sWhiteList = ''
*
* @return \RainLoop\Domain
*/
public function UpdateInstance($sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sWhiteList = '')
{
$this->sIncHost = \MailSo\Base\Utils::IdnToAscii($sIncHost);
$this->iIncPort = $iIncPort;
$this->iIncSecure = $iIncSecure;
$this->bIncShortLogin = $bIncShortLogin;
$this->sOutHost = \MailSo\Base\Utils::IdnToAscii($sOutHost);
$this->iOutPort = $iOutPort;
$this->iOutSecure = $iOutSecure;
$this->bOutShortLogin = $bOutShortLogin;
$this->bOutAuth = $bOutAuth;
$this->sWhiteList = \trim($sWhiteList);
return $this;
}
示例13: ServiceChange
/**
* @return string
*/
public function ServiceChange()
{
if ($this->Config()->Get('webmail', 'allow_additional_accounts', true)) {
$oAccountToLogin = null;
$sEmail = empty($this->aPaths[2]) ? '' : \urldecode(\trim($this->aPaths[2]));
if (!empty($sEmail)) {
$sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
$oAccount = $this->oActions->GetAccount();
if ($oAccount) {
$aAccounts = $this->oActions->GetAccounts($oAccount);
if (isset($aAccounts[$sEmail])) {
$oAccountToLogin = $this->oActions->GetAccountFromCustomToken($aAccounts[$sEmail], false, false);
}
}
}
if ($oAccountToLogin) {
$this->oActions->AuthProcess($oAccountToLogin);
}
}
$this->oActions->Location('./');
return '';
}
示例14: ClearUserDateStorage
/**
* @todo
* @param string $sEmail
*
* @return bool
*/
public static function ClearUserDateStorage($sEmail)
{
$sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
// TwoFactor Auth User Data
self::Actions()->StorageProvider()->Clear(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, \RainLoop\KeyPathHelper::TwoFactorAuthUserData($sEmail));
}
示例15: DoAccountDelete
/**
* @return array
*
* @throws \MailSo\Base\Exceptions\Exception
*/
public function DoAccountDelete()
{
if (!$this->Config()->Get('webmail', 'allow_additional_accounts', true)) {
return $this->FalseResponse(__FUNCTION__);
}
$oAccount = $this->getAccountFromToken();
$sParentEmail = $oAccount->ParentEmailHelper();
$sEmailToDelete = \trim($this->GetActionParam('EmailToDelete', ''));
$sEmailToDelete = \MailSo\Base\Utils::IdnToAscii($sEmailToDelete, true);
$aAccounts = $this->GetAccounts($oAccount);
if (0 < \strlen($sEmailToDelete) && $sEmailToDelete !== $sParentEmail && \is_array($aAccounts) && isset($aAccounts[$sEmailToDelete])) {
unset($aAccounts[$sEmailToDelete]);
$oAccountToChange = null;
if ($oAccount->Email() === $sEmailToDelete && !empty($aAccounts[$sParentEmail])) {
$oAccountToChange = $this->GetAccountFromCustomToken($aAccounts[$sParentEmail], false, false);
if ($oAccountToChange) {
$this->AuthProcess($oAccountToChange);
}
}
$this->SetAccounts($oAccount, $aAccounts);
return $this->TrueResponse(__FUNCTION__, array('Reload' => !!$oAccountToChange));
}
return $this->FalseResponse(__FUNCTION__);
}