• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP idn_to_ascii函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中idn_to_ascii函数的典型用法代码示例。如果您正苦于以下问题:PHP idn_to_ascii函数的具体用法?PHP idn_to_ascii怎么用?PHP idn_to_ascii使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: encode

 /**
  * Encode a domain to its Punycode version
  *
  * @param string $input Domain name in Unicode to be encoded
  *
  * @return string Punycode representation in ASCII
  */
 public function encode($input)
 {
     if ($this->idnSupport === true) {
         return idn_to_ascii($input);
     }
     return self::$punycode->encode($input);
 }
开发者ID:voku,项目名称:php-domain-parser,代码行数:14,代码来源:PunycodeWrapper.php


示例2: idnToAscii

 /**
  * Safely convert UTF-8 encoded domain name to ASCII
  * @param string $domainName  the UTF-8 encoded email
  * @return string
  */
 protected function idnToAscii($domainName)
 {
     if (extension_loaded('intl')) {
         return idn_to_ascii($domainName) ?: $domainName;
     }
     return $domainName;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:12,代码来源:AbstractAddressList.php


示例3: validate

 /**
  * @param Field $field
  * @return bool
  */
 public function validate(Field $field)
 {
     if ($field->isValueEmpty() === true) {
         return true;
     }
     $fieldValue = $field->getValue();
     $emailValid = filter_var($fieldValue, FILTER_VALIDATE_EMAIL);
     if ($emailValid === false) {
         return false;
     }
     if ($this->checkMx === false) {
         return true;
     }
     $domain = substr($fieldValue, strrpos($fieldValue, '@') + 1);
     $mxRecords = array();
     if (getmxrr(idn_to_ascii($domain), $mxRecords) === true) {
         return true;
     }
     // Port 25 fallback check if there's no MX record
     $aRecords = dns_get_record($domain, DNS_A);
     if (count($aRecords) <= 0) {
         return false;
     }
     $connection = @fsockopen($aRecords[0]['ip'], 25);
     if (is_resource($connection) === true) {
         fclose($connection);
         return true;
     }
     return false;
 }
开发者ID:TiMESPLiNTER,项目名称:formHandler,代码行数:34,代码来源:ValidEmailAddressRule.php


示例4: santise

 private function santise()
 {
     foreach ($this->domains as $key => $domain) {
         // Add IND support
         $idnDomain = idn_to_ascii($domain);
         if ($idnDomain === false) {
             continue;
         }
         // Validates domain as URL (according to » @link http://www.faqs.org/rfcs/rfc2396)
         if (!filter_var('http://' . idn_to_ascii($idnDomain) . '/', FILTER_VALIDATE_URL)) {
             continue;
         }
         // Replace *.example.com with just example.com
         if (strpos($domain, '*.') === 0) {
             $domain = substr($domain, 2);
         }
         // Doesn't handle wild cards yet.
         if (strpos($domain, '*') !== false) {
             continue;
         }
         // Minimum Length
         // x.yy is sortest domain possible.
         if (empty($domain) || mb_strlen($domain) < 4) {
             continue;
         }
         // Trim and lowercase
         $this->domainsProcessed[] = trim(strtolower($domain));
     }
     $this->domainsProcessedCount = count($this->domainsProcessed);
 }
开发者ID:nojacko,项目名称:email-data-disposable,代码行数:30,代码来源:Domains.php


示例5: isEmail

 /**
  * Valid Email
  *
  * @param   string
  * @return  bool
  */
 public static function isEmail($str)
 {
     if (function_exists('idn_to_ascii') && ($atpos = strpos($str, '@'))) {
         $str = substr($str, 0, ++$atpos) . idn_to_ascii(substr($str, $atpos));
     }
     return (bool) filter_var($str, FILTER_VALIDATE_EMAIL);
 }
开发者ID:dreeye,项目名称:helper,代码行数:13,代码来源:Validate_helper.php


示例6: CreatePDNSPass

 /**
  * @return mixed
  */
 public static function CreatePDNSPass()
 {
     System_Daemon::debug('Starting "DaemonConfigDNS::createPDNSPass" subprocess.');
     $xml = simplexml_load_file(DaemonConfig::$cfg->{'CONF_DIR'} . '/tpl/EasySCP_Config_DNS.xml');
     System_Daemon::debug('Building the new pdns config file');
     $xml->{'PDNS_USER'} = 'powerdns';
     $xml->{'PDNS_PASS'} = DB::encrypt_data(DaemonCommon::generatePassword(18));
     $xml->{'HOSTNAME'} = idn_to_ascii(DaemonConfig::$cfg->{'DATABASE_HOST'});
     $handle = fopen(DaemonConfig::$cfg->{'CONF_DIR'} . '/EasySCP_Config_DNS.xml', "wb");
     fwrite($handle, $xml->asXML());
     fclose($handle);
     DaemonCommon::systemSetFilePermissions(DaemonConfig::$cfg->{'CONF_DIR'} . '/EasySCP_Config_DNS.xml', DaemonConfig::$cfg->{'ROOT_USER'}, DaemonConfig::$cfg->{'ROOT_GROUP'}, 0640);
     // Create/Update Powerdns control user account if needed
     System_Daemon::debug('Adding the PowerDNS control user');
     $sql_param = array(':PDNS_USER' => $xml->{'PDNS_USER'}, ':PDNS_PASS' => DB::decrypt_data($xml->{'PDNS_PASS'}), ':HOSTNAME' => $xml->{'HOSTNAME'});
     $sql_query = "\n\t\t\tGRANT ALL PRIVILEGES ON powerdns.* TO :PDNS_USER@:HOSTNAME IDENTIFIED BY :PDNS_PASS;\n\t\t\tFLUSH PRIVILEGES;\n\t\t";
     DB::prepare($sql_query);
     DB::execute($sql_param)->closeCursor();
     $sql_param = array(':DATABASE_USER' => DaemonConfig::$cfg->DATABASE_USER, ':DATABASE_HOST' => idn_to_ascii(DaemonConfig::$cfg->{'DATABASE_HOST'}));
     $sql_query = "\n\t\t\tGRANT ALL PRIVILEGES ON powerdns.* TO :DATABASE_USER@:DATABASE_HOST;\n\t\t\tFLUSH PRIVILEGES;\n\t\t";
     DB::prepare($sql_query);
     DB::execute($sql_param)->closeCursor();
     System_Daemon::debug('Finished "DaemonConfigDNS::createPDNSPass" subprocess.');
     return true;
 }
开发者ID:gOOvER,项目名称:EasySCP,代码行数:28,代码来源:DaemonConfigDNS.php


示例7: validate

 /**
  * Validates an email address
  *
  * @param     string    $email          Email address
  * @param     boolean   $checkDomain    True if dns check should be performed
  * @access    public
  * @return    boolean   true if email is valid
  */
 function validate($email, $checkDomain = false)
 {
     if (function_exists('idn_to_ascii')) {
         if ($parts = explode('@', $email)) {
             if (sizeof($parts) == 2) {
                 foreach ($parts as &$part) {
                     $part = idn_to_ascii($part);
                 }
                 $email = implode('@', $parts);
             }
         }
     }
     // Fix for bug #10799: add 'D' modifier to regex
     if (preg_match($this->regex . 'D', $email)) {
         if ($checkDomain && function_exists('checkdnsrr')) {
             $tokens = explode('@', $email);
             if (checkdnsrr($tokens[1], 'MX') || checkdnsrr($tokens[1], 'A')) {
                 return true;
             }
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:mollux,项目名称:civicrm-packages,代码行数:33,代码来源:Email.php


示例8: encodeHostName

 public static function encodeHostName($hostname)
 {
     if (!self::is_valid_utf8($hostname)) {
         return $hostname;
         //invalid
     }
     if (function_exists('idn_to_ascii') && 0) {
         return idn_to_ascii($hostname);
         //php 5.3+
     }
     $old_encoding = mb_internal_encoding();
     mb_internal_encoding("UTF-8");
     $pieces = explode(".", self::mb_strtolower($hostname));
     $punycode_pieces = array();
     foreach ($pieces as $piece) {
         if (preg_match("/[\\x{80}-\\x{FFFF}]/u", $piece)) {
             $punycode_pieces[] = "xn--" . self::encode($piece);
         } else {
             if (preg_match('/^[a-z\\d][a-z\\d-]{0,62}$/i', $piece) && !preg_match('/-$/', $piece)) {
                 $punycode_pieces[] = $piece;
             } else {
                 mb_internal_encoding($old_encoding);
                 return $hostname;
                 //invalid domain
             }
         }
     }
     mb_internal_encoding($old_encoding);
     return implode(".", $punycode_pieces);
 }
开发者ID:bitbybit,项目名称:avdetect,代码行数:30,代码来源:Punycode.php


示例9: validateValue

 /**
  * @inheritdoc
  */
 protected function validateValue($value)
 {
     if (!is_string($value)) {
         $valid = false;
     } elseif (!preg_match('/^(?P<name>(?:"?([^"]*)"?\\s)?)(?:\\s+)?(?:(?P<open><?)((?P<local>.+)@(?P<domain>[^>]+))(?P<close>>?))$/i', $value, $matches)) {
         $valid = false;
     } else {
         if ($this->enableIDN) {
             $matches['local'] = idn_to_ascii($matches['local']);
             $matches['domain'] = idn_to_ascii($matches['domain']);
             $value = $matches['name'] . $matches['open'] . $matches['local'] . '@' . $matches['domain'] . $matches['close'];
         }
         if (strlen($matches['local']) > 64) {
             // The maximum total length of a user name or other local-part is 64 octets. RFC 5322 section 4.5.3.1.1
             // http://tools.ietf.org/html/rfc5321#section-4.5.3.1.1
             $valid = false;
         } elseif (strlen($matches['local'] . '@' . $matches['domain']) > 254) {
             // There is a restriction in RFC 2821 on the length of an address in MAIL and RCPT commands
             // of 254 characters. Since addresses that do not fit in those fields are not normally useful, the
             // upper limit on address lengths should normally be considered to be 254.
             //
             // Dominic Sayers, RFC 3696 erratum 1690
             // http://www.rfc-editor.org/errata_search.php?eid=1690
             $valid = false;
         } else {
             $valid = preg_match($this->pattern, $value) || $this->allowName && preg_match($this->fullPattern, $value);
             if ($valid && $this->checkDNS) {
                 $valid = checkdnsrr($matches['domain'], 'MX') || checkdnsrr($matches['domain'], 'A');
             }
         }
     }
     return $valid ? null : [$this->message, []];
 }
开发者ID:arogachev,项目名称:yii2,代码行数:36,代码来源:EmailValidator.php


示例10: isDomainAvailable

 /**
  * Is domain available
  *
  * @param string $domain
  * @return bool
  */
 public function isDomainAvailable($domain, $values = null)
 {
     $domain = @idn_to_ascii($domain);
     if (empty($domain)) {
         return false;
     }
     $config = $this->getServiceLocator()->get('Config')['db'];
     if (!empty($config['defaultDomain']) && $domain == $config['defaultDomain']) {
         return false;
     }
     $parts = explode('.', $domain);
     if (count($parts) < 2) {
         return false;
     }
     if (is_object($values)) {
         $values = (array) $values;
     }
     if (!empty($values['id'])) {
         $excludeId = (int) $values['id'];
     } else {
         $excludeId = null;
     }
     $mapper = $this->getMapper();
     $domain = array_pop($parts);
     do {
         $domain = array_pop($parts) . '.' . $domain;
         if ($mapper->isDomainExists($domain, $excludeId)) {
             return false;
         }
     } while (!empty($parts));
     return true;
 }
开发者ID:gridguyz,项目名称:multisite,代码行数:38,代码来源:Rpc.php


示例11: verifyDomainName

 /**
  * Convert IDN names and verify the validity and specification constraints
  * @param string $domainName Domain name
  * @return string
  */
 private function verifyDomainName($domainName)
 {
     Log::debug('Verify domain: ' . $domainName);
     // Since PHP does not support IDN domain names, convert to ASCII by default
     $domainName = strtolower(idn_to_ascii(trim($domainName)));
     // Validate domain name length, max length 253
     if (strlen($domainName) > 253) {
         Log::error('Domain name exceedes the max length of 253 characters: ' . $domainName);
         return false;
     }
     // Make sure there is at least one "dot"
     if (strpos($domainName, '.') === false) {
         Log::error('Domain name is missing a dot character: ' . $domainName);
         return false;
     }
     // Explode "dot" separated parts
     $parts = explode('.', $domainName);
     // Validate parts
     foreach ($parts as $p) {
         // Max length 63 characters
         if (strlen($p) > 63) {
             Log::error('A domain name part exceedes the mas length of 63 characters: ' . $p);
             return false;
         }
         // Validate characters
         if (preg_match('/^[-a-z0-9]+$/i', $p) !== 1) {
             Log::error('Invalid characters in the domain name part: ' . $p);
             return false;
         }
     }
     return $domainName;
 }
开发者ID:noumenia,项目名称:aetolos,代码行数:37,代码来源:domainhelper.inc.php


示例12: test_compose_withPunycodeHost_returnsValidURL

 public function test_compose_withPunycodeHost_returnsValidURL()
 {
     $punycode = 'http://' . idn_to_ascii('piña.com');
     $expectedComposedUrl = 'http://xn--pia-8ma.com';
     $url = new UrlComposer($punycode);
     $this->assertEquals($expectedComposedUrl, $url->compose());
 }
开发者ID:retrinko,项目名称:url-composer,代码行数:7,代码来源:UrlComposerTest.php


示例13: isValidDomain

 /**
  * Return true if a domain is a valid domain.
  * @link https://url.spec.whatwg.org/#valid-domain URL Standard
  * @param string $domain A UTF-8 string.
  * @return boolean
  */
 public static function isValidDomain($domain)
 {
     $valid = mb_strlen($domain, 'UTF-8') <= self::PHP_IDN_HANDLEABLE_LENGTH;
     if ($valid) {
         $result = idn_to_ascii($domain, IDNA_USE_STD3_RULES | IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);
         if (!is_string($result)) {
             $valid = false;
         }
     }
     if ($valid) {
         $domainNameLength = strlen($result);
         if ($domainNameLength < 1 || $domainNameLength > 253) {
             $valid = false;
         }
     }
     if ($valid) {
         foreach (explode('.', $result) as $label) {
             $labelLength = strlen($label);
             if ($labelLength < 1 || $labelLength > 63) {
                 $valid = false;
                 break;
             }
         }
     }
     if ($valid) {
         $result = idn_to_utf8($result, IDNA_USE_STD3_RULES, INTL_IDNA_VARIANT_UTS46, $idna_info);
         if ($idna_info['errors'] !== 0) {
             $valid = false;
         }
     }
     return $valid;
 }
开发者ID:esperecyan,项目名称:url,代码行数:38,代码来源:HostProcessing.php


示例14: setDomain

 /**
  * Set domain
  *
  * @param string $domain
  * @return \MultisitePlatform\Model\Domain\Structure
  */
 public function setDomain($domain)
 {
     $domain = @idn_to_ascii($domain);
     if (!empty($domain)) {
         $this->domain = $domain;
     }
     return $this;
 }
开发者ID:gridguyz,项目名称:multisite,代码行数:14,代码来源:Structure.php


示例15: valid_email

 function valid_email($address)
 {
     $patternselect = 'auto';
     //
     // Added by Ivan Tcholakov, 17-OCT-2015.
     if (function_exists('idn_to_ascii') && ($atpos = strpos($address, '@'))) {
         $address = substr($address, 0, ++$atpos) . idn_to_ascii(substr($address, $atpos));
     }
     //
     if (!$patternselect or $patternselect == 'auto') {
         //Check this constant first so it works when extension_loaded() is disabled by safe mode
         //Constant was added in PHP 5.2.4
         if (defined('PCRE_VERSION')) {
             //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2
             if (version_compare(PCRE_VERSION, '8.0.3') >= 0) {
                 $patternselect = 'pcre8';
             } else {
                 $patternselect = 'pcre';
             }
         } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) {
             //Fall back to older PCRE
             $patternselect = 'pcre';
         } else {
             //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension
             if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
                 $patternselect = 'php';
             } else {
                 $patternselect = 'noregex';
             }
         }
     }
     switch ($patternselect) {
         case 'pcre8':
             /**
              * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains.
              * @link http://squiloople.com/2009/12/20/email-address-validation/
              * @copyright 2009-2010 Michael Rushton
              * Feel free to use and redistribute this code. But please keep this copyright notice.
              */
             return (bool) preg_match('/^(?!(?>(?1)"?(?>\\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\\[ -~]|[^"])"?(?1)){65,}@)' . '((?>(?>(?>((?>(?>(?>\\x0D\\x0A)?[\\t ])+|(?>[\\t ]*\\x0D\\x0A)?[\\t ]+)?)(\\((?>(?2)' . '(?>[\\x01-\\x08\\x0B\\x0C\\x0E-\'*-\\[\\]-\\x7F]|\\\\[\\x00-\\x7F]|(?3)))*(?2)\\)))+(?2))|(?2))?)' . '([!#-\'*+\\/-9=?^-~-]+|"(?>(?2)(?>[\\x01-\\x08\\x0B\\x0C\\x0E-!#-\\[\\]-\\x7F]|\\\\[\\x00-\\x7F]))*' . '(?2)")(?>(?1)\\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . '(?>(?1)\\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . '|(?!(?:.*[a-f0-9][:\\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . '|[1-9]?[0-9])(?>\\.(?9)){3}))\\])(?1)$/isD', $address);
         case 'pcre':
             //An older regex that doesn't need a recent PCRE
             return (bool) preg_match('/^(?!(?>"?(?>\\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\\[ -~]|[^"])"?){65,}@)(?>' . '[!#-\'*+\\/-9=?^-~-]+|"(?>(?>[\\x01-\\x08\\x0B\\x0C\\x0E-!#-\\[\\]-\\x7F]|\\\\[\\x00-\\xFF]))*")' . '(?>\\.(?>[!#-\'*+\\/-9=?^-~-]+|"(?>(?>[\\x01-\\x08\\x0B\\x0C\\x0E-!#-\\[\\]-\\x7F]|\\\\[\\x00-\\xFF]))*"))*' . '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\\.(?![a-z0-9-]{64,})' . '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' . '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' . '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' . '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' . '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' . '|[1-9]?[0-9])(?>\\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\\])$/isD', $address);
         case 'html5':
             /**
              * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements.
              * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
              */
             return (bool) preg_match('/^[a-zA-Z0-9.!#$%&\'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' . '[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', $address);
         case 'noregex':
             //No PCRE! Do something _very_ approximate!
             //Check the address is 3 chars or longer and contains an @ that's not the first or last char
             return strlen($address) >= 3 and strpos($address, '@') >= 1 and strpos($address, '@') != strlen($address) - 1;
         case 'php':
         default:
             return (bool) filter_var($address, FILTER_VALIDATE_EMAIL);
     }
 }
开发者ID:aslijiasheng,项目名称:ciFramework,代码行数:58,代码来源:MY_email_helper.php


示例16: validate_email

 function validate_email($variable, $options = null)
 {
     if (($pos = strrpos($variable, '@')) === false) {
         return false;
     }
     $local_part = substr($variable, 0, $pos);
     $domain_part = substr($variable, $pos + 1);
     return (bool) filter_var($local_part . '@' . idn_to_ascii($domain_part), FILTER_VALIDATE_EMAIL, $options);
 }
开发者ID:lifeofguenter,项目名称:validate_rapper,代码行数:9,代码来源:validate.php


示例17: create_identity

 public function create_identity($p)
 {
     $rcmail = rcmail::get_instance();
     // prefs are set in create_user()
     if ($this->prefs) {
         if ($this->prefs['full_name']) {
             $p['record']['name'] = $this->prefs['full_name'];
         }
         if (($this->identities_level == 0 || $this->identities_level == 2) && $this->prefs['email_address']) {
             $p['record']['email'] = $this->prefs['email_address'];
         }
         if ($this->prefs['___signature___']) {
             $p['record']['signature'] = $this->prefs['___signature___'];
         }
         if ($this->prefs['reply_to']) {
             $p['record']['reply-to'] = $this->prefs['reply_to'];
         }
         if (($this->identities_level == 0 || $this->identities_level == 1) && isset($this->prefs['identities']) && $this->prefs['identities'] > 1) {
             for ($i = 1; $i < $this->prefs['identities']; $i++) {
                 unset($ident_data);
                 $ident_data = array('name' => '', 'email' => '');
                 // required data
                 if ($this->prefs['full_name' . $i]) {
                     $ident_data['name'] = $this->prefs['full_name' . $i];
                 }
                 if ($this->identities_level == 0 && $this->prefs['email_address' . $i]) {
                     $ident_data['email'] = $this->prefs['email_address' . $i];
                 } else {
                     $ident_data['email'] = $p['record']['email'];
                 }
                 if ($this->prefs['reply_to' . $i]) {
                     $ident_data['reply-to'] = $this->prefs['reply_to' . $i];
                 }
                 if ($this->prefs['___sig' . $i . '___']) {
                     $ident_data['signature'] = $this->prefs['___sig' . $i . '___'];
                 }
                 // insert identity
                 $identid = $rcmail->user->insert_identity($ident_data);
             }
         }
         // copy address book
         $contacts = $rcmail->get_address_book(null, true);
         if ($contacts && count($this->abook)) {
             foreach ($this->abook as $rec) {
                 // #1487096 handle multi-address and/or too long items
                 $rec['email'] = array_shift(explode(';', $rec['email']));
                 if (check_email(idn_to_ascii($rec['email']))) {
                     $rec['email'] = idn_to_utf8($rec['email']);
                     $contacts->insert($rec, true);
                 }
             }
         }
         // mark identity as complete for following hooks
         $p['complete'] = true;
     }
     return $p;
 }
开发者ID:shishenkov,项目名称:zpanel,代码行数:57,代码来源:squirrelmail_usercopy.php


示例18: normaliseHost

 /**
  * Host is case-insensitive, normalise to lowercase and to ascii version of
  * IDN format
  */
 private function normaliseHost()
 {
     if (isset($this->parts['host'])) {
         $host = idn_to_ascii($this->parts['host']->get());
         $host = trim($host);
         $host = strtolower($host);
         $this->parts['host']->set($host);
     }
 }
开发者ID:sintoris,项目名称:Known,代码行数:13,代码来源:Normaliser.php


示例19: isEmail

 /**
  * returns true if email is usuable
  * @param string $email
  */
 public static function isEmail($email)
 {
     $pos = strrpos($email, '@');
     if ($pos === false) {
         return false;
     }
     $ascii_email = substr($email, 0, $pos) . '@' . idn_to_ascii(substr($email, $pos + 1), 0, INTL_IDNA_VARIANT_2003);
     return filter_var($ascii_email, FILTER_VALIDATE_EMAIL);
 }
开发者ID:africc,项目名称:php-epp2,代码行数:13,代码来源:Validator.php


示例20: isEquivalentTo

 /**
  * 
  * @param \webignition\Url\Host\Host $comparator
  * @param array $excludeParts
  * @return boolean
  */
 public function isEquivalentTo(Host $comparator, $excludeParts = array())
 {
     $thisHost = new Host(idn_to_ascii((string) $this));
     $comparatorHost = new Host(idn_to_ascii((string) $comparator));
     if (!is_array($excludeParts) || count($excludeParts) == 0) {
         return $thisHost->equals($comparatorHost);
     }
     $thisParts = $this->excludeParts($thisHost->getParts(), $excludeParts);
     $comparatorParts = $this->excludeParts($comparatorHost->getParts(), $excludeParts);
     return $thisParts == $comparatorParts;
 }
开发者ID:sintoris,项目名称:Known,代码行数:17,代码来源:Host.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP idn_to_utf8函数代码示例发布时间:2022-05-15
下一篇:
PHP idjia函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap