<?php
/*
 * ccTLD (country code TLD)
 *
 * @copyright   Copyright &copy; 2005, Katsumi Saito <katsumi@jo1upk.ymt.prug.or.jp>
 * @version     $Id: ccTLD.cls.php,v 0.2 2005/06/14 00:09:00 upk Exp $
 * @license     http://opensource.org/licenses/gpl-license.php GNU Public License
 * o 参考にしたコード(AWStats)
 *   http://awstats.sourceforge.net/
 *   Copyright (C) 2000-2005 - Laurent Destailleur - eldy@users.sourceforge.net
 *   awstats-6.5/wwwroot/cgi-bin/lib/domains.pm
 *
 */

class ccTLD
{
	// ISO 3166 (http://www.iana.org/cctld/cctld-whois.htm)
	var $flag = array(
		'localhost' => 'localhost',
		'i0'	=> 'Local network host',
		'a2'	=> 'Satellite access host',
		
		'ac'	=> 'Ascension Island',
		'ad'	=> 'Andorra',
		'ae'	=> 'United Arab Emirates',
		'aero'	=> 'Aero/Travel domains',
		'af'	=> 'Afghanistan',
		'ag'	=> 'Antigua and Barbuda',
		'ai'	=> 'Anguilla',
		'al'	=> 'Albania',
		'am'	=> 'Armenia',
		'an'	=> 'Netherlands Antilles',
		'ao'	=> 'Angola',
		'aq'	=> 'Antarctica',
		'ar'	=> 'Argentina',
		'arpa'	=> 'Old style Arpanet',
		'as'	=> 'American Samoa',
		'at'	=> 'Austria',
		'au'	=> 'Australia',
		'aw'	=> 'Aruba',
		'az'	=> 'Azerbaidjan',
		'ba'	=> 'Bosnia-Herzegovina',
		'bb'	=> 'Barbados',
		'bd'	=> 'Bangladesh',
		'be'	=> 'Belgium',
		'bf'	=> 'Burkina Faso',
		'bg'	=> 'Bulgaria',
		'bh'	=> 'Bahrain',
		'bi'	=> 'Burundi',
		'biz'	=> 'Biz domains',
		'bj'	=> 'Benin',
		'bm'	=> 'Bermuda',
		'bn'	=> 'Brunei Darussalam',
		'bo'	=> 'Bolivia',
		'br'	=> 'Brazil',
		'bs'	=> 'Bahamas',
		'bt'	=> 'Bhutan',
		'bv'	=> 'Bouvet Island',
		'bw'	=> 'Botswana',
		'by'	=> 'Belarus',
		'bz'	=> 'Belize',
		'ca'	=> 'Canada',
		'cc'	=> 'Cocos (Keeling) Islands',
		'cd'	=> 'Congo, Democratic Republic of the',
		'cf'	=> 'Central African Republic',
		'cg'	=> 'Congo',
		'ch'	=> 'Switzerland',
		'ci'	=> 'Ivory Coast (Cote D\'Ivoire)',
		'ck'	=> 'Cook Islands',
		'cl'	=> 'Chile',
		'cm'	=> 'Cameroon',
		'cn'	=> 'China',
		'co'	=> 'Colombia',
		'com'	=> 'Commercial',
		'coop'	=> 'Coop domains',
		'cr'	=> 'Costa Rica',
		'cs'	=> 'Former Czechoslovakia',
		'cu'	=> 'Cuba',
		'cv'	=> 'Cape Verde',
		'cx'	=> 'Christmas Island',
		'cy'	=> 'Cyprus',
		'cz'	=> 'Czech Republic',
		'de'	=> 'Germany',
		'dj'	=> 'Djibouti',
		'dk'	=> 'Denmark',
		'dm'	=> 'Dominica',
		'do'	=> 'Dominican Republic',
		'dz'	=> 'Algeria',
		'ec'	=> 'Ecuador',
		'edu'	=> 'USA Educational',
		'ee'	=> 'Estonia',
		'eg'	=> 'Egypt',
		'eh'	=> 'Western Sahara',
		'er'	=> 'Eritrea',
		'es'	=> 'Spain',
		'et'	=> 'Ethiopia',
		'eu'	=> 'European Union',
		'fi'	=> 'Finland',
		'fj'	=> 'Fiji',
		'fk'	=> 'Falkland Islands',
		'fm'	=> 'Micronesia',
		'fo'	=> 'Faroe Islands',
		'fr'	=> 'France',
		'fx'	=> 'France (European Territory)',
		'ga'	=> 'Gabon',
		'gb'	=> 'Great Britain',
		'gd'	=> 'Grenada',
		'ge'	=> 'Georgia',
		'gf'	=> 'French Guyana',
		'gg'	=> 'Guernsey',
		'gh'	=> 'Ghana',
		'gi'	=> 'Gibraltar',
		'gl'	=> 'Greenland',
		'gm'	=> 'Gambia',
		'gn'	=> 'Guinea',
		'gov'	=> 'USA Government',
		'gp'	=> 'Guadeloupe (French)',
		'gq'	=> 'Equatorial Guinea',
		'gr'	=> 'Greece',
		'gs'	=> 'S. Georgia &amp; S. Sandwich Isls.',
		'gt'	=> 'Guatemala',
		'gu'	=> 'Guam (USA)',
		'gw'	=> 'Guinea Bissau',
		'gy'	=> 'Guyana',
		'hk'	=> 'Hong Kong',
		'hm'	=> 'Heard and McDonald Islands',
		'hn'	=> 'Honduras',
		'hr'	=> 'Croatia',
		'ht'	=> 'Haiti',
		'hu'	=> 'Hungary',
		'id'	=> 'Indonesia',
		'ie'	=> 'Ireland',
		'il'	=> 'Israel',
		'im'	=> 'Isle of Man',
		'in'	=> 'India',
		'info'	=> 'Info domains',
		'int'	=> 'International',
		'io'	=> 'British Indian Ocean Territory',
		'iq'	=> 'Iraq',
		'ir'	=> 'Iran',
		'is'	=> 'Iceland',
		'it'	=> 'Italy',
		'je'	=> 'Jersey',
		'jm'	=> 'Jamaica',
		'jo'	=> 'Jordan',
		'jp'	=> 'Japan',
		'ke'	=> 'Kenya',
		'kg'	=> 'Kyrgyzstan',
		'kh'	=> 'Cambodia',
		'ki'	=> 'Kiribati',
		'km'	=> 'Comoros',
		'kn'	=> 'Saint Kitts &amp; Nevis Anguilla',
		'kp'	=> 'North Korea',
		'kr'	=> 'South Korea',
		'kw'	=> 'Kuwait',
		'ky'	=> 'Cayman Islands',
		'kz'	=> 'Kazakhstan',
		'la'	=> 'Laos',
		'lb'	=> 'Lebanon',
		'lc'	=> 'Saint Lucia',
		'li'	=> 'Liechtenstein',
		'lk'	=> 'Sri Lanka',
		'lr'	=> 'Liberia',
		'ls'	=> 'Lesotho',
		'lt'	=> 'Lithuania',
		'lu'	=> 'Luxembourg',
		'lv'	=> 'Latvia',
		'ly'	=> 'Libya',
		'ma'	=> 'Morocco',
		'mc'	=> 'Monaco',
		'md'	=> 'Moldova',
		'mg'	=> 'Madagascar',
		'mh'	=> 'Marshall Islands',
		'mil'	=> 'USA Military',
		'mk'	=> 'Macedonia',
		'ml'	=> 'Mali',
		'mm'	=> 'Myanmar',
		'mn'	=> 'Mongolia',
		'mo'	=> 'Macau',
		'mp'	=> 'Northern Mariana Islands',
		'mq'	=> 'Martinique (French)',
		'mr'	=> 'Mauritania',
		'ms'	=> 'Montserrat',
		'mt'	=> 'Malta',
		'mu'	=> 'Mauritius',
		'museum' => 'Museum domains',
		'mv'	=> 'Maldives',
		'mw'	=> 'Malawi',
		'mx'	=> 'Mexico',
		'my'	=> 'Malaysia',
		'mz'	=> 'Mozambique',
		'na'	=> 'Namibia',
		'name'	=> 'Name domains',
		'nato'	=> 'NATO',
		'nc'	=> 'New Caledonia (French)',
		'ne'	=> 'Niger',
		'net'	=> 'Network',
		'nf'	=> 'Norfolk Island',
		'ng'	=> 'Nigeria',
		'ni'	=> 'Nicaragua',
		'nl'	=> 'Netherlands',
		'no'	=> 'Norway',
		'np'	=> 'Nepal',
		'nr'	=> 'Nauru',
		'nt'	=> 'Neutral Zone',
		'nu'	=> 'Niue',
		'nz'	=> 'New Zealand',
		'om'	=> 'Oman',
		'org'	=> 'Non-Profit Organizations',
		'pa'	=> 'Panama',
		'pe'	=> 'Peru',
		'pf'	=> 'Polynesia (French)',
		'pg'	=> 'Papua New Guinea',
		'ph'	=> 'Philippines',
		'pk'	=> 'Pakistan',
		'pl'	=> 'Poland',
		'pm'	=> 'Saint Pierre and Miquelon',
		'pn'	=> 'Pitcairn Island',
		'pr'	=> 'Puerto Rico',
		'pro'	=> 'Professional domains',
		'ps'	=> 'Palestinian Territories',
		'pt'	=> 'Portugal',
		'pw'	=> 'Palau',
		'py'	=> 'Paraguay',
		'qa'	=> 'Qatar',
		're'	=> 'Reunion (French)',
		'ro'	=> 'Romania',
		'ru'	=> 'Russian Federation',
		'rw'	=> 'Rwanda',
		'sa'	=> 'Saudi Arabia',
		'sb'	=> 'Solomon Islands',
		'sc'	=> 'Seychelles',
		'sd'	=> 'Sudan',
		'se'	=> 'Sweden',
		'sg'	=> 'Singapore',
		'sh'	=> 'Saint Helena',
		'si'	=> 'Slovenia',
		'sj'	=> 'Svalbard and Jan Mayen Islands',
		'sk'	=> 'Slovak Republic',
		'sl'	=> 'Sierra Leone',
		'sm'	=> 'San Marino',
		'sn'	=> 'Senegal',
		'so'	=> 'Somalia',
		'sr'	=> 'Suriname',
		'st'	=> 'Sao Tome and Principe',
		'su'	=> 'Former USSR',
		'sv'	=> 'El Salvador',
		'sy'	=> 'Syria',
		'sz'	=> 'Swaziland',
		'tc'	=> 'Turks and Caicos Islands',
		'td'	=> 'Chad',
		'tf'	=> 'French Southern Territories',
		'tg'	=> 'Togo',
		'th'	=> 'Thailand',
		'tj'	=> 'Tadjikistan',
		'tk'	=> 'Tokelau',
		'tm'	=> 'Turkmenistan',
		'tn'	=> 'Tunisia',
		'to'	=> 'Tonga',
		'tp'	=> 'East Timor',
		'tr'	=> 'Turkey',
		'tt'	=> 'Trinidad and Tobago',
		'tv'	=> 'Tuvalu',
		'tw'	=> 'Taiwan',
		'tz'	=> 'Tanzania',
		'ua'	=> 'Ukraine',
		'ug'	=> 'Uganda',
		'uk'	=> 'United Kingdom',
		'um'	=> 'USA Minor Outlying Islands',
		'us'	=> 'United States',
		'uy'	=> 'Uruguay',
		'uz'	=> 'Uzbekistan',
		'va'	=> 'Vatican City State',
		'vc'	=> 'Saint Vincent &amp; Grenadines',
		've'	=> 'Venezuela',
		'vg'	=> 'Virgin Islands (British)',
		'vi'	=> 'Virgin Islands (USA)',
		'vn'	=> 'Vietnam',
		'vu'	=> 'Vanuatu',
		'wf'	=> 'Wallis and Futuna Islands',
		'ws'	=> 'Samoa Islands',
		'ye'	=> 'Yemen',
		'yt'	=> 'Mayotte',
		'yu'	=> 'Yugoslavia',
		'za'	=> 'South Africa',
		'zm'	=> 'Zambia',
		'zr'	=> 'Zaire',
		'zw'	=> 'Zimbabwe'
	);

	// アイコン取得(国)
	function get_icon($host)
	{
		$x = substr($host,strrpos($host, '.')+1);
		$x = strtolower($x);
		if (isset($this->flag[$x])) return array($x, $this->flag[$x]);
		return array('','');
	}

}

?>
