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


PHP Utils::GetClearDomainName方法代碼示例

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


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

示例1: compileLogParams

 /**
  * @param string $sLine
  * @param \RainLoop\Model\Account $oAccount = null
  * @param bool $bUrlEncode = false
  *
  * @return string
  */
 private function compileLogParams($sLine, $oAccount = null, $bUrlEncode = false)
 {
     if (false !== \strpos($sLine, '{date:')) {
         $iTimeOffset = (int) $this->Config()->Get('logs', 'time_offset', 0);
         $sLine = \preg_replace_callback('/\\{date:([^}]+)\\}/', function ($aMatch) use($iTimeOffset, $bUrlEncode) {
             return \RainLoop\Utils::UrlEncode(\MailSo\Log\Logger::DateHelper($aMatch[1], $iTimeOffset), $bUrlEncode);
         }, $sLine);
         $sLine = \preg_replace('/\\{date:([^}]*)\\}/', 'date', $sLine);
     }
     if (false !== \strpos($sLine, '{imap:') || false !== \strpos($sLine, '{smtp:')) {
         if (!$oAccount) {
             $this->ParseQueryAuthString();
             $oAccount = $this->getAccountFromToken(false);
         }
         if ($oAccount) {
             $sLine = \str_replace('{imap:login}', \RainLoop\Utils::UrlEncode($oAccount->IncLogin(), $bUrlEncode), $sLine);
             $sLine = \str_replace('{imap:host}', \RainLoop\Utils::UrlEncode($oAccount->DomainIncHost(), $bUrlEncode), $sLine);
             $sLine = \str_replace('{imap:port}', \RainLoop\Utils::UrlEncode($oAccount->DomainIncPort(), $bUrlEncode), $sLine);
             $sLine = \str_replace('{smtp:login}', \RainLoop\Utils::UrlEncode($oAccount->OutLogin(), $bUrlEncode), $sLine);
             $sLine = \str_replace('{smtp:host}', \RainLoop\Utils::UrlEncode($oAccount->DomainOutHost(), $bUrlEncode), $sLine);
             $sLine = \str_replace('{smtp:port}', \RainLoop\Utils::UrlEncode($oAccount->DomainOutPort(), $bUrlEncode), $sLine);
         }
         $sLine = \preg_replace('/\\{imap:([^}]*)\\}/i', 'imap', $sLine);
         $sLine = \preg_replace('/\\{smtp:([^}]*)\\}/i', 'smtp', $sLine);
     }
     if (false !== \strpos($sLine, '{request:')) {
         if (false !== \strpos($sLine, '{request:ip}')) {
             $sLine = \str_replace('{request:ip}', \RainLoop\Utils::UrlEncode($this->Http()->GetClientIp($this->Config()->Get('labs', 'http_client_ip_check_proxy', false)), $bUrlEncode), $sLine);
         }
         if (false !== \strpos($sLine, '{request:domain}')) {
             $sLine = \str_replace('{request:domain}', \RainLoop\Utils::UrlEncode($this->Http()->GetHost(false, true, true), $bUrlEncode), $sLine);
         }
         if (false !== \strpos($sLine, '{request:domain-clear}')) {
             $sLine = \str_replace('{request:domain-clear}', \RainLoop\Utils::UrlEncode(\MailSo\Base\Utils::GetClearDomainName($this->Http()->GetHost(false, true, true)), $bUrlEncode), $sLine);
         }
         $sLine = \preg_replace('/\\{request:([^}]*)\\}/i', 'request', $sLine);
     }
     if (false !== \strpos($sLine, '{user:')) {
         if (false !== \strpos($sLine, '{user:uid}')) {
             $sLine = \str_replace('{user:uid}', \RainLoop\Utils::UrlEncode(\base_convert(\sprintf('%u', \crc32(\md5(\RainLoop\Utils::GetConnectionToken()))), 10, 32), $bUrlEncode), $sLine);
         }
         if (false !== \strpos($sLine, '{user:ip}')) {
             $sLine = \str_replace('{user:ip}', \RainLoop\Utils::UrlEncode($this->Http()->GetClientIp($this->Config()->Get('labs', 'http_client_ip_check_proxy', false)), $bUrlEncode), $sLine);
         }
         if (\preg_match('/\\{user:(email|login|domain)\\}/i', $sLine)) {
             if (!$oAccount) {
                 $this->ParseQueryAuthString();
                 $oAccount = $this->getAccountFromToken(false);
             }
             if ($oAccount) {
                 $sEmail = $oAccount->Email();
                 $sLine = \str_replace('{user:email}', \RainLoop\Utils::UrlEncode($sEmail, $bUrlEncode), $sLine);
                 $sLine = \str_replace('{user:login}', \RainLoop\Utils::UrlEncode(\MailSo\Base\Utils::GetAccountNameFromEmail($sEmail), $bUrlEncode), $sLine);
                 $sLine = \str_replace('{user:domain}', \RainLoop\Utils::UrlEncode(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), $bUrlEncode), $sLine);
                 $sLine = \str_replace('{user:domain-clear}', \RainLoop\Utils::UrlEncode(\MailSo\Base\Utils::GetClearDomainName(\MailSo\Base\Utils::GetDomainFromEmail($sEmail)), $bUrlEncode), $sLine);
             }
         }
         $sLine = \preg_replace('/\\{user:([^}]*)\\}/i', 'unknown', $sLine);
     }
     if (false !== \strpos($sLine, '{labs:')) {
         $sLine = \preg_replace_callback('/\\{labs:rand:([1-9])\\}/', function ($aMatch) {
             return \rand(\pow(10, $aMatch[1] - 1), \pow(10, $aMatch[1]) - 1);
         }, $sLine);
         $sLine = \preg_replace('/\\{labs:([^}]*)\\}/', 'labs', $sLine);
     }
     return $sLine;
 }
開發者ID:ChristopheGitHub,項目名稱:rainloop-webmail,代碼行數:74,代碼來源:Actions.php


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