Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
Idna

Functions

 _adapt ($delta, $numPoints, $firstTime)
 Bias adaptation.
 
 _calculateThreshold ($k, $bias)
 Calculate the bias threshold to fall between TMIN and TMAX.
 
 _charToCodePoint ($char)
 Convert a single or multi-byte character to its code point.
 
static _checkForError ($info)
 Checks if the $idna_info parameter of idn_to_ascii() or idn_to_utf8() contains errors.
 
 _codePoints ($input)
 List code points for a given input.
 
 _codePointToChar ($code)
 Convert a code point to its single or multi-byte character.
 
 _decodePart ($input)
 Decode a part of domain name, such as tld.
 
 _encodePart ($input)
 Encode a part of a domain name, such as tld, to its Punycode version.
 
static _getBackend ()
 Return the IDNA backend.
 
static decode ( $input)
 Decode a Punycode domain name to its Unicode counterpart.
 
static encode ( $input)
 Encode a domain to its Punycode version.
 

Variables

static $_decodeTable
 Decode table.
 
static $_encodeTable
 Encode table.
 
static string $_pearDirectory = '@data_dir@'
 The absolute PEAR path to the translations for the default gettext handler.
 
const DAMP = 700
 
const DELIMITER = '-'
 
*See the enclosed file LICENSE for license information(BSD). If you *did not receive this file see http
 
**See the enclosed file LICENSE for license information(BSD). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(BSD). If you *did not receive this file see http
 
const INITIAL_BIAS = 72
 
const INITIAL_N = 128
 
const PREFIX = 'xn--'
 
const SKEW = 38
 
const TMAX = 26
 
const TMIN = 1
 

Detailed Description

Function Documentation

◆ _adapt()

_adapt ( $delta,
$numPoints,
$firstTime )
protected

Bias adaptation.

Parameters
integer$delta
integer$numPoints
boolean$firstTime
Return values
integer

◆ _calculateThreshold()

_calculateThreshold ( $k,
$bias )
protected

Calculate the bias threshold to fall between TMIN and TMAX.

Parameters
integer$k
integer$bias
Return values
integer

◆ _charToCodePoint()

_charToCodePoint ( $char)
protected

Convert a single or multi-byte character to its code point.

Parameters
string$char
Return values
integer

◆ _checkForError()

static _checkForError ( $info)
staticprotected

Checks if the $idna_info parameter of idn_to_ascii() or idn_to_utf8() contains errors.

Parameters
array$infoFourth parameter to idn_to_ascii() or idn_to_utf8().
Exceptions
Horde_Idna_Exception

◆ _codePoints()

_codePoints ( $input)
protected

List code points for a given input.

Parameters
string$input
Return values
arrayMulti-dimension array with basic, non-basic and aggregated code points.

◆ _codePointToChar()

_codePointToChar ( $code)
protected

Convert a code point to its single or multi-byte character.

Parameters
integer$code
Return values
string

◆ _decodePart()

_decodePart ( $input)
protected

Decode a part of domain name, such as tld.

Parameters
string$inputPart of a domain name.
Return values
stringUnicode domain part.

◆ _encodePart()

_encodePart ( $input)
protected

Encode a part of a domain name, such as tld, to its Punycode version.

Parameters
string$inputPart of a domain name.
Return values
stringPunycode representation of a domain part.

◆ _getBackend()

static _getBackend ( )
staticprotected

Return the IDNA backend.

Return values
mixedIDNA backend (false if none available).

◆ decode()

decode ( $input)
static

Decode a Punycode domain name to its Unicode counterpart.

Exceptions
Horde_Idna_Exception
Parameters
string$inputDomain name in Punycode
Return values
stringUnicode domain name.

◆ encode()

encode ( $input)
static

Encode a domain to its Punycode version.

Exceptions
Horde_Idna_Exception
Parameters
string$inputDomain name in Unicde to be encoded.
Return values
stringPunycode representation in ASCII.

Variable Documentation

◆ $_decodeTable

$_decodeTable
staticprotected
Initial value:
= array(
'a' => 0, 'b' => 1, 'c' => 2, 'd' => 3, 'e' => 4, 'f' => 5,
'g' => 6, 'h' => 7, 'i' => 8, 'j' => 9, 'k' => 10, 'l' => 11,
'm' => 12, 'n' => 13, 'o' => 14, 'p' => 15, 'q' => 16, 'r' => 17,
's' => 18, 't' => 19, 'u' => 20, 'v' => 21, 'w' => 22, 'x' => 23,
'y' => 24, 'z' => 25, '0' => 26, '1' => 27, '2' => 28, '3' => 29,
'4' => 30, '5' => 31, '6' => 32, '7' => 33, '8' => 34, '9' => 35
)

Decode table.

Parameters
array

◆ $_encodeTable

$_encodeTable
staticprotected
Initial value:
= array(
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
)

Encode table.

Parameters
array