phpDocumentor pond
[ class tree: pond ] [ index: pond ] [ all elements ]

Class: idna_convert

Source Location: /qp_inc/_ext/idna/_idna_convert.class.php

Class idna_convert

Class Overview

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 set_paramter().

ACE input and output is always expected to be ASCII.

Located in /qp_inc/_ext/idna/_idna_convert.class.php [line 63]



		
				Author(s):
		
		
		
Information Tags:
Version:  0.6.2 changelog since 0.5.1 class updated to PHP5/6 style should be compatible to PHP 4.3+
Copyright:  2004-2009 phlyLabs Berlin, http://phlylabs.de

Methods

[ Top ]
Method Summary
boolean   __construct()   the constructor
string   decode()   Decode a given ACE domain name
string   encode()   Encode a given UTF-8 domain name
string   get_last_error()   Use this method to get the last error ocurred
boolean   set_parameter()   Sets a new option value. Available options and values:

[ Top ]
Methods
Constructor __construct  [line 103]

  boolean __construct( [array $options = false]  )

the constructor

Parameters:
array   $options: 

API Tags:
Access:  public

Information Tags:
Since:  0.5.2

[ Top ]
decode  [line 165]

  string decode( string $input, [ $one_time_encoding = false]  )

Decode a given ACE domain name

Parameters:
string   $input:  Domain name (ACE string) [@param string Desired output encoding, see set_parameter]
   $one_time_encoding: 

API Tags:
Return:  Decoded Domain name (UTF-8 or UCS-4)
Access:  public


[ Top ]
encode  [line 266]

  string encode( string $decoded, [ $one_time_encoding = false]  )

Encode a given UTF-8 domain name

Parameters:
string   $decoded:  Domain name (UTF-8 or UCS-4) [@param string Desired input encoding, see set_parameter]
   $one_time_encoding: 

API Tags:
Return:  Encoded Domain name (ACE string)
Access:  public


[ Top ]
get_last_error  [line 349]

  string get_last_error( void 0  )

Use this method to get the last error ocurred

Parameters:
void   0: 

API Tags:
Return:  The last error, that occured
Access:  public


[ Top ]
set_parameter  [line 126]

  boolean set_parameter( mixed $option, [string $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

Parameters:
mixed   $option:  Parameter to set (string: single parameter; array of Parameter => Value pairs)
string   $value:  Value to use (if parameter 1 is a string)

API Tags:
Return:  true on success, false otherwise
Access:  public


[ Top ]