コード例 #1
0
 /**
  * Check if an email address is on a list of exceptions.
  * 
  * @param string $email
  * @param object $config (optional)
  * @return string|null
  */
 public function getSendingMethodForEmailAddress($email, $config = null)
 {
     if (!$config) {
         $config = $this->getConfig();
     }
     if (!isset($config->exceptions) || !is_array($config->exceptions) || !count($config->exceptions)) {
         return null;
     }
     $email = Rhymix\Framework\URL::encodeIdna($email);
     foreach ($config->exceptions as $exception) {
         $domains = array();
         foreach ($exception['domains'] as $domain) {
             $domains[] = preg_quote($domain, '/');
         }
         if (count($domains) && preg_match('/\\b(?:' . implode('|', $domains) . ')$/i', $email)) {
             return $exception['method'];
         }
     }
     return null;
 }
コード例 #2
0
ファイル: Context.class.php プロジェクト: rhymix/rhymix
 /**
  * Encode UTF-8 domain into IDNA (punycode)
  * 
  * @param string $domain Domain to convert
  * @return string Converted string
  */
 public static function encodeIdna($domain)
 {
     return Rhymix\Framework\URL::encodeIdna($domain);
 }