本文整理匯總了PHP中MailSo\Base\Utils::IsAscii方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utils::IsAscii方法的具體用法?PHP Utils::IsAscii怎麽用?PHP Utils::IsAscii使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MailSo\Base\Utils
的用法示例。
在下文中一共展示了Utils::IsAscii方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: simpleESearchOrESortHelper
/**
* @param bool $bSort = false
* @param string $sSearchCriterias = 'ALL'
* @param array $aSearchOrSortReturn = null
* @param bool $bReturnUid = true
* @param string $sLimit = ''
* @param string $sCharset = ''
* @param array $aSortTypes = null
*
* @return array
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
*/
private function simpleESearchOrESortHelper($bSort = false, $sSearchCriterias = 'ALL', $aSearchOrSortReturn = null, $bReturnUid = true, $sLimit = '', $sCharset = '', $aSortTypes = null)
{
$sCommandPrefix = $bReturnUid ? 'UID ' : '';
$sSearchCriterias = 0 === \strlen($sSearchCriterias) || '*' === $sSearchCriterias ? 'ALL' : $sSearchCriterias;
$sCmd = $bSort ? 'SORT' : 'SEARCH';
if ($bSort && (!\is_array($aSortTypes) || 0 === \count($aSortTypes) || !$this->IsSupported('SORT'))) {
$this->writeLogException(new \MailSo\Base\Exceptions\InvalidArgumentException(), \MailSo\Log\Enumerations\Type::ERROR, true);
}
if (!$this->IsSupported($bSort ? 'ESORT' : 'ESEARCH')) {
$this->writeLogException(new \MailSo\Base\Exceptions\InvalidArgumentException(), \MailSo\Log\Enumerations\Type::ERROR, true);
}
if (!\is_array($aSearchOrSortReturn) || 0 === \count($aSearchOrSortReturn)) {
$aSearchOrSortReturn = array('ALL');
}
$aRequest = array();
if ($bSort) {
$aRequest[] = 'RETURN';
$aRequest[] = $aSearchOrSortReturn;
$aRequest[] = $aSortTypes;
$aRequest[] = \MailSo\Base\Utils::IsAscii($sSearchCriterias) ? 'US-ASCII' : 'UTF-8';
} else {
if (0 < \strlen($sCharset)) {
$aRequest[] = 'CHARSET';
$aRequest[] = \strtoupper($sCharset);
}
$aRequest[] = 'RETURN';
$aRequest[] = $aSearchOrSortReturn;
}
$aRequest[] = $sSearchCriterias;
if (0 < \strlen($sLimit)) {
$aRequest[] = $sLimit;
}
$this->SendRequest($sCommandPrefix . $sCmd, $aRequest);
$sRequestTag = $this->getCurrentTag();
$aResult = array();
$aResponse = $this->parseResponseWithValidation();
if (\is_array($aResponse)) {
$oImapResponse = null;
foreach ($aResponse as $oImapResponse) {
if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oImapResponse->ResponseType && ('ESEARCH' === $oImapResponse->StatusOrIndex || 'ESORT' === $oImapResponse->StatusOrIndex) && \is_array($oImapResponse->ResponseList) && isset($oImapResponse->ResponseList[2], $oImapResponse->ResponseList[2][0], $oImapResponse->ResponseList[2][1]) && 'TAG' === $oImapResponse->ResponseList[2][0] && $sRequestTag === $oImapResponse->ResponseList[2][1] && (!$bReturnUid || $bReturnUid && !empty($oImapResponse->ResponseList[3]) && 'UID' === $oImapResponse->ResponseList[3])) {
$iStart = 3;
foreach ($oImapResponse->ResponseList as $iIndex => $mItem) {
if ($iIndex >= $iStart) {
switch ($mItem) {
case 'ALL':
case 'MAX':
case 'MIN':
case 'COUNT':
if (isset($oImapResponse->ResponseList[$iIndex + 1])) {
$aResult[$mItem] = $oImapResponse->ResponseList[$iIndex + 1];
}
break;
}
}
}
}
}
}
return $aResult;
}
示例2: MessageList
/**
* @param string $sFolderName
* @param int $iOffset = 0
* @param int $iLimit = 10
* @param string $sSearch = ''
* @param string $sPrevUidNext = ''
* @param mixed $oCacher = null
* @param string $sCachePrefix = ''
* @param bool $bUseSortIfSupported = false
* @param bool $bUseThreadSortIfSupported = false
* @param array $aExpandedThreadsUids = array()
*
* @return \MailSo\Mail\MessageCollection
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
*/
public function MessageList($sFolderName, $iOffset = 0, $iLimit = 10, $sSearch = '', $sPrevUidNext = '', $oCacher = null, $bUseSortIfSupported = false, $bUseThreadSortIfSupported = false, $aExpandedThreadsUids = array())
{
$sSearch = \trim($sSearch);
if (!\MailSo\Base\Validator::RangeInt($iOffset, 0) || !\MailSo\Base\Validator::RangeInt($iLimit, 0, 999) || !is_string($sSearch)) {
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
}
$this->oImapClient->FolderExamine($sFolderName);
$oMessageCollection = MessageCollection::NewInstance();
$oMessageCollection->FolderName = $sFolderName;
$oMessageCollection->Offset = $iOffset;
$oMessageCollection->Limit = $iLimit;
$oMessageCollection->Search = $sSearch;
$aLastCollapsedThreadUids = array();
$aThreads = array();
$iMessageCount = 0;
$iMessageRealCount = 0;
$iMessageUnseenCount = 0;
$sUidNext = '0';
$sSerializedHash = '';
$bUseSortIfSupported = $bUseSortIfSupported ? $this->oImapClient->IsSupported('SORT') : false;
$bUseThreadSortIfSupported = $bUseThreadSortIfSupported ? $this->oImapClient->IsSupported('THREAD=REFS') || $this->oImapClient->IsSupported('THREAD=REFERENCES') || $this->oImapClient->IsSupported('THREAD=ORDEREDSUBJECT') : false;
if (!$oCacher || !$oCacher instanceof \MailSo\Cache\CacheClient) {
$oCacher = null;
}
$this->initFolderValues($sFolderName, $iMessageRealCount, $iMessageUnseenCount, $sUidNext);
$iMessageCount = $iMessageRealCount;
$oMessageCollection->FolderHash = self::GenerateHash($sFolderName, $iMessageRealCount, $iMessageUnseenCount, $sUidNext);
$oMessageCollection->UidNext = $sUidNext;
$oMessageCollection->NewMessages = $this->getFolderNextMessageInformation($sFolderName, $sPrevUidNext, $sUidNext);
$bCacher = false;
$bSearch = false;
if (0 < $iMessageRealCount) {
$bIndexAsUid = false;
$aIndexOrUids = array();
$bSearch = 0 < \strlen($sSearch);
if ($bSearch || $bUseSortIfSupported && !$bUseThreadSortIfSupported) {
$bIndexAsUid = true;
$aIndexOrUids = null;
$sSearchCriterias = $this->getSearchBuilder($sSearch)->Complete();
if ($oCacher && $oCacher->IsInited()) {
$sSerializedHash = ($bUseSortIfSupported ? 'S' : 'N') . '/' . ($bUseThreadSortIfSupported ? 'T' : 'N') . '/' . $this->oImapClient->GetLogginedUser() . '@' . $this->oImapClient->GetConnectedHost() . ':' . $this->oImapClient->GetConnectedPort() . '/' . $oMessageCollection->FolderName . '/' . $oMessageCollection->FolderHash . '/' . $sSearchCriterias;
$sSerializedUids = $oCacher->Get($sSerializedHash);
if (!empty($sSerializedUids)) {
$aSerializedUids = @\unserialize($sSerializedUids);
if (\is_array($aSerializedUids)) {
$aIndexOrUids = $aSerializedUids;
$bCacher = true;
}
}
}
if (!\is_array($aIndexOrUids)) {
if ($bUseSortIfSupported && !$bUseThreadSortIfSupported) {
$aIndexOrUids = $this->oImapClient->MessageSimpleSort(array('ARRIVAL'), $sSearchCriterias, $bIndexAsUid);
} else {
if (!\MailSo\Base\Utils::IsAscii($sSearch)) {
try {
$aIndexOrUids = $this->oImapClient->MessageSimpleSearch($sSearchCriterias, $bIndexAsUid, 'UTF-8');
} catch (\MailSo\Imap\Exceptions\NegativeResponseException $oException) {
$oException = null;
$aIndexOrUids = null;
}
}
if (null === $aIndexOrUids) {
$aIndexOrUids = $this->oImapClient->MessageSimpleSearch($sSearchCriterias, $bIndexAsUid);
}
}
}
} else {
if ($bUseThreadSortIfSupported && 1 < $iMessageCount) {
$bIndexAsUid = true;
$aThreads = $this->MessageListThreadsMap($oMessageCollection->FolderName, $oMessageCollection->FolderHash, $oCacher);
$aIndexOrUids = $this->compileLineThreadUids($aThreads, $aLastCollapsedThreadUids, $aExpandedThreadsUids, 0);
$iMessageCount = count($aIndexOrUids);
} else {
$bIndexAsUid = false;
$aIndexOrUids = array(1);
if (1 < $iMessageCount) {
$aIndexOrUids = \array_reverse(\range(1, $iMessageCount));
}
}
}
if ($bIndexAsUid && !$bCacher && \is_array($aIndexOrUids) && $oCacher && $oCacher->IsInited() && 0 < \strlen($sSerializedHash)) {
//.........這裏部分代碼省略.........
示例3: ValueWithCharsetAutoDetect
/**
* @return string
*/
public function ValueWithCharsetAutoDetect()
{
$sValue = $this->Value();
if (!\MailSo\Base\Utils::IsAscii($sValue) && 0 < \strlen($this->sEncodedValueForReparse) && !\MailSo\Base\Utils::IsAscii($this->sEncodedValueForReparse)) {
$sValueCharset = \MailSo\Base\Utils::CharsetDetect($this->sEncodedValueForReparse);
if (0 < \strlen($sValueCharset)) {
$this->SetParentCharset($sValueCharset);
$sValue = $this->Value();
}
}
return $sValue;
}
示例4: CharsetDetect
/**
* @param string $sStr
*
* @return string
*/
public static function CharsetDetect($sStr)
{
$mResult = '';
if (!\MailSo\Base\Utils::IsAscii($sStr)) {
$mResult = \MailSo\Base\Utils::IsMbStringSupported() && \MailSo\Base\Utils::FunctionExistsAndEnabled('mb_detect_encoding') ? @\mb_detect_encoding($sStr, 'auto', true) : false;
if (false === $mResult && \MailSo\Base\Utils::IsIconvSupported()) {
$mResult = \md5(@\iconv('utf-8', 'utf-8//IGNORE', $sStr)) === \md5($sStr) ? 'utf-8' : '';
}
}
return \is_string($mResult) && 0 < \strlen($mResult) ? $mResult : '';
}
示例5: getMessageList
//.........這裏部分代碼省略.........
$fAttachmentSearchCallback = function ($oBodyStructure, $sSize, $sInternalDate, $aFlagsLower, $sUid) use($sFolderFullNameRaw, $sAttachmentRegs) {
$bResult = false;
if ($oBodyStructure) {
$aAttachmentsParts = $oBodyStructure->SearchAttachmentsParts();
if ($aAttachmentsParts && 0 < count($aAttachmentsParts)) {
$oAttachments = CApiMailAttachmentCollection::createInstance();
foreach ($aAttachmentsParts as $oAttachmentItem) {
$oAttachments->Add(CApiMailAttachment::createInstance($sFolderFullNameRaw, $sUid, $oAttachmentItem));
}
$bResult = $oAttachments->hasNotInlineAttachments();
if ($bResult && !empty($sAttachmentRegs)) {
$aList = $oAttachments->FilterList(function ($oAttachment) use($sAttachmentRegs) {
if ($oAttachment && !$oAttachment->isInline() && !$oAttachment->getCid()) {
return !!preg_match($sAttachmentRegs, $oAttachment->getFileName());
}
return false;
});
return is_array($aList) ? 0 < count($aList) : false;
}
}
}
unset($oBodyStructure);
return $bResult;
};
}
if (0 < strlen($sCutedSearch) || 0 < count($aFilters)) {
$bSearch = true;
$sSearchCriterias = $this->_prepareImapSearchString($oImapClient, $sCutedSearch, $oAccount->getDefaultTimeOffset() * 60, $aFilters);
$bIndexAsUid = true;
$aIndexOrUids = null;
if ($bUseSortIfSupported) {
$aIndexOrUids = $oImapClient->MessageSimpleSort(array('REVERSE ARRIVAL'), $sSearchCriterias, $bIndexAsUid);
} else {
if (!\MailSo\Base\Utils::IsAscii($sCutedSearch)) {
try {
$aIndexOrUids = $oImapClient->MessageSimpleSearch($sSearchCriterias, $bIndexAsUid, 'UTF-8');
} catch (\MailSo\Imap\Exceptions\NegativeResponseException $oException) {
// Charset is not supported. Skip and try request without charset.
$aIndexOrUids = null;
}
}
if (null === $aIndexOrUids) {
$aIndexOrUids = $oImapClient->MessageSimpleSearch($sSearchCriterias, $bIndexAsUid);
}
}
if ($bSearchAttachments && is_array($aIndexOrUids) && 0 < count($aIndexOrUids)) {
$aIndexOrUids = $this->_doSpecialUidsSearch($oImapClient, $fAttachmentSearchCallback, $sFolderFullNameRaw, $aIndexOrUids, $iOffset, $iLimit);
}
} else {
if ($bSearchAttachments) {
$bIndexAsUid = true;
$aIndexOrUids = $this->_doSpecialIndexSearch($oImapClient, $fAttachmentSearchCallback, $sFolderFullNameRaw, $iOffset, $iLimit);
}
}
} else {
if ($bUseThreadsIfSupported && 1 < $iMessageCount) {
$bIndexAsUid = true;
$aThreadUids = array();
try {
$aThreadUids = $oImapClient->MessageSimpleThread();
} catch (\MailSo\Imap\Exceptions\RuntimeException $oException) {
$aThreadUids = array();
}
$aThreads = $this->_compileThreadList($aThreadUids);
if ($bUseSortIfSupported) {
$aThreads = $this->_resortThreadList($aThreads, $oImapClient->MessageSimpleSort(array('REVERSE ARRIVAL'), 'ALL', true));
示例6: GetUids
/**
* @param \MailSo\Cache\CacheClient|null $oCacher
* @param string $sSearch
* @param string $sFilter
* @param string $sFolderName
* @param string $sFolderHash
* @param bool $bUseSortIfSupported = false
*
* @return array
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
*/
public function GetUids($oCacher, $sSearch, $sFilter, $sFolderName, $sFolderHash, $bUseSortIfSupported = false)
{
$aResultUids = false;
$bUidsFromCacher = false;
$bUseCacheAfterSearch = true;
$sSerializedHash = '';
$sSerializedLog = '';
$bUseSortIfSupported = $bUseSortIfSupported ? !!$this->oImapClient->IsSupported('SORT') : false;
if (0 < \strlen($sSearch)) {
$bUseSortIfSupported = false;
}
$sSearchCriterias = $this->getImapSearchCriterias($sSearch, $sFilter, 0, $bUseCacheAfterSearch);
if ($bUseCacheAfterSearch && $oCacher && $oCacher->IsInited()) {
$sSerializedHash = 'GetUids/' . ($bUseSortIfSupported ? 'S' : 'N') . '/' . $this->GenerateImapClientHash() . '/' . $sFolderName . '/' . $sSearchCriterias;
$sSerializedLog = '"' . $sFolderName . '" / ' . $sSearchCriterias . '';
$sSerialized = $oCacher->Get($sSerializedHash);
if (!empty($sSerialized)) {
$aSerialized = @\json_decode($sSerialized, true);
if (\is_array($aSerialized) && isset($aSerialized['FolderHash'], $aSerialized['Uids']) && $sFolderHash === $aSerialized['FolderHash'] && \is_array($aSerialized['Uids'])) {
if ($this->oLogger) {
$this->oLogger->Write('Get Serialized UIDS from cache (' . $sSerializedLog . ') [count:' . \count($aSerialized['Uids']) . ']');
}
$aResultUids = $aSerialized['Uids'];
$bUidsFromCacher = true;
}
}
}
if (!\is_array($aResultUids)) {
$aResultUids = $bUseSortIfSupported ? $this->oImapClient->MessageSimpleSort(array('REVERSE ARRIVAL'), $sSearchCriterias, true) : $this->oImapClient->MessageSimpleSearch($sSearchCriterias, true, \MailSo\Base\Utils::IsAscii($sSearchCriterias) ? '' : 'UTF-8');
if (!$bUidsFromCacher && $bUseCacheAfterSearch && \is_array($aResultUids) && $oCacher && $oCacher->IsInited() && 0 < \strlen($sSerializedHash)) {
$oCacher->Set($sSerializedHash, @\json_encode(array('FolderHash' => $sFolderHash, 'Uids' => $aResultUids)));
if ($this->oLogger) {
$this->oLogger->Write('Save Serialized UIDS to cache (' . $sSerializedLog . ') [count:' . \count($aResultUids) . ']');
}
}
}
return \is_array($aResultUids) ? $aResultUids : array();
}
示例7: getSearchUidsResult
/**
* @param string $sSearch
* @param string $sFolderName
* @param string|bool $sFolderHash
* @param bool $bUseSortIfSupported = true
* @param bool $bUseESearchOrESortRequest = false
* @param \MailSo\Cache\CacheClient|null $oCacher = null
*
* @return Array|bool
*/
private function getSearchUidsResult($sSearch, $sFolderName, $sFolderHash, $bUseSortIfSupported = true, $bUseESearchOrESortRequest = false, $oCacher = null)
{
$bUidsFromCacher = false;
$aResultUids = false;
$bUseCacheAfterSearch = true;
$sSerializedHash = '';
$bESortSupported = $bUseSortIfSupported && $bUseESearchOrESortRequest ? $this->oImapClient->IsSupported('ESORT') : false;
$bESearchSupported = $bUseESearchOrESortRequest ? $this->oImapClient->IsSupported('ESEARCH') : false;
$bUseSortIfSupported = $bUseSortIfSupported ? $this->oImapClient->IsSupported('SORT') : false;
$sSearchCriterias = $this->getImapSearchCriterias($sSearch, 0, $bUseCacheAfterSearch);
if ($bUseCacheAfterSearch && $oCacher && $oCacher->IsInited()) {
$sSerializedHash = ($bUseSortIfSupported ? 'S' : 'N') . '/' . $this->oImapClient->GetLogginedUser() . '@' . $this->oImapClient->GetConnectedHost() . ':' . $this->oImapClient->GetConnectedPort() . '/' . $sFolderName . '/' . $sSearchCriterias;
$sSerializedLog = '"' . $sFolderName . '" / ' . $sSearchCriterias . '';
$sSerialized = $oCacher->Get($sSerializedHash);
if (!empty($sSerialized)) {
$aSerialized = @\unserialize($sSerialized);
if (\is_array($aSerialized) && isset($aSerialized['FolderHash'], $aSerialized['Uids']) && \is_array($aSerialized['Uids']) && $sFolderHash === $aSerialized['FolderHash']) {
if ($this->oLogger) {
$this->oLogger->Write('Get Serialized UIDS from cache (' . $sSerializedLog . ') [count:' . \count($aSerialized['Uids']) . ']');
}
$aResultUids = $aSerialized['Uids'];
$bUidsFromCacher = true;
}
}
}
if (!\is_array($aResultUids)) {
if ($bUseSortIfSupported) {
if ($bESortSupported) {
$aESorthData = $this->oImapClient->MessageSimpleESort(array('ARRIVAL'), $sSearchCriterias, array('ALL'), true, '');
if (isset($aESorthData['ALL'])) {
$aResultUids = \MailSo\Base\Utils::ParseFetchSequence($aESorthData['ALL']);
$aResultUids = \array_reverse($aResultUids);
}
unset($aESorthData);
} else {
$aResultUids = $this->oImapClient->MessageSimpleSort(array('REVERSE ARRIVAL'), $sSearchCriterias, true);
}
} else {
if (!\MailSo\Base\Utils::IsAscii($sSearch)) {
try {
if ($bESearchSupported) {
$aESearchData = $this->oImapClient->MessageSimpleESearch($sSearchCriterias, array('ALL'), true, '', 'UTF-8');
if (isset($aESearchData['ALL'])) {
$aResultUids = \MailSo\Base\Utils::ParseFetchSequence($aESearchData['ALL']);
$aResultUids = \array_reverse($aResultUids);
}
unset($aESearchData);
} else {
$aResultUids = $this->oImapClient->MessageSimpleSearch($sSearchCriterias, true, 'UTF-8');
}
} catch (\MailSo\Imap\Exceptions\NegativeResponseException $oException) {
$oException = null;
$aResultUids = false;
}
}
if (false === $aResultUids) {
if ($bESearchSupported) {
$aESearchData = $this->oImapClient->MessageSimpleESearch($sSearchCriterias, array('ALL'), true);
if (isset($aESearchData['ALL'])) {
$aResultUids = \MailSo\Base\Utils::ParseFetchSequence($aESearchData['ALL']);
$aResultUids = \array_reverse($aResultUids);
}
unset($aESearchData);
} else {
$aResultUids = $this->oImapClient->MessageSimpleSearch($sSearchCriterias, true);
}
}
}
if (!$bUidsFromCacher && $bUseCacheAfterSearch && \is_array($aResultUids) && $oCacher && $oCacher->IsInited() && 0 < \strlen($sSerializedHash)) {
$oCacher->Set($sSerializedHash, \serialize(array('FolderHash' => $sFolderHash, 'Uids' => $aResultUids)));
if ($this->oLogger) {
$this->oLogger->Write('Save Serialized UIDS to cache (' . $sSerializedLog . ') [count:' . \count($aResultUids) . ']');
}
}
}
return $aResultUids;
}
示例8: Test
/**
* @return string
*/
public function Test()
{
$sResult = '';
try {
$this->SyncDatabase();
if (0 >= $this->getVersion($this->sDsnType . '-ab-version')) {
$sResult = 'Unknown database error';
}
} catch (\Exception $oException) {
$sResult = $oException->getMessage();
if (!empty($sResult) && !\MailSo\Base\Utils::IsAscii($sResult) && !\MailSo\Base\Utils::IsUtf8($sResult)) {
$sResult = @\utf8_encode($sResult);
}
if (!\is_string($sResult) || empty($sResult)) {
$sResult = 'Unknown database error';
}
}
return $sResult;
}
示例9: csvNameToTypeConvertor
/**
* @param string $sCsvName
*
* @return int
*/
private function csvNameToTypeConvertor($sCsvName)
{
static $aMap = null;
if (null === $aMap) {
$aMap = array('Title' => PropertyType::FULLNAME, 'Name' => PropertyType::FULLNAME, 'FullName' => PropertyType::FULLNAME, 'DisplayName' => PropertyType::FULLNAME, 'GivenName' => PropertyType::FULLNAME, 'First' => PropertyType::FIRST_NAME, 'FirstName' => PropertyType::FIRST_NAME, 'Middle' => PropertyType::MIDDLE_NAME, 'MiddleName' => PropertyType::MIDDLE_NAME, 'Last' => PropertyType::LAST_NAME, 'LastName' => PropertyType::LAST_NAME, 'Suffix' => PropertyType::NAME_SUFFIX, 'NameSuffix' => PropertyType::NAME_SUFFIX, 'Prefix' => PropertyType::NAME_PREFIX, 'NamePrefix' => PropertyType::NAME_PREFIX, 'ShortName' => PropertyType::NICK_NAME, 'NickName' => PropertyType::NICK_NAME, 'BusinessFax' => array(PropertyType::PHONE, 'Work,Fax'), 'BusinessFax2' => array(PropertyType::PHONE, 'Work,Fax'), 'BusinessFax3' => array(PropertyType::PHONE, 'Work,Fax'), 'BusinessPhone' => array(PropertyType::PHONE, 'Work'), 'BusinessPhone2' => array(PropertyType::PHONE, 'Work'), 'BusinessPhone3' => array(PropertyType::PHONE, 'Work'), 'CompanyPhone' => array(PropertyType::PHONE, 'Work'), 'CompanyMainPhone' => array(PropertyType::PHONE, 'Work'), 'HomeFax' => array(PropertyType::PHONE, 'Home,Fax'), 'HomeFax2' => array(PropertyType::PHONE, 'Home,Fax'), 'HomeFax3' => array(PropertyType::PHONE, 'Home,Fax'), 'HomePhone' => array(PropertyType::PHONE, 'Home'), 'HomePhone2' => array(PropertyType::PHONE, 'Home'), 'HomePhone3' => array(PropertyType::PHONE, 'Home'), 'Mobile' => array(PropertyType::PHONE, 'Mobile'), 'MobilePhone' => array(PropertyType::PHONE, 'Mobile'), 'BusinessMobile' => array(PropertyType::PHONE, 'Work,Mobile'), 'BusinessMobilePhone' => array(PropertyType::PHONE, 'Work,Mobile'), 'OtherFax' => array(PropertyType::PHONE, 'Other,Fax'), 'OtherPhone' => array(PropertyType::PHONE, 'Other'), 'PrimaryPhone' => array(PropertyType::PHONE, 'Pref,Home'), 'Email' => array(PropertyType::EMAIl, 'Home'), 'Email2' => array(PropertyType::EMAIl, 'Home'), 'Email3' => array(PropertyType::EMAIl, 'Home'), 'HomeEmail' => array(PropertyType::EMAIl, 'Home'), 'HomeEmail2' => array(PropertyType::EMAIl, 'Home'), 'HomeEmail3' => array(PropertyType::EMAIl, 'Home'), 'EmailAddress' => array(PropertyType::EMAIl, 'Home'), 'Email2Address' => array(PropertyType::EMAIl, 'Home'), 'Email3Address' => array(PropertyType::EMAIl, 'Home'), 'OtherEmail' => array(PropertyType::EMAIl, 'Other'), 'BusinessEmail' => array(PropertyType::EMAIl, 'Work'), 'BusinessEmail2' => array(PropertyType::EMAIl, 'Work'), 'BusinessEmail3' => array(PropertyType::EMAIl, 'Work'), 'PersonalEmail' => array(PropertyType::EMAIl, 'Home'), 'PersonalEmail2' => array(PropertyType::EMAIl, 'Home'), 'PersonalEmail3' => array(PropertyType::EMAIl, 'Home'), 'Notes' => PropertyType::NOTE, 'Web' => PropertyType::WEB_PAGE, 'BusinessWeb' => array(PropertyType::WEB_PAGE, 'Work'), 'WebPage' => PropertyType::WEB_PAGE, 'BusinessWebPage' => array(PropertyType::WEB_PAGE, 'Work'), 'WebSite' => PropertyType::WEB_PAGE, 'BusinessWebSite' => array(PropertyType::WEB_PAGE, 'Work'), 'PersonalWebSite' => PropertyType::WEB_PAGE);
$aMap = \array_change_key_case($aMap, CASE_LOWER);
}
$sCsvNameLower = \MailSo\Base\Utils::IsAscii($sCsvName) ? \preg_replace('/[\\s\\-]+/', '', \strtolower($sCsvName)) : '';
return !empty($sCsvNameLower) && isset($aMap[$sCsvNameLower]) ? $aMap[$sCsvNameLower] : PropertyType::UNKNOWN;
}
示例10: MessageSimpleSort
/**
* @param array $aSortTypes
* @param string $sSearchCriterias
* @param bool $bReturnUid
*
* @return array
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
*/
public function MessageSimpleSort($aSortTypes, $sSearchCriterias = 'ALL', $bReturnUid = true)
{
$sCommandPrefix = $bReturnUid ? 'UID ' : '';
$sSearchCriterias = !\MailSo\Base\Validator::NotEmptyString($sSearchCriterias, true) || '*' === $sSearchCriterias ? 'ALL' : $sSearchCriterias;
if (!is_array($aSortTypes) || 0 === count($aSortTypes)) {
$this->writeLogException(new \MailSo\Base\Exceptions\InvalidArgumentException(), \MailSo\Log\Enumerations\Type::ERROR, true);
} else {
if (!$this->IsSupported('SORT')) {
$this->writeLogException(new \MailSo\Base\Exceptions\InvalidArgumentException(), \MailSo\Log\Enumerations\Type::ERROR, true);
}
}
$aRequest = array();
$aRequest[] = $aSortTypes;
$aRequest[] = \MailSo\Base\Utils::IsAscii($sSearchCriterias) ? 'US-ASCII' : 'UTF-8';
$aRequest[] = $sSearchCriterias;
$sCmd = 'SORT';
$this->SendRequest($sCommandPrefix . $sCmd, $aRequest);
$aResult = $this->parseResponseWithValidation();
$aReturn = array();
$oImapResponse = null;
foreach ($aResult as $oImapResponse) {
if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oImapResponse->ResponseType && ($sCmd === $oImapResponse->StatusOrIndex || $bReturnUid && 'UID' === $oImapResponse->StatusOrIndex && !empty($oImapResponse->ResponseList[2]) && $sCmd === $oImapResponse->ResponseList[2]) && is_array($oImapResponse->ResponseList) && 2 < count($oImapResponse->ResponseList)) {
$iStart = 2;
if ($bReturnUid && 'UID' === $oImapResponse->StatusOrIndex && !empty($oImapResponse->ResponseList[2]) && $sCmd === $oImapResponse->ResponseList[2]) {
$iStart = 3;
}
for ($iIndex = $iStart, $iLen = count($oImapResponse->ResponseList); $iIndex < $iLen; $iIndex++) {
$aReturn[] = (int) $oImapResponse->ResponseList[$iIndex];
}
}
}
$aReturn = array_reverse($aReturn);
return $aReturn;
}
示例11: escapeSearchString
/**
* @param string $sSearch
* @param bool $bDetectGmail = true
*
* @return string
*/
private function escapeSearchString($sSearch, $bDetectGmail = true)
{
return $bDetectGmail && !\MailSo\Base\Utils::IsAscii($sSearch) && $this->IsGmail() ? '{' . \strlen($sSearch) . '+}' . "\r\n" . $sSearch : $this->oImapClient->EscapeString($sSearch);
}