当前位置: 首页>>代码示例>>PHP>>正文


PHP api_Utils::ConvertEncoding方法代码示例

本文整理汇总了PHP中api_Utils::ConvertEncoding方法的典型用法代码示例。如果您正苦于以下问题:PHP api_Utils::ConvertEncoding方法的具体用法?PHP api_Utils::ConvertEncoding怎么用?PHP api_Utils::ConvertEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在api_Utils的用法示例。


在下文中一共展示了api_Utils::ConvertEncoding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateSieveFilters

 /**
  * @param CAcount $oAccount
  * @param array $aFilters
  *
  * @return bool
  */
 public function updateSieveFilters($oAccount, $aFilters)
 {
     $sFilters = "#sieve filter\n\n";
     if ($oAccount) {
         foreach ($aFilters as $oFilter) {
             if ('' === trim($oFilter->Filter)) {
                 continue;
             }
             if (EFilterAction::MoveToFolder === $oFilter->Action && '' === trim($oFilter->FolderFullName)) {
                 continue;
             }
             $aFields = array();
             switch ($oFilter->Field) {
                 default:
                 case EFilterFiels::From:
                     $aFields[] = 'From';
                     break;
                 case EFilterFiels::To:
                     $aFields[] = 'To';
                     $aFields[] = 'CC';
                     break;
                 case EFilterFiels::Subject:
                     $aFields[] = 'Subject';
                     break;
             }
             // condition
             foreach ($aFields as $iIndex => $sField) {
                 $aFields[$iIndex] = '"' . $this->_quoteValue($sField) . '"';
             }
             $sCondition = '';
             $sFields = implode(',', $aFields);
             switch ($oFilter->Condition) {
                 case EFilterCondition::ContainSubstring:
                     $sCondition = 'if header :contains [' . $sFields . '] "' . $this->_quoteValue($oFilter->Filter) . '" {';
                     break;
                 case EFilterCondition::ContainExactPhrase:
                     $sCondition = 'if header :is [' . $sFields . '] "' . $this->_quoteValue($oFilter->Filter) . '" {';
                     break;
                 case EFilterCondition::NotContainSubstring:
                     $sCondition = 'if not header :contains [' . $sFields . '] "' . $this->_quoteValue($oFilter->Filter) . '" {';
                     break;
             }
             // folder
             $sFolderFullName = '';
             if (EFilterAction::MoveToFolder === $oFilter->Action) {
                 $sFolderFullName = api_Utils::ConvertEncoding($oFilter->FolderFullName, 'utf7-imap', $this->sSieveFolderCharset);
             }
             // action
             $sAction = '';
             switch ($oFilter->Action) {
                 case EFilterAction::DeleteFromServerImmediately:
                     $sAction = 'discard ;';
                     $sAction .= 'stop ;';
                     break;
                 case EFilterAction::MoveToFolder:
                     $sAction = 'fileinto "' . $this->_quoteValue($sFolderFullName) . '" ;' . "\n";
                     $sAction .= 'stop ;';
                     break;
             }
             $sEnd = '}';
             if (!$oFilter->Enable) {
                 $sCondition = '#' . $sCondition;
                 $sAction = '#' . $sAction;
                 $sEnd = '#' . $sEnd;
             }
             $sFilters .= "\n" . '#sieve_filter:' . implode(';', array($oFilter->Enable ? '1' : '0', $oFilter->Condition, $oFilter->Field, $oFilter->Filter, $oFilter->Action, $sFolderFullName)) . "\n";
             $sFilters .= $sCondition . "\n";
             $sFilters .= $sAction . "\n";
             $sFilters .= $sEnd . "\n";
         }
         $sFilters = $sFilters . "\n" . '#end sieve filter' . "\n";
         return $this->setFiltersRawData($oAccount, $sFilters);
     }
     return false;
 }
开发者ID:Git-Host,项目名称:email,代码行数:81,代码来源:manager.php


注:本文中的api_Utils::ConvertEncoding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。