$value ) if( $city == $value ) return $key; return ''; } // // Torna TRUE se la provincia specificata č valida // function is_province( $province ) { if ( $province == '' ) return false; $proList = Italy :: get_provinces(); foreach( $proList as $key=>$value ) if( $province == $key ) return true; return false; } // // Data una provincia torna la regione // // @params province nome cittā // function get_district_of( $province ) { $districts = Italy :: get_districts(); foreach( $districts as $r=>$cList ) foreach ( $cList as $c ) if( ($province == $c) ) return $r; return ''; } function get_districts() { $districts = array(); $districts['Abruzzo'] = array('CH' => 'Chieti', "AQ" => "L'Aquila", 'PE' => 'Pescara', 'TE' => 'Teramo'); $districts['Basilicata'] = array('MT' => 'Matera', 'PZ' => 'Potenza'); $districts['Calabria'] = array('CZ' => 'Catanzaro', 'CS' => 'Cosenza', 'KR' => 'Crotone', 'RC' => 'Reggio Calabria', 'VV' => 'Vibo Valentia'); $districts['Campania'] = array('AV' => 'Avellino', 'BN' => 'Benevento', 'CE' => 'Caserta', 'NA' => 'Napoli', 'SA' => 'Salerno'); $districts['Emilia-Romagna'] = array('BO' => 'Bologna', 'FE' => 'Ferrara', 'FC' => 'Forli-Cesena', 'MO' => 'Modena', 'PR' => 'Parma', 'PC' => 'Piacenza', 'RA' => 'Ravenna', 'RE' => 'Reggio Emilia', 'RN' => 'Rimini'); $districts['Friuli-Venezia Giulia'] = array('GO' => 'Gorizia', 'PN' => 'Pordenone', 'TS' => 'Trieste', 'UD' => 'Udine'); $districts['Lazio'] = array('FR' => 'Frosinone', 'LT' => 'Latina', 'RI' => 'Rieti', 'RM' => 'Roma', 'VT' => 'Viterbo'); $districts['Liguria'] = array('GE' => 'Genova', 'IM' => 'Imperia', 'SP' => 'La Spezia', 'SV' => 'Savona'); $districts['Lombardia'] = array('BG' => 'Bergamo', 'BS' => 'Brescia', 'CO' => 'Como', 'CR' => 'Cremona', 'LC' => 'Lecco', 'LO' => 'Lodi', 'MN' => 'Mantova', 'MI' => 'Milano', 'MB' => 'Monza e Brianza', 'PV' => 'Pavia', 'SO' => 'Sondrio', 'VA' => 'Varese' ); $districts['Marche'] = array('AN' => 'Ancona', 'AP' => 'Ascoli Piceno', 'MC' => 'Macerata', 'PU' => 'Pesaro e Urbino', 'FM' => 'Fermo'); $districts['Molise'] = array('CB' => 'Campobasso', 'IS' => 'Isernia'); $districts['Piemonte'] = array('AL' => 'Alessandria', 'AT' => 'Asti', 'BI' => 'Biella', 'CN' => 'Cuneo', 'NO' => 'Novara', 'TO' => 'Torino', 'VB' => 'Verbano-Cusio-Ossola', 'VC' => 'Vercelli'); $districts['Puglia'] = array('BA' => 'Bari', 'BAT' => 'Barletta-Andria-Trani', 'BR' => 'Brindisi', 'LE' => 'Lecce', 'FG' => 'Foggia', 'TA' => 'Taranto'); $districts['Sardegna'] = array('CA' => 'Cagliari', 'CI' => 'Carbonia-Iglesias', 'VS' => 'Medio Campidano', 'NU' => 'Nuoro', 'OG'=>'Ogliastra', 'OT' => 'Olbia-Tempio', 'OR' => 'Oristano', 'SS' => 'Sassari'); $districts['Sicilia'] = array('AG' => 'Agrigento', 'CL' => 'Caltanissetta', 'CT' => 'Catania', 'EN' => 'Enna', 'ME' => 'Messina', 'PA' => 'Palermo', 'RG' => 'Ragusa', 'SR' => 'Siracusa', 'TP' => 'Trapani' ); $districts['Toscana'] = array('AR' => 'Arezzo', 'FI' => 'Firenze', 'GR' => 'Grosseto', 'LI' => 'Livorno', 'LU' => 'Lucca', 'MS' => 'Massa Carrara', 'PI' => 'Pisa', 'PT' => 'Pistoia', 'PO' => 'Prato', 'SI' => 'Siena'); $districts['Trentino-Alto Adige'] = array('BZ' => 'Bolzano', 'TN' => 'Trento'); $districts['Umbria'] = array('PG' => 'Perugia', 'TR' => 'Terni'); $districts["Valle d'Aosta"] = array('AO' => 'Aosta'); $districts['Veneto'] = array('BL' => 'Belluno', 'PD' => 'Padova', 'RO' => 'Rovigo', 'TV' => 'Treviso', 'VE' => 'Venezia', 'VR' => 'Verona', 'VI' => 'Vicenza'); return $districts; } // // Torna TRUE se la regione specificata č valida // function is_district( $district ) { if ( $district == '' ) return false; $districts = Italy :: get_districts(); return isset($districts[$district]); } // // Data una provincia (sigla) torna la citta // // function get_city_full_name( $province ) { $provinces = Italy :: get_provinces(); return ( isset($provinces[$province]) ? $provinces[$province] : '' ); } } ?>