當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Utils::DecodeHeaderValue方法代碼示例

本文整理匯總了PHP中MailSo\Base\Utils::DecodeHeaderValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utils::DecodeHeaderValue方法的具體用法?PHP Utils::DecodeHeaderValue怎麽用?PHP Utils::DecodeHeaderValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MailSo\Base\Utils的用法示例。


在下文中一共展示了Utils::DecodeHeaderValue方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: GetFetchEnvelopeEmailCollection

 /**
  * @param int $iIndex
  * @param string $sParentCharset = \MailSo\Base\Enumerations\Charset::ISO_8859_1
  *
  * @return \MailSo\Mime\EmailCollection|null
  */
 public function GetFetchEnvelopeEmailCollection($iIndex, $sParentCharset = \MailSo\Base\Enumerations\Charset::ISO_8859_1)
 {
     $oResult = null;
     $aEmails = $this->GetFetchEnvelopeValue($iIndex, null);
     if (is_array($aEmails) && 0 < count($aEmails)) {
         $oResult = \MailSo\Mime\EmailCollection::NewInstance();
         foreach ($aEmails as $aEmailItem) {
             if (is_array($aEmailItem) && 4 === count($aEmailItem)) {
                 $sDisplayName = \MailSo\Base\Utils::DecodeHeaderValue(self::findEnvelopeIndex($aEmailItem, 0, ''), $sParentCharset);
                 $sRemark = \MailSo\Base\Utils::DecodeHeaderValue(self::findEnvelopeIndex($aEmailItem, 1, ''), $sParentCharset);
                 $sLocalPart = self::findEnvelopeIndex($aEmailItem, 2, '');
                 $sDomainPart = self::findEnvelopeIndex($aEmailItem, 3, '');
                 if (0 < strlen($sLocalPart) && 0 < strlen($sDomainPart)) {
                     $oResult->Add(\MailSo\Mime\Email::NewInstance($sLocalPart . '@' . $sDomainPart, $sDisplayName, $sRemark));
                 }
             }
         }
     }
     return $oResult;
 }
開發者ID:helsaba,項目名稱:rainloop-webmail,代碼行數:26,代碼來源:FetchResponse.php

示例2: SetParentCharset

 /**
  * @param string $sParentCharset
  * @return \MailSo\Mime\Header
  */
 public function SetParentCharset($sParentCharset)
 {
     if ($this->sParentCharset !== $sParentCharset && $this->IsReparsed() && 0 < \strlen($this->sEncodedValueForReparse)) {
         $this->initInputData($this->sName, \trim(\MailSo\Base\Utils::DecodeHeaderValue($this->sEncodedValueForReparse, $sParentCharset)), $this->sEncodedValueForReparse);
     }
     $this->sParentCharset = $sParentCharset;
     return $this;
 }
開發者ID:Git-Host,項目名稱:email,代碼行數:12,代碼來源:Header.php

示例3: decodeAttrParamenter

 /**
  * @param array $aParams
  * @param string $sParamName
  * @param string $sCharset = \MailSo\Base\Enumerations\Charset::UTF_8
  * 
  * @return string
  */
 private static function decodeAttrParamenter($aParams, $sParamName, $sCharset = \MailSo\Base\Enumerations\Charset::UTF_8)
 {
     $sResult = '';
     if (isset($aParams[$sParamName])) {
         $sResult = \MailSo\Base\Utils::DecodeHeaderValue($aParams[$sParamName], $sCharset);
     } else {
         if (isset($aParams[$sParamName . '*'])) {
             $aValueParts = \explode('\'\'', $aParams[$sParamName . '*'], 2);
             if (\is_array($aValueParts) && 2 === \count($aValueParts)) {
                 $sCharset = isset($aValueParts[0]) ? $aValueParts[0] : \MailSo\Base\Enumerations\Charset::UTF_8;
                 $sResult = \MailSo\Base\Utils::ConvertEncoding(\urldecode($aValueParts[1]), $sCharset, \MailSo\Base\Enumerations\Charset::UTF_8);
             } else {
                 $sResult = \urldecode($aParams[$sParamName . '*']);
             }
         } else {
             if (isset($aParams[$sParamName . '*0*'])) {
                 $sCharset = '';
                 $aFileNames = array();
                 foreach ($aParams as $sName => $sValue) {
                     $aMatches = array();
                     if ($sParamName . '*0*' === $sName) {
                         if (0 === \strlen($sCharset)) {
                             $aValueParts = \explode('\'\'', $sValue, 2);
                             if (\is_array($aValueParts) && 2 === \count($aValueParts) && 0 < \strlen($aValueParts[0])) {
                                 $sCharset = $aValueParts[0];
                                 $sValue = $aValueParts[1];
                             }
                         }
                         $aFileNames[0] = $sValue;
                     } else {
                         if ($sParamName . '*0*' !== $sName && \preg_match('/^' . \preg_quote($sParamName, '/') . '\\*([0-9]+)\\*$/i', $sName, $aMatches) && 0 < \strlen($aMatches[1])) {
                             $aFileNames[(int) $aMatches[1]] = $sValue;
                         }
                     }
                 }
                 if (0 < \count($aFileNames)) {
                     \ksort($aFileNames, SORT_NUMERIC);
                     $sResult = \implode(\array_values($aFileNames));
                     $sResult = \urldecode($sResult);
                     if (0 < \strlen($sCharset)) {
                         $sResult = \MailSo\Base\Utils::ConvertEncoding($sResult, $sCharset, \MailSo\Base\Enumerations\Charset::UTF_8);
                     }
                 }
             }
         }
     }
     return $sResult;
 }
開發者ID:GTAWWEKID,項目名稱:tsiserver.us,代碼行數:55,代碼來源:BodyStructure.php

示例4: InitByFetchResponse


//.........這裏部分代碼省略.........
         $sDraftInfo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_DRAFT_INFO);
         if (0 < \strlen($sDraftInfo)) {
             $sType = '';
             $sFolder = '';
             $sUid = '';
             \MailSo\Mime\ParameterCollection::NewInstance($sDraftInfo)->ForeachList(function ($oParameter) use(&$sType, &$sFolder, &$sUid) {
                 switch (\strtolower($oParameter->Name())) {
                     case 'type':
                         $sType = $oParameter->Value();
                         break;
                     case 'uid':
                         $sUid = $oParameter->Value();
                         break;
                     case 'folder':
                         $sFolder = \base64_decode($oParameter->Value());
                         break;
                 }
             });
             if (0 < \strlen($sType) && 0 < \strlen($sFolder) && 0 < \strlen($sUid)) {
                 $this->aDraftInfo = array($sType, $sUid, $sFolder);
             }
         }
     } else {
         if ($oFetchResponse->GetEnvelope()) {
             if (0 === \strlen($sCharset) && $oBodyStructure) {
                 $sCharset = $oBodyStructure->SearchCharset();
                 $sCharset = \MailSo\Base\Utils::NormalizeCharset($sCharset);
             }
             if (0 === \strlen($sCharset)) {
                 $sCharset = \MailSo\Base\Enumerations\Charset::ISO_8859_1;
             }
             // date, subject, from, sender, reply-to, to, cc, bcc, in-reply-to, message-id
             $this->sMessageId = $oFetchResponse->GetFetchEnvelopeValue(9, '');
             $this->sSubject = \MailSo\Base\Utils::DecodeHeaderValue($oFetchResponse->GetFetchEnvelopeValue(1, ''), $sCharset);
             $this->oFrom = $oFetchResponse->GetFetchEnvelopeEmailCollection(2, $sCharset);
             $this->oSender = $oFetchResponse->GetFetchEnvelopeEmailCollection(3, $sCharset);
             $this->oReplyTo = $oFetchResponse->GetFetchEnvelopeEmailCollection(4, $sCharset);
             $this->oTo = $oFetchResponse->GetFetchEnvelopeEmailCollection(5, $sCharset);
             $this->oCc = $oFetchResponse->GetFetchEnvelopeEmailCollection(6, $sCharset);
             $this->oBcc = $oFetchResponse->GetFetchEnvelopeEmailCollection(7, $sCharset);
             $this->sInReplyTo = $oFetchResponse->GetFetchEnvelopeValue(8, '');
         }
     }
     $aTextParts = $oBodyStructure ? $oBodyStructure->SearchHtmlOrPlainParts() : null;
     if (\is_array($aTextParts) && 0 < \count($aTextParts)) {
         if (0 === \strlen($sCharset)) {
             $sCharset = \MailSo\Base\Enumerations\Charset::UTF_8;
         }
         $sHtmlParts = array();
         $sPlainParts = array();
         foreach ($aTextParts as $oPart) {
             $sText = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::BODY . '[' . $oPart->PartID() . ']');
             if (null === $sText) {
                 $sText = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::BODY . '[' . $oPart->PartID() . ']<0>');
                 if (\is_string($sText) && 0 < \strlen($sText)) {
                     $this->bTextPartIsTrimmed = true;
                 }
             }
             if (\is_string($sText) && 0 < \strlen($sText)) {
                 $sTextCharset = $oPart->Charset();
                 if (empty($sTextCharset)) {
                     $sTextCharset = $sCharset;
                 }
                 $sTextCharset = \MailSo\Base\Utils::NormalizeCharset($sTextCharset, true);
                 $sText = \MailSo\Base\Utils::DecodeEncodingValue($sText, $oPart->MailEncodingName());
                 $sText = \MailSo\Base\Utils::ConvertEncoding($sText, $sTextCharset, \MailSo\Base\Enumerations\Charset::UTF_8);
開發者ID:BertLasker,項目名稱:Catch-design,代碼行數:67,代碼來源:Message.php


注:本文中的MailSo\Base\Utils::DecodeHeaderValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。