getContactsManager(); if (!$cm || !$cm->isEnabled()) { return []; } $aSearchResult = $cm->search($sQuery, array('FN', 'NICKNAME', 'TITLE', 'EMAIL')); //$this->oLogger->WriteDump($aSearchResult); if (\is_array($aSearchResult) && 0 < \count($aSearchResult)) { $iInputLimit = $iLimit; $aResult = array(); foreach ($aSearchResult as $aContact) { if (0 >= $iLimit) { break; } if (!empty($aContact['UID'])) { $sUid = $aContact['UID']; $mEmails = isset($aContact['EMAIL']) ? $aContact['EMAIL'] : ''; $sFullName = isset($aContact['FN']) ? \trim($aContact['FN']) : ''; if (empty($sFullName) && isset($aContact['NICKNAME'])) { $sFullName = \trim($aContact['NICKNAME']); } if (!\is_array($mEmails)) { $mEmails = array($mEmails); } foreach ($mEmails as $sEmail) { $sHash = $sFullName.'|'.$sEmail; if (!isset($aResult[$sHash])) { $aResult[$sHash] = array($sEmail, $sFullName); --$iLimit; } } } } return \array_slice(\array_values($aResult), 0, $iInputLimit); } } catch (\Exception $oException) { if ($this->oLogger) { $this->oLogger->WriteException($oException); } } return []; } public function SetLogger(\MailSo\Log\Logger $oLogger) { $this->oLogger = $oLogger; } }