本文整理匯總了PHP中MailSo\Base\Utils::ParseFetchSequence方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utils::ParseFetchSequence方法的具體用法?PHP Utils::ParseFetchSequence怎麽用?PHP Utils::ParseFetchSequence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MailSo\Base\Utils
的用法示例。
在下文中一共展示了Utils::ParseFetchSequence方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
示例2: MessageListDepr
/**
* @deprecated
*
* @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()
* @param bool $bUseESearchOrESortRequest = false
*
* @return \MailSo\Mail\MessageCollection
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
*/
public function MessageListDepr($sFolderName, $iOffset = 0, $iLimit = 10, $sSearch = '', $sPrevUidNext = '', $oCacher = null, $bUseSortIfSupported = false, $bUseThreadSortIfSupported = false, $aExpandedThreadsUids = array(), $bUseESearchOrESortRequest = false)
{
$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;
$iMessageCacheCount = 100;
$sUidNext = '0';
$sSerializedHash = '';
$bESearchSupported = $bUseESearchOrESortRequest ? $this->oImapClient->IsSupported('ESEARCH') : false;
$bUseSortIfSupported = $bUseSortIfSupported ? $this->oImapClient->IsSupported('SORT') : false;
$bESortSupported = $bUseSortIfSupported && $bUseESearchOrESortRequest ? $this->oImapClient->IsSupported('ESORT') : 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->getImapSearchCriterias($sSearch);
if ($iMessageCacheCount < $iMessageRealCount && $oCacher && $oCacher->IsInited()) {
$sSerializedHash = ($bUseSortIfSupported ? 'S' : 'N') . '/' . ($bUseThreadSortIfSupported ? 'T' : 'N') . '/' . $this->oImapClient->GetLogginedUser() . '@' . $this->oImapClient->GetConnectedHost() . ':' . $this->oImapClient->GetConnectedPort() . '/' . $oMessageCollection->FolderName . '/' . $sSearchCriterias;
$sSerialized = $oCacher->Get($sSerializedHash);
if (!empty($sSerialized)) {
$aSerialized = @\unserialize($sSerialized);
if (\is_array($aSerialized) && isset($aSerialized['FolderHash'], $aSerialized['Uids']) && \is_array($aSerialized['Uids']) && $oMessageCollection->FolderHash === $aSerialized['FolderHash']) {
$aIndexOrUids = $aSerialized['Uids'];
$bCacher = true;
}
}
}
if (!\is_array($aIndexOrUids)) {
if ($bUseSortIfSupported && !$bUseThreadSortIfSupported) {
if ($bESortSupported) {
$aESorthData = $this->oImapClient->MessageSimpleESort(array('ARRIVAL'), $sSearchCriterias, array('ALL'), $bIndexAsUid, '');
if (isset($aESorthData['ALL'])) {
$aIndexOrUids = \MailSo\Base\Utils::ParseFetchSequence($aESorthData['ALL']);
$aIndexOrUids = \array_reverse($aIndexOrUids);
}
unset($aESorthData);
} else {
$aIndexOrUids = $this->oImapClient->MessageSimpleSort(array('REVERSE ARRIVAL'), $sSearchCriterias, $bIndexAsUid);
}
} else {
if (!\MailSo\Base\Utils::IsAscii($sSearch)) {
try {
if ($bESearchSupported) {
$aESearchData = $this->oImapClient->MessageSimpleESearch($sSearchCriterias, array('ALL'), $bIndexAsUid, '', 'UTF-8');
if (isset($aESearchData['ALL'])) {
$aIndexOrUids = \MailSo\Base\Utils::ParseFetchSequence($aESearchData['ALL']);
$aIndexOrUids = \array_reverse($aIndexOrUids);
}
unset($aESearchData);
} else {
$aIndexOrUids = $this->oImapClient->MessageSimpleSearch($sSearchCriterias, $bIndexAsUid, 'UTF-8');
}
} catch (\MailSo\Imap\Exceptions\NegativeResponseException $oException) {
//.........這裏部分代碼省略.........