[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/simplepie/simplepie/idn/ -> idna_convert.class.php (summary)

(no description)

File Size: 969 lines (38 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

idna_convert:: (21 methods):
  __construct()
  set_parameter()
  decode()
  encode()
  get_last_error()
  _decode()
  _encode()
  _adapt()
  _encode_digit()
  _decode_digit()
  _error()
  _nameprep()
  _hangul_decompose()
  _hangul_compose()
  _get_combining_class()
  _apply_cannonical_ordering()
  _combine()
  _utf8_to_ucs4()
  _ucs4_to_utf8()
  _ucs4_to_ucs4_string()
  _ucs4_string_to_ucs4()

Net_IDNA_php4:: (1 method):
  setParams()


Class: idna_convert  - X-Ref

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:

- www.nörgler.com
- xn--nrgler-wxa
- xn--brse-5qa.xn--knrz-1ra.info

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 {@link set_paramter()}.

ACE input and output is always expected to be ASCII.

__construct($options = false)   X-Ref
No description

set_parameter($option, $value = false)   X-Ref
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

param: mixed     Parameter to set (string: single parameter; array of Parameter => Value pairs)
param: string    Value to use (if parameter 1 is a string)
return: boolean   true on success, false otherwise

decode($input, $one_time_encoding = false)   X-Ref
Decode a given ACE domain name

param: string   Domain name (ACE string)
return: string   Decoded Domain name (UTF-8 or UCS-4)

encode($decoded, $one_time_encoding = false)   X-Ref
Encode a given UTF-8 domain name

param: string   Domain name (UTF-8 or UCS-4)
return: string   Encoded Domain name (ACE string)

get_last_error()   X-Ref
Use this method to get the last error ocurred

param: void
return: string   The last error, that occured

_decode($encoded)   X-Ref
The actual decoding algorithm


_encode($decoded)   X-Ref
The actual encoding algorithm


_adapt($delta, $npoints, $is_first)   X-Ref
Adapt the bias according to the current code point and position


_encode_digit($d)   X-Ref
Encoding a certain digit


_decode_digit($cp)   X-Ref
Decode a certain digit


_error($error = '')   X-Ref
Internal error handling method


_nameprep($input)   X-Ref
Do Nameprep according to RFC3491 and RFC3454

param: array    Unicode Characters
return: string   Unicode Characters, Nameprep'd

_hangul_decompose($char)   X-Ref
Decomposes a Hangul syllable
(see http://www.unicode.org/unicode/reports/tr15/#Hangul

param: integer  32bit UCS4 code point
return: array    Either Hangul Syllable decomposed or original 32bit value as one value array

_hangul_compose($input)   X-Ref
Ccomposes a Hangul syllable
(see http://www.unicode.org/unicode/reports/tr15/#Hangul

param: array    Decomposed UCS4 sequence
return: array    UCS4 sequence with syllables composed

_get_combining_class($char)   X-Ref
Returns the combining class of a certain wide char

param: integer    Wide char to check (32bit integer)
return: integer    Combining class if found, else 0

_apply_cannonical_ordering($input)   X-Ref
Apllies the cannonical ordering of a decomposed UCS4 sequence

param: array      Decomposed UCS4 sequence
return: array      Ordered USC4 sequence

_combine($input)   X-Ref
Do composition of a sequence of starter and non-starter

param: array      UCS4 Decomposed sequence
return: array      Ordered USC4 sequence

_utf8_to_ucs4($input)   X-Ref
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


_ucs4_to_utf8($input)   X-Ref
Convert UCS-4 string into UTF-8 string
See _utf8_to_ucs4() for details


_ucs4_to_ucs4_string($input)   X-Ref
Convert UCS-4 array into UCS-4 string


_ucs4_string_to_ucs4($input)   X-Ref
Convert UCS-4 strin into UCS-4 garray


Class: Net_IDNA_php4  - X-Ref

Adapter class for aligning the API of idna_convert with that of Net_IDNA

setParams($option, $param = false)   X-Ref
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

param: mixed     Parameter to set (string: single parameter; array of Parameter => Value pairs)
param: string    Value to use (if parameter 1 is a string)
return: boolean   true on success, false otherwise