web/lib/Zend/Validate/Hostname.php
changeset 1230 68c69c656a2c
parent 807 877f952ae2bd
equal deleted inserted replaced
1229:5a6b6e770365 1230:68c69c656a2c
    12  * obtain it through the world-wide-web, please send an email
    12  * obtain it through the world-wide-web, please send an email
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Validate
    16  * @package    Zend_Validate
    17  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    17  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @version    $Id: Hostname.php 25061 2012-11-02 21:24:09Z rob $
    19  * @version    $Id$
    20  */
    20  */
    21 
    21 
    22 /**
    22 /**
    23  * @see Zend_Validate_Abstract
    23  * @see Zend_Validate_Abstract
    24  */
    24  */
    39  * The second is tests/Zend/Validate/HostnameTestForm.php which is designed to be run via HTML
    39  * The second is tests/Zend/Validate/HostnameTestForm.php which is designed to be run via HTML
    40  * to allow users to test entering UTF-8 characters in a form.
    40  * to allow users to test entering UTF-8 characters in a form.
    41  *
    41  *
    42  * @category   Zend
    42  * @category   Zend
    43  * @package    Zend_Validate
    43  * @package    Zend_Validate
    44  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    44  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    45  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    45  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    46  */
    46  */
    47 class Zend_Validate_Hostname extends Zend_Validate_Abstract
    47 class Zend_Validate_Hostname extends Zend_Validate_Abstract
    48 {
    48 {
    49     const CANNOT_DECODE_PUNYCODE  = 'hostnameCannotDecodePunycode';
    49     const CANNOT_DECODE_PUNYCODE  = 'hostnameCannotDecodePunycode';
   108     const ALLOW_ALL = 15;
   108     const ALLOW_ALL = 15;
   109 
   109 
   110     /**
   110     /**
   111      * Array of valid top-level-domains
   111      * Array of valid top-level-domains
   112      *
   112      *
   113      * @see ftp://data.iana.org/TLD/tlds-alpha-by-domain.txt  List of all TLDs by domain
   113      * Version 2014112800, Last Updated Fri Nov 28 07:07:01 2014 UTC
       
   114      *
       
   115      * @see http://data.iana.org/TLD/tlds-alpha-by-domain.txt  List of all TLDs by domain
   114      * @see http://www.iana.org/domains/root/db/ Official list of supported TLDs
   116      * @see http://www.iana.org/domains/root/db/ Official list of supported TLDs
   115      * @var array
   117      * @var array
   116      */
   118      */
   117     protected $_validTlds = array(
   119     protected $_validTlds = array(
   118         'ac', 'ad', 'ae', 'aero', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', 'aq', 'ar', 'arpa',
   120         'abogado',
   119         'as', 'asia', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi',
   121         'ac',
   120         'biz', 'bj', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cat', 'cc',
   122         'academy',
   121         'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'com', 'coop', 'cr', 'cu',
   123         'accountants',
   122         'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'edu', 'ee', 'eg', 'er',
   124         'active',
   123         'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg',
   125         'actor',
   124         'gh', 'gi', 'gl', 'gm', 'gn', 'gov', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk',
   126         'ad',
   125         'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'info', 'int', 'io', 'iq',
   127         'ae',
   126         'ir', 'is', 'it', 'je', 'jm', 'jo', 'jobs', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp',
   128         'aero',
   127         'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly',
   129         'af',
   128         'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mil', 'mk', 'ml', 'mm', 'mn', 'mo', 'mobi', 'mp',
   130         'ag',
   129         'mq', 'mr', 'ms', 'mt', 'mu', 'museum', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'name', 'nc',
   131         'agency',
   130         'ne', 'net', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'org', 'pa', 'pe',
   132         'ai',
   131         'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'pro', 'ps', 'pt', 'pw', 'py', 'qa', 're',
   133         'airforce',
   132         'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl',
   134         'al',
   133         'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc', 'td', 'tel', 'tf', 'tg', 'th',
   135         'allfinanz',
   134         'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'travel', 'tt', 'tv', 'tw', 'tz', 'ua',
   136         'alsace',
   135         'ug', 'uk', 'um', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws',
   137         'am',
   136         'xxx', 'ye', 'yt', 'yu', 'za', 'zm', 'zw'
   138         'an',
       
   139         'android',
       
   140         'ao',
       
   141         'aq',
       
   142         'ar',
       
   143         'archi',
       
   144         'army',
       
   145         'arpa',
       
   146         'as',
       
   147         'asia',
       
   148         'associates',
       
   149         'at',
       
   150         'attorney',
       
   151         'au',
       
   152         'auction',
       
   153         'audio',
       
   154         'autos',
       
   155         'aw',
       
   156         'ax',
       
   157         'axa',
       
   158         'az',
       
   159         'ba',
       
   160         'band',
       
   161         'bar',
       
   162         'bargains',
       
   163         'bayern',
       
   164         'bb',
       
   165         'bd',
       
   166         'be',
       
   167         'beer',
       
   168         'berlin',
       
   169         'best',
       
   170         'bf',
       
   171         'bg',
       
   172         'bh',
       
   173         'bi',
       
   174         'bid',
       
   175         'bike',
       
   176         'bio',
       
   177         'biz',
       
   178         'bj',
       
   179         'black',
       
   180         'blackfriday',
       
   181         'bloomberg',
       
   182         'blue',
       
   183         'bm',
       
   184         'bmw',
       
   185         'bn',
       
   186         'bnpparibas',
       
   187         'bo',
       
   188         'boo',
       
   189         'boutique',
       
   190         'br',
       
   191         'brussels',
       
   192         'bs',
       
   193         'bt',
       
   194         'budapest',
       
   195         'build',
       
   196         'builders',
       
   197         'business',
       
   198         'buzz',
       
   199         'bv',
       
   200         'bw',
       
   201         'by',
       
   202         'bz',
       
   203         'bzh',
       
   204         'ca',
       
   205         'cab',
       
   206         'cal',
       
   207         'camera',
       
   208         'camp',
       
   209         'cancerresearch',
       
   210         'capetown',
       
   211         'capital',
       
   212         'caravan',
       
   213         'cards',
       
   214         'care',
       
   215         'career',
       
   216         'careers',
       
   217         'casa',
       
   218         'cash',
       
   219         'cat',
       
   220         'catering',
       
   221         'cc',
       
   222         'cd',
       
   223         'center',
       
   224         'ceo',
       
   225         'cern',
       
   226         'cf',
       
   227         'cg',
       
   228         'ch',
       
   229         'channel',
       
   230         'cheap',
       
   231         'christmas',
       
   232         'chrome',
       
   233         'church',
       
   234         'ci',
       
   235         'citic',
       
   236         'city',
       
   237         'ck',
       
   238         'cl',
       
   239         'claims',
       
   240         'cleaning',
       
   241         'click',
       
   242         'clinic',
       
   243         'clothing',
       
   244         'club',
       
   245         'cm',
       
   246         'cn',
       
   247         'co',
       
   248         'coach',
       
   249         'codes',
       
   250         'coffee',
       
   251         'college',
       
   252         'cologne',
       
   253         'com',
       
   254         'community',
       
   255         'company',
       
   256         'computer',
       
   257         'condos',
       
   258         'construction',
       
   259         'consulting',
       
   260         'contractors',
       
   261         'cooking',
       
   262         'cool',
       
   263         'coop',
       
   264         'country',
       
   265         'cr',
       
   266         'credit',
       
   267         'creditcard',
       
   268         'cricket',
       
   269         'crs',
       
   270         'cruises',
       
   271         'cu',
       
   272         'cuisinella',
       
   273         'cv',
       
   274         'cw',
       
   275         'cx',
       
   276         'cy',
       
   277         'cymru',
       
   278         'cz',
       
   279         'dad',
       
   280         'dance',
       
   281         'dating',
       
   282         'day',
       
   283         'de',
       
   284         'deals',
       
   285         'degree',
       
   286         'delivery',
       
   287         'democrat',
       
   288         'dental',
       
   289         'dentist',
       
   290         'desi',
       
   291         'diamonds',
       
   292         'diet',
       
   293         'digital',
       
   294         'direct',
       
   295         'directory',
       
   296         'discount',
       
   297         'dj',
       
   298         'dk',
       
   299         'dm',
       
   300         'dnp',
       
   301         'do',
       
   302         'domains',
       
   303         'durban',
       
   304         'dvag',
       
   305         'dz',
       
   306         'eat',
       
   307         'ec',
       
   308         'edu',
       
   309         'education',
       
   310         'ee',
       
   311         'eg',
       
   312         'email',
       
   313         'emerck',
       
   314         'energy',
       
   315         'engineer',
       
   316         'engineering',
       
   317         'enterprises',
       
   318         'equipment',
       
   319         'er',
       
   320         'es',
       
   321         'esq',
       
   322         'estate',
       
   323         'et',
       
   324         'eu',
       
   325         'eus',
       
   326         'events',
       
   327         'everbank',
       
   328         'exchange',
       
   329         'expert',
       
   330         'exposed',
       
   331         'fail',
       
   332         'farm',
       
   333         'feedback',
       
   334         'fi',
       
   335         'finance',
       
   336         'financial',
       
   337         'firmdale',
       
   338         'fish',
       
   339         'fishing',
       
   340         'fitness',
       
   341         'fj',
       
   342         'fk',
       
   343         'flights',
       
   344         'florist',
       
   345         'flsmidth',
       
   346         'fly',
       
   347         'fm',
       
   348         'fo',
       
   349         'foo',
       
   350         'forsale',
       
   351         'foundation',
       
   352         'fr',
       
   353         'frl',
       
   354         'frogans',
       
   355         'fund',
       
   356         'furniture',
       
   357         'futbol',
       
   358         'ga',
       
   359         'gal',
       
   360         'gallery',
       
   361         'gb',
       
   362         'gbiz',
       
   363         'gd',
       
   364         'ge',
       
   365         'gent',
       
   366         'gf',
       
   367         'gg',
       
   368         'gh',
       
   369         'gi',
       
   370         'gift',
       
   371         'gifts',
       
   372         'gives',
       
   373         'gl',
       
   374         'glass',
       
   375         'gle',
       
   376         'global',
       
   377         'globo',
       
   378         'gm',
       
   379         'gmail',
       
   380         'gmo',
       
   381         'gmx',
       
   382         'gn',
       
   383         'google',
       
   384         'gop',
       
   385         'gov',
       
   386         'gp',
       
   387         'gq',
       
   388         'gr',
       
   389         'graphics',
       
   390         'gratis',
       
   391         'green',
       
   392         'gripe',
       
   393         'gs',
       
   394         'gt',
       
   395         'gu',
       
   396         'guide',
       
   397         'guitars',
       
   398         'guru',
       
   399         'gw',
       
   400         'gy',
       
   401         'hamburg',
       
   402         'haus',
       
   403         'healthcare',
       
   404         'help',
       
   405         'here',
       
   406         'hiphop',
       
   407         'hiv',
       
   408         'hk',
       
   409         'hm',
       
   410         'hn',
       
   411         'holdings',
       
   412         'holiday',
       
   413         'homes',
       
   414         'horse',
       
   415         'host',
       
   416         'hosting',
       
   417         'house',
       
   418         'how',
       
   419         'hr',
       
   420         'ht',
       
   421         'hu',
       
   422         'ibm',
       
   423         'id',
       
   424         'ie',
       
   425         'il',
       
   426         'im',
       
   427         'immo',
       
   428         'immobilien',
       
   429         'in',
       
   430         'industries',
       
   431         'info',
       
   432         'ing',
       
   433         'ink',
       
   434         'institute',
       
   435         'insure',
       
   436         'int',
       
   437         'international',
       
   438         'investments',
       
   439         'io',
       
   440         'iq',
       
   441         'ir',
       
   442         'is',
       
   443         'it',
       
   444         'je',
       
   445         'jetzt',
       
   446         'jm',
       
   447         'jo',
       
   448         'jobs',
       
   449         'joburg',
       
   450         'jp',
       
   451         'juegos',
       
   452         'kaufen',
       
   453         'ke',
       
   454         'kg',
       
   455         'kh',
       
   456         'ki',
       
   457         'kim',
       
   458         'kitchen',
       
   459         'kiwi',
       
   460         'km',
       
   461         'kn',
       
   462         'koeln',
       
   463         'kp',
       
   464         'kr',
       
   465         'krd',
       
   466         'kred',
       
   467         'kw',
       
   468         'ky',
       
   469         'kz',
       
   470         'la',
       
   471         'lacaixa',
       
   472         'land',
       
   473         'lawyer',
       
   474         'lb',
       
   475         'lc',
       
   476         'lds',
       
   477         'lease',
       
   478         'legal',
       
   479         'lgbt',
       
   480         'li',
       
   481         'life',
       
   482         'lighting',
       
   483         'limited',
       
   484         'limo',
       
   485         'link',
       
   486         'lk',
       
   487         'loans',
       
   488         'london',
       
   489         'lotto',
       
   490         'lr',
       
   491         'ls',
       
   492         'lt',
       
   493         'ltda',
       
   494         'lu',
       
   495         'luxe',
       
   496         'luxury',
       
   497         'lv',
       
   498         'ly',
       
   499         'ma',
       
   500         'madrid',
       
   501         'maison',
       
   502         'management',
       
   503         'mango',
       
   504         'market',
       
   505         'marketing',
       
   506         'mc',
       
   507         'md',
       
   508         'me',
       
   509         'media',
       
   510         'meet',
       
   511         'melbourne',
       
   512         'meme',
       
   513         'memorial',
       
   514         'menu',
       
   515         'mg',
       
   516         'mh',
       
   517         'miami',
       
   518         'mil',
       
   519         'mini',
       
   520         'mk',
       
   521         'ml',
       
   522         'mm',
       
   523         'mn',
       
   524         'mo',
       
   525         'mobi',
       
   526         'moda',
       
   527         'moe',
       
   528         'monash',
       
   529         'money',
       
   530         'mormon',
       
   531         'mortgage',
       
   532         'moscow',
       
   533         'motorcycles',
       
   534         'mov',
       
   535         'mp',
       
   536         'mq',
       
   537         'mr',
       
   538         'ms',
       
   539         'mt',
       
   540         'mu',
       
   541         'museum',
       
   542         'mv',
       
   543         'mw',
       
   544         'mx',
       
   545         'my',
       
   546         'mz',
       
   547         'na',
       
   548         'nagoya',
       
   549         'name',
       
   550         'navy',
       
   551         'nc',
       
   552         'ne',
       
   553         'net',
       
   554         'network',
       
   555         'neustar',
       
   556         'new',
       
   557         'nexus',
       
   558         'nf',
       
   559         'ng',
       
   560         'ngo',
       
   561         'nhk',
       
   562         'ni',
       
   563         'ninja',
       
   564         'nl',
       
   565         'no',
       
   566         'np',
       
   567         'nr',
       
   568         'nra',
       
   569         'nrw',
       
   570         'nu',
       
   571         'nyc',
       
   572         'nz',
       
   573         'okinawa',
       
   574         'om',
       
   575         'ong',
       
   576         'onl',
       
   577         'ooo',
       
   578         'org',
       
   579         'organic',
       
   580         'otsuka',
       
   581         'ovh',
       
   582         'pa',
       
   583         'paris',
       
   584         'partners',
       
   585         'parts',
       
   586         'party',
       
   587         'pe',
       
   588         'pf',
       
   589         'pg',
       
   590         'ph',
       
   591         'pharmacy',
       
   592         'photo',
       
   593         'photography',
       
   594         'photos',
       
   595         'physio',
       
   596         'pics',
       
   597         'pictures',
       
   598         'pink',
       
   599         'pizza',
       
   600         'pk',
       
   601         'pl',
       
   602         'place',
       
   603         'plumbing',
       
   604         'pm',
       
   605         'pn',
       
   606         'pohl',
       
   607         'poker',
       
   608         'post',
       
   609         'pr',
       
   610         'praxi',
       
   611         'press',
       
   612         'pro',
       
   613         'prod',
       
   614         'productions',
       
   615         'prof',
       
   616         'properties',
       
   617         'property',
       
   618         'ps',
       
   619         'pt',
       
   620         'pub',
       
   621         'pw',
       
   622         'py',
       
   623         'qa',
       
   624         'qpon',
       
   625         'quebec',
       
   626         're',
       
   627         'realtor',
       
   628         'recipes',
       
   629         'red',
       
   630         'rehab',
       
   631         'reise',
       
   632         'reisen',
       
   633         'reit',
       
   634         'ren',
       
   635         'rentals',
       
   636         'repair',
       
   637         'report',
       
   638         'republican',
       
   639         'rest',
       
   640         'restaurant',
       
   641         'reviews',
       
   642         'rich',
       
   643         'rio',
       
   644         'rip',
       
   645         'ro',
       
   646         'rocks',
       
   647         'rodeo',
       
   648         'rs',
       
   649         'rsvp',
       
   650         'ru',
       
   651         'ruhr',
       
   652         'rw',
       
   653         'ryukyu',
       
   654         'sa',
       
   655         'saarland',
       
   656         'sarl',
       
   657         'sb',
       
   658         'sc',
       
   659         'sca',
       
   660         'scb',
       
   661         'schmidt',
       
   662         'schule',
       
   663         'science',
       
   664         'scot',
       
   665         'sd',
       
   666         'se',
       
   667         'services',
       
   668         'sexy',
       
   669         'sg',
       
   670         'sh',
       
   671         'shiksha',
       
   672         'shoes',
       
   673         'si',
       
   674         'singles',
       
   675         'sj',
       
   676         'sk',
       
   677         'sl',
       
   678         'sm',
       
   679         'sn',
       
   680         'so',
       
   681         'social',
       
   682         'software',
       
   683         'sohu',
       
   684         'solar',
       
   685         'solutions',
       
   686         'soy',
       
   687         'space',
       
   688         'spiegel',
       
   689         'sr',
       
   690         'st',
       
   691         'su',
       
   692         'supplies',
       
   693         'supply',
       
   694         'support',
       
   695         'surf',
       
   696         'surgery',
       
   697         'suzuki',
       
   698         'sv',
       
   699         'sx',
       
   700         'sy',
       
   701         'sydney',
       
   702         'systems',
       
   703         'sz',
       
   704         'taipei',
       
   705         'tatar',
       
   706         'tattoo',
       
   707         'tax',
       
   708         'tc',
       
   709         'td',
       
   710         'technology',
       
   711         'tel',
       
   712         'tf',
       
   713         'tg',
       
   714         'th',
       
   715         'tienda',
       
   716         'tips',
       
   717         'tirol',
       
   718         'tj',
       
   719         'tk',
       
   720         'tl',
       
   721         'tm',
       
   722         'tn',
       
   723         'to',
       
   724         'today',
       
   725         'tokyo',
       
   726         'tools',
       
   727         'top',
       
   728         'town',
       
   729         'toys',
       
   730         'tp',
       
   731         'tr',
       
   732         'trade',
       
   733         'training',
       
   734         'travel',
       
   735         'tt',
       
   736         'tui',
       
   737         'tv',
       
   738         'tw',
       
   739         'tz',
       
   740         'ua',
       
   741         'ug',
       
   742         'uk',
       
   743         'university',
       
   744         'uno',
       
   745         'uol',
       
   746         'us',
       
   747         'uy',
       
   748         'uz',
       
   749         'va',
       
   750         'vacations',
       
   751         'vc',
       
   752         've',
       
   753         'vegas',
       
   754         'ventures',
       
   755         'versicherung',
       
   756         'vet',
       
   757         'vg',
       
   758         'vi',
       
   759         'viajes',
       
   760         'villas',
       
   761         'vision',
       
   762         'vlaanderen',
       
   763         'vn',
       
   764         'vodka',
       
   765         'vote',
       
   766         'voting',
       
   767         'voto',
       
   768         'voyage',
       
   769         'vu',
       
   770         'wales',
       
   771         'wang',
       
   772         'watch',
       
   773         'webcam',
       
   774         'website',
       
   775         'wed',
       
   776         'wedding',
       
   777         'wf',
       
   778         'whoswho',
       
   779         'wien',
       
   780         'wiki',
       
   781         'williamhill',
       
   782         'wme',
       
   783         'work',
       
   784         'works',
       
   785         'world',
       
   786         'ws',
       
   787         'wtc',
       
   788         'wtf',
       
   789         'xn--1qqw23a',
       
   790         'xn--3bst00m',
       
   791         'xn--3ds443g',
       
   792         'xn--3e0b707e',
       
   793         'xn--45brj9c',
       
   794         'xn--45q11c',
       
   795         'xn--4gbrim',
       
   796         'xn--55qw42g',
       
   797         'xn--55qx5d',
       
   798         'xn--6frz82g',
       
   799         'xn--6qq986b3xl',
       
   800         'xn--80adxhks',
       
   801         'xn--80ao21a',
       
   802         'xn--80asehdb',
       
   803         'xn--80aswg',
       
   804         'xn--90a3ac',
       
   805         'xn--c1avg',
       
   806         'xn--cg4bki',
       
   807         'xn--clchc0ea0b2g2a9gcd',
       
   808         'xn--czr694b',
       
   809         'xn--czru2d',
       
   810         'xn--d1acj3b',
       
   811         'xn--d1alf',
       
   812         'xn--fiq228c5hs',
       
   813         'xn--fiq64b',
       
   814         'xn--fiqs8s',
       
   815         'xn--fiqz9s',
       
   816         'xn--flw351e',
       
   817         'xn--fpcrj9c3d',
       
   818         'xn--fzc2c9e2c',
       
   819         'xn--gecrj9c',
       
   820         'xn--h2brj9c',
       
   821         'xn--i1b6b1a6a2e',
       
   822         'xn--io0a7i',
       
   823         'xn--j1amh',
       
   824         'xn--j6w193g',
       
   825         'xn--kprw13d',
       
   826         'xn--kpry57d',
       
   827         'xn--kput3i',
       
   828         'xn--l1acc',
       
   829         'xn--lgbbat1ad8j',
       
   830         'xn--mgb9awbf',
       
   831         'xn--mgba3a4f16a',
       
   832         'xn--mgbaam7a8h',
       
   833         'xn--mgbab2bd',
       
   834         'xn--mgbayh7gpa',
       
   835         'xn--mgbbh1a71e',
       
   836         'xn--mgbc0a9azcg',
       
   837         'xn--mgberp4a5d4ar',
       
   838         'xn--mgbx4cd0ab',
       
   839         'xn--ngbc5azd',
       
   840         'xn--node',
       
   841         'xn--nqv7f',
       
   842         'xn--nqv7fs00ema',
       
   843         'xn--o3cw4h',
       
   844         'xn--ogbpf8fl',
       
   845         'xn--p1acf',
       
   846         'xn--p1ai',
       
   847         'xn--pgbs0dh',
       
   848         'xn--q9jyb4c',
       
   849         'xn--qcka1pmc',
       
   850         'xn--rhqv96g',
       
   851         'xn--s9brj9c',
       
   852         'xn--ses554g',
       
   853         'xn--unup4y',
       
   854         'xn--vermgensberater-ctb',
       
   855         'xn--vermgensberatung-pwb',
       
   856         'xn--vhquv',
       
   857         'xn--wgbh1c',
       
   858         'xn--wgbl6a',
       
   859         'xn--xhq521b',
       
   860         'xn--xkc2al3hye2a',
       
   861         'xn--xkc2dl3a5ee0h',
       
   862         'xn--yfro4i67o',
       
   863         'xn--ygbi2ammx',
       
   864         'xn--zfr164b',
       
   865         'xxx',
       
   866         'xyz',
       
   867         'yachts',
       
   868         'yandex',
       
   869         'ye',
       
   870         'yoga',
       
   871         'yokohama',
       
   872         'youtube',
       
   873         'yt',
       
   874         'za',
       
   875         'zip',
       
   876         'zm',
       
   877         'zone',
       
   878         'zw',
       
   879         '测试',
       
   880         'परीक्षा',
       
   881         '佛山',
       
   882         '集团',
       
   883         '在线',
       
   884         '한국',
       
   885         'ভারত',
       
   886         '八卦',
       
   887         'موقع',
       
   888         'বাংলা',
       
   889         '公益',
       
   890         '公司',
       
   891         '移动',
       
   892         '我爱你',
       
   893         'москва',
       
   894         'испытание',
       
   895         'қаз',
       
   896         'онлайн',
       
   897         'сайт',
       
   898         'срб',
       
   899         'бел',
       
   900         '테스트',
       
   901         'орг',
       
   902         '삼성',
       
   903         'சிங்கப்பூர்',
       
   904         '商标',
       
   905         '商城',
       
   906         'дети',
       
   907         'мкд',
       
   908         'טעסט',
       
   909         '中文网',
       
   910         '中信',
       
   911         '中国',
       
   912         '中國',
       
   913         '谷歌',
       
   914         'భారత్',
       
   915         'ලංකා',
       
   916         '測試',
       
   917         'ભારત',
       
   918         'भारत',
       
   919         'آزمایشی',
       
   920         'பரிட்சை',
       
   921         'संगठन',
       
   922         '网络',
       
   923         'укр',
       
   924         '香港',
       
   925         'δοκιμή',
       
   926         'إختبار',
       
   927         '台湾',
       
   928         '台灣',
       
   929         '手机',
       
   930         'мон',
       
   931         'الجزائر',
       
   932         'عمان',
       
   933         'ایران',
       
   934         'امارات',
       
   935         'بازار',
       
   936         'پاکستان',
       
   937         'الاردن',
       
   938         'بھارت',
       
   939         'المغرب',
       
   940         'السعودية',
       
   941         'سودان',
       
   942         'عراق',
       
   943         'مليسيا',
       
   944         'شبكة',
       
   945         'გე',
       
   946         '机构',
       
   947         '组织机构',
       
   948         'ไทย',
       
   949         'سورية',
       
   950         'рус',
       
   951         'рф',
       
   952         'تونس',
       
   953         'みんな',
       
   954         'グーグル',
       
   955         '世界',
       
   956         'ਭਾਰਤ',
       
   957         '网址',
       
   958         '游戏',
       
   959         'vermögensberater',
       
   960         'vermögensberatung',
       
   961         '企业',
       
   962         'مصر',
       
   963         'قطر',
       
   964         '广东',
       
   965         'இலங்கை',
       
   966         'இந்தியா',
       
   967         'հայ',
       
   968         '新加坡',
       
   969         'فلسطين',
       
   970         'テスト',
       
   971         '政务',
   137     );
   972     );
   138 
   973 
   139     /**
   974     /**
   140      * @var string
   975      * @var string
   141      */
   976      */
   149      * (.AS) American Samoa http://www.nic.as/idn/chars.cfm
   984      * (.AS) American Samoa http://www.nic.as/idn/chars.cfm
   150      * (.AT) Austria http://www.nic.at/en/service/technical_information/idn/charset_converter/
   985      * (.AT) Austria http://www.nic.at/en/service/technical_information/idn/charset_converter/
   151      * (.BIZ) International http://www.iana.org/domains/idn-tables/
   986      * (.BIZ) International http://www.iana.org/domains/idn-tables/
   152      * (.BR) Brazil http://registro.br/faq/faq6.html
   987      * (.BR) Brazil http://registro.br/faq/faq6.html
   153      * (.BV) Bouvett Island http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html
   988      * (.BV) Bouvett Island http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html
       
   989      * (.CA) Canada http://www.iana.org/domains/idn-tables/tables/ca_fr_1.0.html
   154      * (.CAT) Catalan http://www.iana.org/domains/idn-tables/tables/cat_ca_1.0.html
   990      * (.CAT) Catalan http://www.iana.org/domains/idn-tables/tables/cat_ca_1.0.html
   155      * (.CH) Switzerland https://nic.switch.ch/reg/ocView.action?res=EF6GW2JBPVTG67DLNIQXU234MN6SC33JNQQGI7L6#anhang1
   991      * (.CH) Switzerland https://nic.switch.ch/reg/ocView.action?res=EF6GW2JBPVTG67DLNIQXU234MN6SC33JNQQGI7L6#anhang1
   156      * (.CL) Chile http://www.iana.org/domains/idn-tables/tables/cl_latn_1.0.html
   992      * (.CL) Chile http://www.iana.org/domains/idn-tables/tables/cl_latn_1.0.html
   157      * (.COM) International http://www.verisign.com/information-services/naming-services/internationalized-domain-names/index.html
   993      * (.COM) International http://www.verisign.com/information-services/naming-services/internationalized-domain-names/index.html
   158      * (.DE) Germany http://www.denic.de/en/domains/idns/liste.html
   994      * (.DE) Germany http://www.denic.de/en/domains/idns/liste.html
   177      * (.PE) Peru https://www.nic.pe/nuevas_politicas_faq_2.php
  1013      * (.PE) Peru https://www.nic.pe/nuevas_politicas_faq_2.php
   178      * (.PL) Poland http://www.dns.pl/IDN/allowed_character_sets.pdf
  1014      * (.PL) Poland http://www.dns.pl/IDN/allowed_character_sets.pdf
   179      * (.PR) Puerto Rico http://www.nic.pr/idn_rules.asp
  1015      * (.PR) Puerto Rico http://www.nic.pr/idn_rules.asp
   180      * (.PT) Portugal https://online.dns.pt/dns_2008/do?com=DS;8216320233;111;+PAGE(4000058)+K-CAT-CODIGO(C.125)+RCNT(100);
  1016      * (.PT) Portugal https://online.dns.pt/dns_2008/do?com=DS;8216320233;111;+PAGE(4000058)+K-CAT-CODIGO(C.125)+RCNT(100);
   181      * (.RU) Russia http://www.iana.org/domains/idn-tables/tables/ru_ru-ru_1.0.html
  1017      * (.RU) Russia http://www.iana.org/domains/idn-tables/tables/ru_ru-ru_1.0.html
       
  1018      * (.RS) Serbia http://www.iana.org/domains/idn-tables/tables/rs_sr-rs_1.0.pdf
   182      * (.SA) Saudi Arabia http://www.iana.org/domains/idn-tables/tables/sa_ar_1.0.html
  1019      * (.SA) Saudi Arabia http://www.iana.org/domains/idn-tables/tables/sa_ar_1.0.html
   183      * (.SE) Sweden http://www.iis.se/english/IDN_campaignsite.shtml?lang=en
  1020      * (.SE) Sweden http://www.iis.se/english/IDN_campaignsite.shtml?lang=en
   184      * (.SH) Saint Helena http://www.nic.sh/SH-IDN-Policy.pdf
  1021      * (.SH) Saint Helena http://www.nic.sh/SH-IDN-Policy.pdf
   185      * (.SJ) Svalbard and Jan Mayen http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html
  1022      * (.SJ) Svalbard and Jan Mayen http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html
   186      * (.TH) Thailand http://www.iana.org/domains/idn-tables/tables/th_th-th_1.0.html
  1023      * (.TH) Thailand http://www.iana.org/domains/idn-tables/tables/th_th-th_1.0.html
   187      * (.TM) Turkmenistan http://www.nic.tm/TM-IDN-Policy.pdf
  1024      * (.TM) Turkmenistan http://www.nic.tm/TM-IDN-Policy.pdf
   188      * (.TR) Turkey https://www.nic.tr/index.php
  1025      * (.TR) Turkey https://www.nic.tr/index.php
       
  1026      * (.UA) Ukraine http://www.iana.org/domains/idn-tables/tables/ua_cyrl_1.2.html
   189      * (.VE) Venice http://www.iana.org/domains/idn-tables/tables/ve_es_1.0.html
  1027      * (.VE) Venice http://www.iana.org/domains/idn-tables/tables/ve_es_1.0.html
   190      * (.VN) Vietnam http://www.vnnic.vn/english/5-6-300-2-2-04-20071115.htm#1.%20Introduction
  1028      * (.VN) Vietnam http://www.vnnic.vn/english/5-6-300-2-2-04-20071115.htm#1.%20Introduction
   191      *
  1029      *
   192      * @var array
  1030      * @var array
   193      */
  1031      */
   197         'AS'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĸĺļľłńņňŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźż]{1,63}$/iu'),
  1035         'AS'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĸĺļľłńņňŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźż]{1,63}$/iu'),
   198         'AT'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿœšž]{1,63}$/iu'),
  1036         'AT'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿœšž]{1,63}$/iu'),
   199         'BIZ' => 'Hostname/Biz.php',
  1037         'BIZ' => 'Hostname/Biz.php',
   200         'BR'  => array(1 => '/^[\x{002d}0-9a-zà-ãçéíó-õúü]{1,63}$/iu'),
  1038         'BR'  => array(1 => '/^[\x{002d}0-9a-zà-ãçéíó-õúü]{1,63}$/iu'),
   201         'BV'  => array(1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'),
  1039         'BV'  => array(1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'),
       
  1040         'CA'  => array(1 => '/^[\x{002d}0-9a-zàâæçéèêëîïôœùûüÿ\x{00E0}\x{00E2}\x{00E7}\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{00EE}\x{00EF}\x{00F4}\x{00F9}\x{00FB}\x{00FC}\x{00E6}\x{0153}\x{00FF}]{1,63}$/iu'),
   202         'CAT' => array(1 => '/^[\x{002d}0-9a-z·àç-éíïòóúü]{1,63}$/iu'),
  1041         'CAT' => array(1 => '/^[\x{002d}0-9a-z·àç-éíïòóúü]{1,63}$/iu'),
   203         'CH'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿœ]{1,63}$/iu'),
  1042         'CH'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿœ]{1,63}$/iu'),
   204         'CL'  => array(1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu'),
  1043         'CL'  => array(1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu'),
   205         'CN'  => 'Hostname/Cn.php',
  1044         'CN'  => 'Hostname/Cn.php',
   206         'COM' => 'Zend/Validate/Hostname/Com.php',
  1045         'COM' => 'Hostname/Com.php',
   207         'DE'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'),
  1046         'DE'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'),
   208         'DK'  => array(1 => '/^[\x{002d}0-9a-zäéöüæøå]{1,63}$/iu'),
  1047         'DK'  => array(1 => '/^[\x{002d}0-9a-zäéöüæøå]{1,63}$/iu'),
   209         'ES'  => array(1 => '/^[\x{002d}0-9a-zàáçèéíïñòóúü·]{1,63}$/iu'),
  1048         'ES'  => array(1 => '/^[\x{002d}0-9a-zàáçèéíïñòóúü·]{1,63}$/iu'),
   210         'EU'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu',
  1049         'EU'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu',
   211             2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu',
  1050             2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu',
   212             3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu',
  1051             3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu',
   213             4 => '/^[\x{002d}0-9a-zΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ]{1,63}$/iu',
  1052             4 => '/^[\x{002d}0-9a-zΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ]{1,63}$/iu',
   214             5 => '/^[\x{002d}0-9a-zабвгдежзийклмнопрстуфхцчшщъыьэюя]{1,63}$/iu',
  1053             5 => '/^[\x{002d}0-9a-zабвгдежзийклмнопрстуфхцчшщъыьэюя]{1,63}$/iu',
   215             6 => '/^[\x{002d}0-9a-zἀ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷῂῃῄῆῇῐ-ΐῖῗῠ-ῧῲῳῴῶῷ]{1,63}$/iu'),
  1054             6 => '/^[\x{002d}0-9a-zἀ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ὼώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷῂῃῄῆῇῐ-ῒΐῖῗῠ-ῧῲῳῴῶῷ]{1,63}$/iu'),
   216         'FI'  => array(1 => '/^[\x{002d}0-9a-zäåö]{1,63}$/iu'),
  1055         'FI'  => array(1 => '/^[\x{002d}0-9a-zäåö]{1,63}$/iu'),
   217         'GR'  => array(1 => '/^[\x{002d}0-9a-zΆΈΉΊΌΎ-ΡΣ-ώἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼῂῃῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲῳῴῶ-ῼ]{1,63}$/iu'),
  1056         'GR'  => array(1 => '/^[\x{002d}0-9a-zΆΈΉΊΌΎ-ΡΣ-ώἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼῂῃῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲῳῴῶ-ῼ]{1,63}$/iu'),
   218         'HK'  => 'Zend/Validate/Hostname/Cn.php',
  1057         'HK'  => 'Hostname/Cn.php',
   219         'HU'  => array(1 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu'),
  1058         'HU'  => array(1 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu'),
       
  1059         'IL'  => array(1 => '/^[\x{002d}0-9\x{05D0}-\x{05EA}]{1,63}$/iu',
       
  1060             2 => '/^[\x{002d}0-9a-z]{1,63}$/i'),
   220         'INFO'=> array(1 => '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu',
  1061         'INFO'=> array(1 => '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu',
   221             2 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu',
  1062             2 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu',
   222             3 => '/^[\x{002d}0-9a-záæéíðóöúýþ]{1,63}$/iu',
  1063             3 => '/^[\x{002d}0-9a-záæéíðóöúýþ]{1,63}$/iu',
   223             4 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu',
  1064             4 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu',
   224             5 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu',
  1065             5 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu',
   225             6 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu',
  1066             6 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu',
   226             7 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu',
  1067             7 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu',
   227             8 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu'),
  1068             8 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu'),
   228         'IO'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'),
  1069         'IO'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'),
   229         'IS'  => array(1 => '/^[\x{002d}0-9a-záéýúíóþæöð]{1,63}$/iu'),
  1070         'IS'  => array(1 => '/^[\x{002d}0-9a-záéýúíóþæöð]{1,63}$/iu'),
   230         'JP'  => 'Zend/Validate/Hostname/Jp.php',
  1071         'IT'  => array(1 => '/^[\x{002d}0-9a-zàâäèéêëìîïòôöùûüæœçÿß-]{1,63}$/iu'),
       
  1072         'JP'  => 'Hostname/Jp.php',
   231         'KR'  => array(1 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu'),
  1073         'KR'  => array(1 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu'),
   232         'LI'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿœ]{1,63}$/iu'),
  1074         'LI'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿœ]{1,63}$/iu'),
   233         'LT'  => array(1 => '/^[\x{002d}0-9ąčęėįšųūž]{1,63}$/iu'),
  1075         'LT'  => array(1 => '/^[\x{002d}0-9ąčęėįšųūž]{1,63}$/iu'),
   234         'MD'  => array(1 => '/^[\x{002d}0-9ăâîşţ]{1,63}$/iu'),
  1076         'MD'  => array(1 => '/^[\x{002d}0-9ăâîşţ]{1,63}$/iu'),
   235         'MUSEUM' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćċčďđēėęěğġģħīįıķĺļľłńņňŋōőœŕŗřśşšţťŧūůűųŵŷźżžǎǐǒǔ\x{01E5}\x{01E7}\x{01E9}\x{01EF}ə\x{0292}ẁẃẅỳ]{1,63}$/iu'),
  1077         'MUSEUM' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćċčďđēėęěğġģħīįıķĺļľłńņňŋōőœŕŗřśşšţťŧūůűųŵŷźżžǎǐǒǔ\x{01E5}\x{01E7}\x{01E9}\x{01EF}ə\x{0292}ẁẃẅỳ]{1,63}$/iu'),
   236         'NET' => 'Zend/Validate/Hostname/Com.php',
  1078         'NET' => 'Hostname/Com.php',
   237         'NO'  => array(1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'),
  1079         'NO'  => array(1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'),
   238         'NU'  => 'Zend/Validate/Hostname/Com.php',
  1080         'NU'  => 'Hostname/Com.php',
   239         'ORG' => array(1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu',
  1081         'ORG' => array(1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu',
   240             2 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu',
  1082             2 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu',
   241             3 => '/^[\x{002d}0-9a-záäåæéëíðóöøúüýþ]{1,63}$/iu',
  1083             3 => '/^[\x{002d}0-9a-záäåæéëíðóöøúüýþ]{1,63}$/iu',
   242             4 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu',
  1084             4 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu',
   243             5 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu',
  1085             5 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu',
   277             31=> '/^[\x{002d}0-9a-zàâæçèéêëîïñôùûüÿœ]{1,63}$/iu',
  1119             31=> '/^[\x{002d}0-9a-zàâæçèéêëîïñôùûüÿœ]{1,63}$/iu',
   278             32=> '/^[\x{002d}0-9а-щъыьэюяёєіїґ]{1,63}$/iu',
  1120             32=> '/^[\x{002d}0-9а-щъыьэюяёєіїґ]{1,63}$/iu',
   279             33=> '/^[\x{002d}0-9א-ת]{1,63}$/iu'),
  1121             33=> '/^[\x{002d}0-9א-ת]{1,63}$/iu'),
   280         'PR'  => array(1 => '/^[\x{002d}0-9a-záéíóúñäëïüöâêîôûàèùæçœãõ]{1,63}$/iu'),
  1122         'PR'  => array(1 => '/^[\x{002d}0-9a-záéíóúñäëïüöâêîôûàèùæçœãõ]{1,63}$/iu'),
   281         'PT'  => array(1 => '/^[\x{002d}0-9a-záàâãçéêíóôõú]{1,63}$/iu'),
  1123         'PT'  => array(1 => '/^[\x{002d}0-9a-záàâãçéêíóôõú]{1,63}$/iu'),
       
  1124         'RS'  => array(1 => '/^[\x{002D}\x{0030}-\x{0039}\x{0061}-\x{007A}\x{0107}\x{010D}\x{0111}\x{0161}\x{017E}]{1,63}$/iu)'),
   282         'RU'  => array(1 => '/^[\x{002d}0-9а-яё]{1,63}$/iu'),
  1125         'RU'  => array(1 => '/^[\x{002d}0-9а-яё]{1,63}$/iu'),
   283         'SA'  => array(1 => '/^[\x{002d}.0-9\x{0621}-\x{063A}\x{0641}-\x{064A}\x{0660}-\x{0669}]{1,63}$/iu'),
  1126         'SA'  => array(1 => '/^[\x{002d}.0-9\x{0621}-\x{063A}\x{0641}-\x{064A}\x{0660}-\x{0669}]{1,63}$/iu'),
   284         'SE'  => array(1 => '/^[\x{002d}0-9a-zäåéöü]{1,63}$/iu'),
  1127         'SE'  => array(1 => '/^[\x{002d}0-9a-zäåéöü]{1,63}$/iu'),
   285         'SH'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'),
  1128         'SH'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'),
   286         'SI'  => array(
  1129         'SI'  => array(
   288             2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu',
  1131             2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu',
   289             3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu'),
  1132             3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu'),
   290         'SJ'  => array(1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'),
  1133         'SJ'  => array(1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'),
   291         'TH'  => array(1 => '/^[\x{002d}0-9a-z\x{0E01}-\x{0E3A}\x{0E40}-\x{0E4D}\x{0E50}-\x{0E59}]{1,63}$/iu'),
  1134         'TH'  => array(1 => '/^[\x{002d}0-9a-z\x{0E01}-\x{0E3A}\x{0E40}-\x{0E4D}\x{0E50}-\x{0E59}]{1,63}$/iu'),
   292         'TM'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēėęěĝġģĥħīįĵķĺļľŀłńņňŋőœŕŗřśŝşšţťŧūŭůűųŵŷźżž]{1,63}$/iu'),
  1135         'TM'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēėęěĝġģĥħīįĵķĺļľŀłńņňŋőœŕŗřśŝşšţťŧūŭůűųŵŷźżž]{1,63}$/iu'),
   293         'TW'  => 'Zend/Validate/Hostname/Cn.php',
  1136         'TW'  => 'Hostname/Cn.php',
   294         'TR'  => array(1 => '/^[\x{002d}0-9a-zğıüşöç]{1,63}$/iu'),
  1137         'TR'  => array(1 => '/^[\x{002d}0-9a-zğıüşöç]{1,63}$/iu'),
       
  1138         'UA'  => array(1 => '/^[\x{002d}0-9a-zабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓєѕіїјљњћќѝўџґӂʼ]{1,63}$/iu'),
   295         'VE'  => array(1 => '/^[\x{002d}0-9a-záéíóúüñ]{1,63}$/iu'),
  1139         'VE'  => array(1 => '/^[\x{002d}0-9a-záéíóúüñ]{1,63}$/iu'),
   296         'VN'  => array(1 => '/^[ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚÝàáâãèéêìíòóôõùúýĂăĐđĨĩŨũƠơƯư\x{1EA0}-\x{1EF9}]{1,63}$/iu'),
  1140         'VN'  => array(1 => '/^[ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚÝàáâãèéêìíòóôõùúýĂăĐđĨĩŨũƠơƯư\x{1EA0}-\x{1EF9}]{1,63}$/iu'),
   297         'ایران' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'),
  1141         'мон' => array(1 => '/^[\x{002d}0-9\x{0430}-\x{044F}]{1,63}$/iu'),
   298         '中国' => 'Zend/Validate/Hostname/Cn.php',
  1142         'срб' => array(1 => '/^[\x{002d}0-9а-ик-шђјљњћџ]{1,63}$/iu'),
   299         '公司' => 'Zend/Validate/Hostname/Cn.php',
  1143         'сайт' => array(1 => '/^[\x{002d}0-9а-яёіїѝйўґг]{1,63}$/iu'),
   300         '网络' => 'Zend/Validate/Hostname/Cn.php'
  1144         'онлайн' => array(1 => '/^[\x{002d}0-9а-яёіїѝйўґг]{1,63}$/iu'),
       
  1145         '中国' => 'Hostname/Cn.php',
       
  1146         '中國' => 'Hostname/Cn.php',
       
  1147         'ලංකා' => array(1 => '/^[\x{0d80}-\x{0dff}]{1,63}$/iu'),
       
  1148         '香港' => 'Hostname/Cn.php',
       
  1149         '台湾' => 'Hostname/Cn.php',
       
  1150         '台灣' => 'Hostname/Cn.php',
       
  1151         'امارات'   => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'),
       
  1152         'الاردن'    => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'),
       
  1153         'السعودية' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'),
       
  1154         'ไทย' => array(1 => '/^[\x{002d}0-9a-z\x{0E01}-\x{0E3A}\x{0E40}-\x{0E4D}\x{0E50}-\x{0E59}]{1,63}$/iu'),
       
  1155         'рф' => array(1 => '/^[\x{002d}0-9а-яё]{1,63}$/iu'),
       
  1156         'تونس' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'),
       
  1157         'مصر' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'),
       
  1158         'இலங்கை' => array(1 => '/^[\x{0b80}-\x{0bff}]{1,63}$/iu'),
       
  1159         'فلسطين' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'),
       
  1160         'شبكة'  => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'),
   301     );
  1161     );
   302 
  1162 
   303     protected $_idnLength = array(
  1163     protected $_idnLength = array(
   304         'BIZ' => array(5 => 17, 11 => 15, 12 => 20),
  1164         'BIZ' => array(5 => 17, 11 => 15, 12 => 20),
   305         'CN'  => array(1 => 20),
  1165         'CN'  => array(1 => 20),
   324     );
  1184     );
   325 
  1185 
   326     /**
  1186     /**
   327      * Sets validator options
  1187      * Sets validator options
   328      *
  1188      *
   329      * @param integer          $allow       OPTIONAL Set what types of hostname to allow (default ALLOW_DNS)
       
   330      * @param boolean          $validateIdn OPTIONAL Set whether IDN domains are validated (default true)
       
   331      * @param boolean          $validateTld OPTIONAL Set whether the TLD element of a hostname is validated (default true)
       
   332      * @param Zend_Validate_Ip $ipValidator OPTIONAL
       
   333      * @return void
       
   334      * @see http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm  Technical Specifications for ccTLDs
  1189      * @see http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm  Technical Specifications for ccTLDs
       
  1190      * @param array $options Validator options
   335      */
  1191      */
   336     public function __construct($options = array())
  1192     public function __construct($options = array())
   337     {
  1193     {
   338         if ($options instanceof Zend_Config) {
  1194         if ($options instanceof Zend_Config) {
   339             $options = $options->toArray();
  1195             $options = $options->toArray();
   406         return $this->_options['ip'];
  1262         return $this->_options['ip'];
   407     }
  1263     }
   408 
  1264 
   409     /**
  1265     /**
   410      * @param Zend_Validate_Ip $ipValidator OPTIONAL
  1266      * @param Zend_Validate_Ip $ipValidator OPTIONAL
   411      * @return void;
  1267      * @return Zend_Validate_Hostname
   412      */
  1268      */
   413     public function setIpValidator(Zend_Validate_Ip $ipValidator = null)
  1269     public function setIpValidator(Zend_Validate_Ip $ipValidator = null)
   414     {
  1270     {
   415         if ($ipValidator === null) {
  1271         if ($ipValidator === null) {
   416             $ipValidator = new Zend_Validate_Ip();
  1272             $ipValidator = new Zend_Validate_Ip();
   456      * Set whether IDN domains are validated
  1312      * Set whether IDN domains are validated
   457      *
  1313      *
   458      * This only applies when DNS hostnames are validated
  1314      * This only applies when DNS hostnames are validated
   459      *
  1315      *
   460      * @param boolean $allowed Set allowed to true to validate IDNs, and false to not validate them
  1316      * @param boolean $allowed Set allowed to true to validate IDNs, and false to not validate them
       
  1317      * @return $this
   461      */
  1318      */
   462     public function setValidateIdn ($allowed)
  1319     public function setValidateIdn ($allowed)
   463     {
  1320     {
   464         $this->_options['idn'] = (bool) $allowed;
  1321         $this->_options['idn'] = (bool) $allowed;
   465         return $this;
  1322         return $this;
   479      * Set whether the TLD element of a hostname is validated
  1336      * Set whether the TLD element of a hostname is validated
   480      *
  1337      *
   481      * This only applies when DNS hostnames are validated
  1338      * This only applies when DNS hostnames are validated
   482      *
  1339      *
   483      * @param boolean $allowed Set allowed to true to validate TLDs, and false to not validate them
  1340      * @param boolean $allowed Set allowed to true to validate TLDs, and false to not validate them
       
  1341      * @return $this
   484      */
  1342      */
   485     public function setValidateTld ($allowed)
  1343     public function setValidateTld ($allowed)
   486     {
  1344     {
   487         $this->_options['tld'] = (bool) $allowed;
  1345         $this->_options['tld'] = (bool) $allowed;
   488         return $this;
  1346         return $this;
   515                 return true;
  1373                 return true;
   516             }
  1374             }
   517         }
  1375         }
   518 
  1376 
   519         // RFC3986 3.2.2 states:
  1377         // RFC3986 3.2.2 states:
   520         // 
  1378         //
   521         //     The rightmost domain label of a fully qualified domain name
  1379         //     The rightmost domain label of a fully qualified domain name
   522         //     in DNS may be followed by a single "." and should be if it is 
  1380         //     in DNS may be followed by a single "." and should be if it is
   523         //     necessary to distinguish between the complete domain name and
  1381         //     necessary to distinguish between the complete domain name and
   524         //     some local domain.
  1382         //     some local domain.
   525         //     
  1383         //
   526         // (see ZF-6363)
  1384         // (see ZF-6363)
   527         
  1385 
   528         // Local hostnames are allowed to be partitial (ending '.')
  1386         // Local hostnames are allowed to be partitial (ending '.')
   529         if ($this->_options['allow'] & self::ALLOW_LOCAL) {
  1387         if ($this->_options['allow'] & self::ALLOW_LOCAL) {
   530             if (substr($value, -1) === '.') {
  1388             if (substr($value, -1) === '.') {
   531                 $value = substr($value, 0, -1);
  1389                 $value = substr($value, 0, -1);
   532                 if (substr($value, -1) === '.') {
  1390                 if (substr($value, -1) === '.') {
   547 
  1405 
   548         // Check input against DNS hostname schema
  1406         // Check input against DNS hostname schema
   549         if ((count($domainParts) > 1) && (strlen($value) >= 4) && (strlen($value) <= 254)) {
  1407         if ((count($domainParts) > 1) && (strlen($value) >= 4) && (strlen($value) <= 254)) {
   550             $status = false;
  1408             $status = false;
   551 
  1409 
   552             $origenc = iconv_get_encoding('internal_encoding');
  1410             $origenc = PHP_VERSION_ID < 50600
   553             iconv_set_encoding('internal_encoding', 'UTF-8');
  1411                         ? iconv_get_encoding('internal_encoding')
       
  1412                         : ini_get('default_charset');
       
  1413             if (PHP_VERSION_ID < 50600) {
       
  1414                 iconv_set_encoding('internal_encoding', 'UTF-8');
       
  1415             } else {
       
  1416                 ini_set('default_charset', 'UTF-8');
       
  1417             }
   554             do {
  1418             do {
   555                 // First check TLD
  1419                 // First check TLD
   556                 $matches = array();
  1420                 $matches = array();
   557                 if (preg_match('/([^.]{2,10})$/i', end($domainParts), $matches) ||
  1421                 if (preg_match('/([^.]{2,63})$/iu', end($domainParts), $matches)
   558                     (end($domainParts) == 'ایران') || (end($domainParts) == '中国') ||
  1422                     || (array_key_exists(end($domainParts), $this->_validIdns))) {
   559                     (end($domainParts) == '公司') || (end($domainParts) == '网络')) {
       
   560 
       
   561                     reset($domainParts);
  1423                     reset($domainParts);
   562 
  1424 
   563                     // Hostname characters are: *(label dot)(label dot label); max 254 chars
  1425                     // Hostname characters are: *(label dot)(label dot label); max 254 chars
   564                     // label: id-prefix [*ldh{61} id-prefix]; max 63 chars
  1426                     // label: id-prefix [*ldh{61} id-prefix]; max 63 chars
   565                     // id-prefix: alpha / digit
  1427                     // id-prefix: alpha / digit
   566                     // ldh: alpha / digit / dash
  1428                     // ldh: alpha / digit / dash
   567 
  1429 
   568                     // Match TLD against known list
  1430                     // Match TLD against known list
   569                     $this->_tld = strtolower($matches[1]);
  1431                     $this->_tld = $matches[1];
   570                     if ($this->_options['tld']) {
  1432                     if ($this->_options['tld']) {
   571                         if (!in_array($this->_tld, $this->_validTlds)) {
  1433                         if (!in_array(strtolower($this->_tld), $this->_validTlds)
       
  1434                             && !in_array($this->_tld, $this->_validTlds)) {
   572                             $this->_error(self::UNKNOWN_TLD);
  1435                             $this->_error(self::UNKNOWN_TLD);
   573                             $status = false;
  1436                             $status = false;
   574                             break;
  1437                             break;
   575                         }
  1438                         }
       
  1439                         // We have already validated that the TLD is fine. We don't want it to go through the below
       
  1440                         // checks as new UTF-8 TLDs will incorrectly fail if there is no IDN regex for it.
       
  1441                         array_pop($domainParts);
   576                     }
  1442                     }
   577 
  1443 
   578                     /**
  1444                     /**
   579                      * Match against IDN hostnames
  1445                      * Match against IDN hostnames
   580                      * Note: Keep label regex short to avoid issues with long patterns when matching IDN hostnames
  1446                      * Note: Keep label regex short to avoid issues with long patterns when matching IDN hostnames
   590                     }
  1456                     }
   591 
  1457 
   592                     // Check each hostname part
  1458                     // Check each hostname part
   593                     $check = 0;
  1459                     $check = 0;
   594                     foreach ($domainParts as $domainPart) {
  1460                     foreach ($domainParts as $domainPart) {
       
  1461                         // If some domain part is empty (i.e. zend..com), it's invalid
       
  1462                         if (empty($domainPart)) {
       
  1463                             $this->_error(self::INVALID_HOSTNAME);
       
  1464                             return false;
       
  1465                         }
       
  1466 
   595                         // Decode Punycode domainnames to IDN
  1467                         // Decode Punycode domainnames to IDN
   596                         if (strpos($domainPart, 'xn--') === 0) {
  1468                         if (strpos($domainPart, 'xn--') === 0) {
   597                             $domainPart = $this->decodePunycode(substr($domainPart, 4));
  1469                             $domainPart = $this->decodePunycode(substr($domainPart, 4));
   598                             if ($domainPart === false) {
  1470                             if ($domainPart === false) {
   599                                 return false;
  1471                                 return false;
   610                         }
  1482                         }
   611 
  1483 
   612                         // Check each domain part
  1484                         // Check each domain part
   613                         $checked = false;
  1485                         $checked = false;
   614                         foreach($regexChars as $regexKey => $regexChar) {
  1486                         foreach($regexChars as $regexKey => $regexChar) {
   615                             $status = @preg_match($regexChar, $domainPart);
  1487                             $status = preg_match($regexChar, $domainPart);
   616                             if ($status > 0) {
  1488                             if ($status > 0) {
   617                                 $length = 63;
  1489                                 $length = 63;
   618                                 if (array_key_exists(strtoupper($this->_tld), $this->_idnLength)
  1490                                 if (array_key_exists(strtoupper($this->_tld), $this->_idnLength)
   619                                     && (array_key_exists($regexKey, $this->_idnLength[strtoupper($this->_tld)]))) {
  1491                                     && (array_key_exists($regexKey, $this->_idnLength[strtoupper($this->_tld)]))) {
   620                                     $length = $this->_idnLength[strtoupper($this->_tld)];
  1492                                     $length = $this->_idnLength[strtoupper($this->_tld)];
   644                     $this->_error(self::UNDECIPHERABLE_TLD);
  1516                     $this->_error(self::UNDECIPHERABLE_TLD);
   645                     $status = false;
  1517                     $status = false;
   646                 }
  1518                 }
   647             } while (false);
  1519             } while (false);
   648 
  1520 
   649             iconv_set_encoding('internal_encoding', $origenc);
  1521             if (PHP_VERSION_ID < 50600) {
       
  1522                 iconv_set_encoding('internal_encoding', $origenc);
       
  1523             } else {
       
  1524                 ini_set('default_charset', $origenc);
       
  1525             }
   650             // If the input passes as an Internet domain name, and domain names are allowed, then the hostname
  1526             // If the input passes as an Internet domain name, and domain names are allowed, then the hostname
   651             // passes validation
  1527             // passes validation
   652             if ($status && ($this->_options['allow'] & self::ALLOW_DNS)) {
  1528             if ($status && ($this->_options['allow'] & self::ALLOW_DNS)) {
   653                 return true;
  1529                 return true;
   654             }
  1530             }
   696      * @param  string $encoded Punycode encoded string to decode
  1572      * @param  string $encoded Punycode encoded string to decode
   697      * @return string
  1573      * @return string
   698      */
  1574      */
   699     protected function decodePunycode($encoded)
  1575     protected function decodePunycode($encoded)
   700     {
  1576     {
   701         $found = preg_match('/([^a-z0-9\x2d]{1,10})$/i', $encoded);
  1577         if (!preg_match('/^[a-z0-9-]+$/i', $encoded)) {
   702         if (empty($encoded) || ($found > 0)) {
  1578             // no punycode encoded string
   703             // no punycode encoded string, return as is
       
   704             $this->_error(self::CANNOT_DECODE_PUNYCODE);
  1579             $this->_error(self::CANNOT_DECODE_PUNYCODE);
   705             return false;
  1580             return false;
   706         }
  1581         }
   707 
  1582 
       
  1583         $decoded = array();
   708         $separator = strrpos($encoded, '-');
  1584         $separator = strrpos($encoded, '-');
   709         if ($separator > 0) {
  1585         if ($separator > 0) {
   710             for ($x = 0; $x < $separator; ++$x) {
  1586             for ($x = 0; $x < $separator; ++$x) {
   711                 // prepare decoding matrix
  1587                 // prepare decoding matrix
   712                 $decoded[] = ord($encoded[$x]);
  1588                 $decoded[] = ord($encoded[$x]);
   713             }
  1589             }
   714         } else {
       
   715             $this->_error(self::CANNOT_DECODE_PUNYCODE);
       
   716             return false;
       
   717         }
  1590         }
   718 
  1591 
   719         $lengthd = count($decoded);
  1592         $lengthd = count($decoded);
   720         $lengthe = strlen($encoded);
  1593         $lengthe = strlen($encoded);
   721 
  1594