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


PHP api_Utils::ClearPhone方法代码示例

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


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

示例1: getNamesByCallersNumbers

 /**
  * @param CAccount $oAccount
  * @param array $aNumbers
  * @param bool $bUseCache = true
  * @return array
  */
 public function getNamesByCallersNumbers($oAccount, $aNumbers, $bUseCache = true)
 {
     $mResult = false;
     $oApiContactsManager = CApi::Manager('contactsmain');
     if (is_array($aNumbers) && 0 < count($aNumbers) && $oAccount && $oApiContactsManager) {
         $bFromCache = false;
         $sCacheKey = '';
         $mNamesResult = null;
         $oApiFileCache = $bUseCache ? CApi::Manager('filecache') : false;
         if ($oApiFileCache) {
             $sCacheKey = $this->_generateCacheFileName($oAccount->IdUser);
             if (!empty($sCacheKey)) {
                 $sData = $oApiFileCache->get($oAccount, $sCacheKey);
                 if (!empty($sData)) {
                     $mNamesResult = @json_decode($sData, true);
                     if (!is_array($mNamesResult)) {
                         $mNamesResult = null;
                     } else {
                         $bFromCache = true;
                         CApi::Log('Cache: get contacts names from cache (count:' . count($mNamesResult) . ')');
                     }
                 }
             }
         }
         if (!is_array($mNamesResult)) {
             $mNamesResult = $oApiContactsManager->GetAllContactsNamesWithPhones($oAccount);
         }
         if (is_array($mNamesResult)) {
             if (!$bFromCache && $oApiFileCache && 0 < strlen($sCacheKey)) {
                 $oApiFileCache->put($oAccount, $sCacheKey, @json_encode($mNamesResult));
                 CApi::Log('Cache: save contacts names to cache (count:' . count($mNamesResult) . ')');
             }
             $aNormNumbers = array();
             foreach ($aNumbers as $sNumber) {
                 $aNormNumbers[$sNumber] = api_Utils::ClearPhone($sNumber);
             }
             foreach ($aNormNumbers as $sInputNumber => $sClearNumber) {
                 $aNormNumbers[$sInputNumber] = isset($mNamesResult[$sClearNumber]) ? $mNamesResult[$sClearNumber] : '';
             }
             $mResult = $aNormNumbers;
         }
     } else {
         if (is_array($aNumbers)) {
             $mResult = array();
         }
     }
     return $mResult;
 }
开发者ID:Git-Host,项目名称:email,代码行数:54,代码来源:manager.php

示例2: GetAllContactsNamesWithPhones

 /**
  * @param int $iUserId
  * @param int $iTenantId = 0
  * @param bool $bAddGlobal = true
  * @return bool|array
  */
 public function GetAllContactsNamesWithPhones($iUserId, $iTenantId = 0, $bAddGlobal = true)
 {
     $mNames = false;
     if ($this->oConnection->Execute($this->oCommandCreator->GetAllContactsNamesWithPhones($iUserId, $iTenantId, $bAddGlobal))) {
         $mNames = array();
         while (false !== ($oRow = $this->oConnection->GetNextRecord())) {
             $sName = trim($oRow->fullname);
             if (0 === strlen($sName)) {
                 $sName = trim($oRow->firstname);
                 $sName .= ' ' . trim($oRow->surname);
                 $sName = trim($sName);
             }
             if (0 === strlen($sName)) {
                 $sName = trim($oRow->view_email);
             }
             if (0 < strlen($sName)) {
                 $sPhone = trim($oRow->b_phone);
                 if (0 < strlen($sPhone)) {
                     $sPhone = api_Utils::ClearPhone($sPhone);
                     if (0 < strlen($sPhone)) {
                         $mNames[$sPhone] = $sName;
                     }
                 }
                 $sPhone = trim($oRow->h_phone);
                 if (0 < strlen($sPhone)) {
                     $sPhone = api_Utils::ClearPhone($sPhone);
                     if (0 < strlen($sPhone)) {
                         $mNames[$sPhone] = $sName;
                     }
                 }
                 $sPhone = trim($oRow->h_mobile);
                 if (0 < strlen($sPhone)) {
                     $sPhone = api_Utils::ClearPhone($sPhone);
                     if (0 < strlen($sPhone)) {
                         $mNames[$sPhone] = $sName;
                     }
                 }
             }
         }
     }
     return $mNames;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:48,代码来源:storage.php


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