Public Member Functions | |
__construct ($options=false) | |
get_version () | |
set_parameter ($option, $value=false) | |
decode ($input, $one_time_encoding=false) | |
encode ($decoded, $one_time_encoding=false) | |
encode_uri ($uri) | |
get_last_error () | |
getInstance ($params=array()) | |
singleton ($params=array()) | |
Protected Member Functions | |
_decode ($encoded) | |
_encode ($decoded) | |
_adapt ($delta, $npoints, $is_first) | |
_encode_digit ($d) | |
_decode_digit ($cp) | |
_error ($error= '') | |
_nameprep ($input) | |
_hangul_decompose ($char) | |
_hangul_compose ($input) | |
_get_combining_class ($char) | |
_apply_cannonical_ordering ($input) | |
_combine ($input) | |
_utf8_to_ucs4 ($input) | |
_ucs4_to_utf8 ($input) | |
_ucs4_to_ucs4_string ($input) | |
_ucs4_string_to_ucs4 ($input) | |
Static Protected Member Functions | |
static | byteLength ($string) |
Protected Attributes | |
$sub_version = 'main' | |
$_punycode_prefix = 'xn--' | |
$_invalid_ucs = 0x80000000 | |
$_max_ucs = 0x10FFFF | |
$_base = 36 | |
$_tmin = 1 | |
$_tmax = 26 | |
$_skew = 38 | |
$_damp = 700 | |
$_initial_bias = 72 | |
$_initial_n = 0x80 | |
$_sbase = 0xAC00 | |
$_lbase = 0x1100 | |
$_vbase = 0x1161 | |
$_tbase = 0x11A7 | |
$_lcount = 19 | |
$_vcount = 21 | |
$_tcount = 28 | |
$_ncount = 588 | |
$_scount = 11172 | |
$_error = false | |
$_api_encoding = 'utf8' | |
$_allow_overlong = false | |
$_strict_mode = false | |
$_idn_version = 2003 | |
Static Protected Attributes | |
static | $_mb_string_overload = null |
static | $NP |
Encode/decode Internationalized Domain Names.
The class allows to convert internationalized domain names (see RFC 3490 for details) as they can be used with various registries worldwide to be translated between their original (localized) form and their encoded form as it will be used in the DNS (Domain Name System).
The class provides two public methods, encode() and decode(), which do exactly what you would expect them to do. You are allowed to use complete domain names, simple strings and complete email addresses as well. That means, that you might use any of the following notations:
Unicode input might be given as either UTF-8 string, UCS-4 string or UCS-4 array. Unicode output is available in the same formats. You can select your preferred format via set_paramter().
ACE input and output is always expected to be ASCII.
Definition at line 52 of file idna_convert.class.php.
idna_convert::__construct | ( | $options = false | ) |
the constructor
array | $options |
Definition at line 94 of file idna_convert.class.php.
|
protected |
Adapt the bias according to the current code point and position
int | $delta | |
int | $npoints | |
int | $is_first |
Definition at line 571 of file idna_convert.class.php.
|
protected |
Applies the cannonical ordering of a decomposed UCS4 sequence
array | Decomposed UCS4 sequence |
Definition at line 778 of file idna_convert.class.php.
|
protected |
Do composition of a sequence of starter and non-starter
array | UCS4 Decomposed sequence |
Definition at line 812 of file idna_convert.class.php.
|
protected |
The actual decoding algorithm
string |
Definition at line 408 of file idna_convert.class.php.
|
protected |
Decode a certain digit
int | $cp |
Definition at line 596 of file idna_convert.class.php.
|
protected |
The actual encoding algorithm
string |
Definition at line 469 of file idna_convert.class.php.
|
protected |
Encoding a certain digit
int | $d |
Definition at line 586 of file idna_convert.class.php.
|
protected |
Internal error handling method
string | $error |
Definition at line 606 of file idna_convert.class.php.
|
protected |
Returns the combining class of a certain wide char
integer | Wide char to check (32bit integer) |
Definition at line 768 of file idna_convert.class.php.
|
protected |
Ccomposes a Hangul syllable (see http://www.unicode.org/unicode/reports/tr15/#Hangul
array | Decomposed UCS4 sequence |
Definition at line 726 of file idna_convert.class.php.
|
protected |
Decomposes a Hangul syllable (see http://www.unicode.org/unicode/reports/tr15/#Hangul
integer | 32bit UCS4 code point |
Definition at line 704 of file idna_convert.class.php.
|
protected |
Do Nameprep according to RFC3491 and RFC3454
array | Unicode Characters |
Definition at line 616 of file idna_convert.class.php.
|
protected |
Convert UCS-4 strin into UCS-4 garray
string | $input |
Definition at line 979 of file idna_convert.class.php.
|
protected |
Convert UCS-4 array into UCS-4 string
array | $input |
Definition at line 962 of file idna_convert.class.php.
|
protected |
Convert UCS-4 string into UTF-8 string See _utf8_to_ucs4() for details
string | $input |
Definition at line 936 of file idna_convert.class.php.
|
protected |
This converts an UTF-8 encoded string to its UCS-4 representation By talking about UCS-4 "strings" we mean arrays of 32bit integers representing each of the "chars". This is due to PHP not being able to handle strings with bit depth different from 8. This apllies to the reverse method _ucs4_to_utf8(), too. The following UTF-8 encodings are supported: bytes bits representation 1 7 0xxxxxxx 2 11 110xxxxx 10xxxxxx 3 16 1110xxxx 10xxxxxx 10xxxxxx 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 5 26 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 6 31 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx Each x represents a bit that can be used to store character data. The five and six byte sequences are part of Annex D of ISO/IEC 10646-1:2000
string | $input |
Definition at line 859 of file idna_convert.class.php.
|
staticprotected |
Gets the length of a string in bytes even if mbstring function overloading is turned on
string | $string | the string for which to get the length. |
Definition at line 1010 of file idna_convert.class.php.
idna_convert::decode | ( | $input, | |
$one_time_encoding = false |
|||
) |
Decode a given ACE domain name
string | Domain name (ACE string) [ |
string | Desired output encoding, see set_parameter] |
Definition at line 181 of file idna_convert.class.php.
idna_convert::encode | ( | $decoded, | |
$one_time_encoding = false |
|||
) |
Encode a given UTF-8 domain name
string | Domain name (UTF-8 or UCS-4) [ |
string | Desired input encoding, see set_parameter] |
Definition at line 281 of file idna_convert.class.php.
idna_convert::encode_uri | ( | $uri | ) |
Removes a weakness of encode(), which cannot properly handle URIs but instead encodes their path or query components, too.
string | $uri | Expects the URI as a UTF-8 (or ASCII) string |
Definition at line 368 of file idna_convert.class.php.
idna_convert::get_last_error | ( | ) |
Use this method to get the last error ocurred
void |
Definition at line 398 of file idna_convert.class.php.
idna_convert::get_version | ( | ) |
Definition at line 108 of file idna_convert.class.php.
idna_convert::getInstance | ( | $params = array() | ) |
Attempts to return a concrete IDNA instance.
array | $params | Set of paramaters |
Definition at line 1025 of file idna_convert.class.php.
idna_convert::set_parameter | ( | $option, | |
$value = false |
|||
) |
Sets a new option value. Available options and values: [encoding - Use either UTF-8, UCS4 as array or UCS4 as string as input ('utf8' for UTF-8, 'ucs4_string' and 'ucs4_array' respectively for UCS4); The output is always UTF-8] [overlong - Unicode does not allow unnecessarily long encodings of chars, to allow this, set this parameter to true, else to false; default is false.] [strict - true: strict mode, good for registration purposes - Causes errors on failures; false: loose mode, ideal for "wildlife" applications by silently ignoring errors and returning the original input instead
mixed | Parameter to set (string: single parameter; array of Parameter => Value pairs) |
string | Value to use (if parameter 1 is a string) |
Definition at line 128 of file idna_convert.class.php.
idna_convert::singleton | ( | $params = array() | ) |
Attempts to return a concrete IDNA instance for either php4 or php5, only creating a new instance if no IDNA instance with the same parameters currently exists.
array | $params | Set of paramaters |
Definition at line 1040 of file idna_convert.class.php.
|
protected |
Definition at line 83 of file idna_convert.class.php.
|
protected |
Definition at line 82 of file idna_convert.class.php.
|
protected |
Definition at line 62 of file idna_convert.class.php.
|
protected |
Definition at line 66 of file idna_convert.class.php.
|
protected |
Definition at line 78 of file idna_convert.class.php.
|
protected |
Definition at line 85 of file idna_convert.class.php.
|
protected |
Definition at line 67 of file idna_convert.class.php.
|
protected |
Definition at line 68 of file idna_convert.class.php.
|
protected |
Definition at line 60 of file idna_convert.class.php.
|
protected |
Definition at line 70 of file idna_convert.class.php.
|
protected |
Definition at line 73 of file idna_convert.class.php.
|
protected |
Definition at line 61 of file idna_convert.class.php.
|
staticprotected |
Definition at line 79 of file idna_convert.class.php.
|
protected |
Definition at line 76 of file idna_convert.class.php.
|
protected |
Definition at line 59 of file idna_convert.class.php.
|
protected |
Definition at line 69 of file idna_convert.class.php.
|
protected |
Definition at line 77 of file idna_convert.class.php.
|
protected |
Definition at line 65 of file idna_convert.class.php.
|
protected |
Definition at line 84 of file idna_convert.class.php.
|
protected |
Definition at line 72 of file idna_convert.class.php.
|
protected |
Definition at line 75 of file idna_convert.class.php.
|
protected |
Definition at line 64 of file idna_convert.class.php.
|
protected |
Definition at line 63 of file idna_convert.class.php.
|
protected |
Definition at line 71 of file idna_convert.class.php.
|
protected |
Definition at line 74 of file idna_convert.class.php.
|
staticprotected |
Holds all relevant mapping tables See RFC3454 for details
array
Definition at line 1058 of file idna_convert.class.php.
|
protected |
Definition at line 55 of file idna_convert.class.php.