package.xml 0000664 0001750 0001750 00000016744 13122746314 011316 0 ustar jan jan
Horde_Idna
pear.horde.org
IDNA backend normalization package
Normalized access to various backends providing IDNA (Internationalized Domain Names in Applications) support.
Michael Slusarz
slusarz
slusarz@horde.org
yes
2017-06-22
1.1.1
1.1.0
stable
stable
BSD-2-Clause
* [jan] Add Turkish translation (İTÜ BİDB <sistemdestek@itu.edu.tr>).
5.3.0
8.0.0alpha1
8.0.0alpha1
1.7.0
Horde_Exception
pear.horde.org
2.0.0
3.0.0alpha1
3.0.0alpha1
Horde_Util
pear.horde.org
2.0.0
3.0.0alpha1
3.0.0alpha1
intl
1.0.0
1.0.0
stable
stable
2015-01-07
BSD-2-Clause
* [mms] Initial release.
1.0.1
1.0.0
stable
stable
2015-01-07
BSD-2-Clause
* [jan] Fix install paths (Bug #13785).
1.0.2
1.0.0
stable
stable
2015-04-13
BSD-2-Clause
* [mms] Use intl extension, if installed, and fallback to a locally-patched version of the true/php-punycode package.
1.0.3
1.0.0
stable
stable
2015-04-28
BSD-2-Clause
* [jan] Fix issues with certain locales like Turkish.
1.0.4
1.0.0
stable
stable
2016-02-01
BSD-2-Clause
* [jan] Mark PHP 7 as supported.
1.1.0
1.1.0
stable
stable
2017-02-27
BSD-2-Clause
* [jan] Check for errors when using UTS #46 algorithm.
1.1.1
1.1.0
stable
stable
2017-06-22
BSD-2-Clause
* [jan] Add Turkish translation (İTÜ BİDB <sistemdestek@itu.edu.tr>).
Horde_Idna-1.1.1/doc/Horde/Idna/COPYING 0000664 0001750 0001750 00000002463 13122746314 015336 0 ustar jan jan Copyright (c) 2014 TrueServer B.V.
Copyright 2014-2017 Horde LLC. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HORDE PROJECT
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Horde_Idna-1.1.1/doc/Horde/Idna/UPGRADING 0000664 0001750 0001750 00000000464 13122746314 015545 0 ustar jan jan ======================
Upgrading Horde_Idna
======================
:Contact: dev@lists.horde.org
.. contents:: Contents
.. section-numbering::
This lists the API changes between releases of the package.
Upgrading to 1.1.0
==================
- Horde_Idna_Translation
This class has been added.
Horde_Idna-1.1.1/lib/Horde/Idna/Exception.php 0000664 0001750 0001750 00000001202 13122746314 016741 0 ustar jan jan
* @category Horde
* @license http://www.horde.org/licenses/bsd BSD
* @package Idna
*/
/**
* Exception class for the Horde_Idna package.
*
* @author Michael Slusarz
* @category Horde
* @copyright 2014-2017 Horde LLC
* @license http://www.horde.org/licenses/bsd BSD
* @package Idna
*/
class Horde_Idna_Exception extends Horde_Exception
{}
Horde_Idna-1.1.1/lib/Horde/Idna/Punycode.php 0000664 0001750 0001750 00000023711 13122746314 016602 0 ustar jan jan
* @author Michael Slusarz
* @category Horde
* @license http://www.horde.org/licenses/bsd BSD
* @package Idna
*/
/**
* Punycode implementation as described in RFC 3492.
*
* Original code (v1.0.1; released under the MIT License):
* https://github.com/true/php-punycode/
*
* @author Renan Gonçalves
* @author Michael Slusarz
* @category Horde
* @copyright 2014 TrueServer B.V.
* @copyright 2015-2017 Horde LLC
* @license http://www.horde.org/licenses/bsd BSD
* @package Idna
* @link http://tools.ietf.org/html/rfc3492
*/
class Horde_Idna_Punycode
{
/**
* Bootstring parameter values.
*/
const BASE = 36;
const TMIN = 1;
const TMAX = 26;
const SKEW = 38;
const DAMP = 700;
const INITIAL_BIAS = 72;
const INITIAL_N = 128;
const PREFIX = 'xn--';
const DELIMITER = '-';
/**
* Encode table.
*
* @param array
*/
protected static $_encodeTable = 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',
);
/**
* Decode table.
*
* @param array
*/
protected static $_decodeTable = 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
);
/**
* Encode a domain to its Punycode version.
*
* @param string $input Domain name in Unicde to be encoded.
*
* @return string Punycode representation in ASCII.
*/
public function encode($input)
{
$parts = explode('.', $input);
foreach ($parts as &$part) {
$part = $this->_encodePart($part);
}
return implode('.', $parts);
}
/**
* Encode a part of a domain name, such as tld, to its Punycode version.
*
* @param string $input Part of a domain name.
*
* @return string Punycode representation of a domain part.
*/
protected function _encodePart($input)
{
$codePoints = $this->_codePoints($input);
$n = static::INITIAL_N;
$bias = static::INITIAL_BIAS;
$delta = 0;
$h = $b = count($codePoints['basic']);
$output = '';
foreach ($codePoints['basic'] as $code) {
$output .= $this->_codePointToChar($code);
}
if ($input === $output) {
return $output;
}
if ($b > 0) {
$output .= static::DELIMITER;
}
$codePoints['nonBasic'] = array_unique($codePoints['nonBasic']);
sort($codePoints['nonBasic']);
$i = 0;
$length = Horde_String::length($input, 'UTF-8');
while ($h < $length) {
$m = $codePoints['nonBasic'][$i++];
$delta = $delta + ($m - $n) * ($h + 1);
$n = $m;
foreach ($codePoints['all'] as $c) {
if (($c < $n) || ($c < static::INITIAL_N)) {
++$delta;
}
if ($c === $n) {
$q = $delta;
for ($k = static::BASE; ; $k += static::BASE) {
$t = $this->_calculateThreshold($k, $bias);
if ($q < $t) {
break;
}
$code = $t + (($q - $t) % (static::BASE - $t));
$output .= static::$_encodeTable[$code];
$q = ($q - $t) / (static::BASE - $t);
}
$output .= static::$_encodeTable[$q];
$bias = $this->_adapt($delta, $h + 1, ($h === $b));
$delta = 0;
++$h;
}
}
++$delta;
++$n;
}
return static::PREFIX . $output;
}
/**
* Decode a Punycode domain name to its Unicode counterpart.
*
* @param string $input Domain name in Punycode
*
* @return string Unicode domain name.
*/
public function decode($input)
{
$parts = explode('.', $input);
foreach ($parts as &$part) {
if (strpos($part, static::PREFIX) === 0) {
$part = $this->_decodePart(
substr($part, strlen(static::PREFIX))
);
}
}
return implode('.', $parts);
}
/**
* Decode a part of domain name, such as tld.
*
* @param string $input Part of a domain name.
*
* @return string Unicode domain part.
*/
protected function _decodePart($input)
{
$n = static::INITIAL_N;
$i = 0;
$bias = static::INITIAL_BIAS;
$output = '';
$pos = strrpos($input, static::DELIMITER);
if ($pos !== false) {
$output = substr($input, 0, $pos++);
} else {
$pos = 0;
}
$outputLength = strlen($output);
$inputLength = strlen($input);
/* Punycode lookup is case-insensitive. */
$input = Horde_String::lower($input);
while ($pos < $inputLength) {
$oldi = $i;
$w = 1;
for ($k = static::BASE; ; $k += static::BASE) {
$digit = static::$_decodeTable[$input[$pos++]];
$i = $i + ($digit * $w);
$t = $this->_calculateThreshold($k, $bias);
if ($digit < $t) {
break;
}
$w = $w * (static::BASE - $t);
}
$bias = $this->_adapt($i - $oldi, ++$outputLength, ($oldi === 0));
$n = $n + (int) ($i / $outputLength);
$i = $i % ($outputLength);
$output = Horde_String::substr($output, 0, $i, 'UTF-8') .
$this->_codePointToChar($n) .
Horde_String::substr($output, $i, $outputLength - 1, 'UTF-8');
++$i;
}
return $output;
}
/**
* Calculate the bias threshold to fall between TMIN and TMAX.
*
* @param integer $k
* @param integer $bias
*
* @return integer
*/
protected function _calculateThreshold($k, $bias)
{
if ($k <= ($bias + static::TMIN)) {
return static::TMIN;
} elseif ($k >= ($bias + static::TMAX)) {
return static::TMAX;
}
return $k - $bias;
}
/**
* Bias adaptation.
*
* @param integer $delta
* @param integer $numPoints
* @param boolean $firstTime
*
* @return integer
*/
protected function _adapt($delta, $numPoints, $firstTime)
{
$delta = (int) (
($firstTime)
? $delta / static::DAMP
: $delta / 2
);
$delta += (int) ($delta / $numPoints);
$k = 0;
while ($delta > ((static::BASE - static::TMIN) * static::TMAX) / 2) {
$delta = (int) ($delta / (static::BASE - static::TMIN));
$k = $k + static::BASE;
}
$k = $k + (int) (((static::BASE - static::TMIN + 1) * $delta) / ($delta + static::SKEW));
return $k;
}
/**
* List code points for a given input.
*
* @param string $input
*
* @return array Multi-dimension array with basic, non-basic and
* aggregated code points.
*/
protected function _codePoints($input)
{
$codePoints = array(
'all' => array(),
'basic' => array(),
'nonBasic' => array()
);
$len = Horde_String::length($input, 'UTF-8');
for ($i = 0; $i < $len; ++$i) {
$char = Horde_String::substr($input, $i, 1, 'UTF-8');
$code = $this->_charToCodePoint($char);
if ($code < 128) {
$codePoints['all'][] = $codePoints['basic'][] = $code;
} else {
$codePoints['all'][] = $codePoints['nonBasic'][] = $code;
}
}
return $codePoints;
}
/**
* Convert a single or multi-byte character to its code point.
*
* @param string $char
*
* @return integer
*/
protected function _charToCodePoint($char)
{
$code = ord($char[0]);
if ($code < 128) {
return $code;
} elseif ($code < 224) {
return (($code - 192) * 64) + (ord($char[1]) - 128);
} elseif ($code < 240) {
return (($code - 224) * 4096) + ((ord($char[1]) - 128) * 64) + (ord($char[2]) - 128);
}
return (($code - 240) * 262144) + ((ord($char[1]) - 128) * 4096) + ((ord($char[2]) - 128) * 64) + (ord($char[3]) - 128);
}
/**
* Convert a code point to its single or multi-byte character
*
* @param integer $code
*
* @return string
*/
protected function _codePointToChar($code)
{
if ($code <= 0x7F) {
return chr($code);
} elseif ($code <= 0x7FF) {
return chr(($code >> 6) + 192) . chr(($code & 63) + 128);
} elseif ($code <= 0xFFFF) {
return chr(($code >> 12) + 224) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128);
}
return chr(($code >> 18) + 240) . chr((($code >> 12) & 63) + 128) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128);
}
}
Horde_Idna-1.1.1/lib/Horde/Idna/Translation.php 0000664 0001750 0001750 00000001747 13122746314 017317 0 ustar jan jan
* @category Horde
* @license http://www.horde.org/licenses/bsd BSD
* @package Idna
*/
/**
* Horde_Idna_Translation is the translation wrapper class for
* Horde_Idna.
*
* @author Jan Schneider
* @category Horde
* @copyright 2017 Horde LLC
* @license http://www.horde.org/licenses/bsd BSD
* @package Idna
* @since Horde_Idna 1.1.0
*/
class Horde_Idna_Translation extends Horde_Translation_Autodetect
{
/**
* The translation domain
*
* @var string
*/
protected static $_domain = 'Horde_Idna';
/**
* The absolute PEAR path to the translations for the default gettext handler.
*
* @var string
*/
protected static $_pearDirectory = '@data_dir@';
}
Horde_Idna-1.1.1/lib/Horde/Idna.php 0000664 0001750 0001750 00000012673 13122746314 015021 0 ustar jan jan
* @category Horde
* @license http://www.horde.org/licenses/bsd BSD
* @package Idna
*/
/**
* Provide normalized encoding/decoding support for IDNA strings.
*
* @author Michael Slusarz
* @category Horde
* @copyright 2014-2017 Horde LLC
* @license http://www.horde.org/licenses/bsd BSD
* @package Idna
*/
class Horde_Idna
{
/**
* The backend to use.
*
* @var mixed
*/
protected static $_backend;
/**
* @throws Horde_Idna_Exception
*/
public static function encode($data)
{
switch ($backend = static::_getBackend()) {
case 'INTL':
return idn_to_ascii($data);
case 'INTL_UTS46':
$result = idn_to_ascii($data, 0, INTL_IDNA_VARIANT_UTS46, $info);
self::_checkForError($info);
return $result;
default:
return $backend->encode($data);
}
}
/**
* @throws Horde_Idna_Exception
*/
public static function decode($data)
{
switch ($backend = static::_getBackend()) {
case 'INTL':
case 'INTL_UTS46':
$parts = explode('.', $data);
foreach ($parts as &$part) {
if (strpos($part, 'xn--') === 0) {
switch ($backend) {
case 'INTL':
$part = idn_to_utf8($part);
break;
case 'INTL_UTS46':
$part = idn_to_utf8($part, 0, INTL_IDNA_VARIANT_UTS46, $info);
self::_checkForError($info);
break;
}
}
}
return implode('.', $parts);
default:
return $backend->decode($data);
}
}
/**
* Checks if the $idna_info parameter of idn_to_ascii() or idn_to_utf8()
* contains errors.
*
* @param array $info Fourth parameter to idn_to_ascii() or idn_to_utf8().
*
* @throws Horde_Idna_Exception
*/
protected static function _checkForError($info)
{
switch (true) {
case $info['errors'] & IDNA_ERROR_EMPTY_LABEL:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Domain name is empty"
));
case $info['errors'] & IDNA_ERROR_LABEL_TOO_LONG:
case $info['errors'] & IDNA_ERROR_DOMAIN_NAME_TOO_LONG:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Domain name is too long"
));
case $info['errors'] & IDNA_ERROR_LEADING_HYPHEN:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Starts with a hyphen"
));
case $info['errors'] & IDNA_ERROR_TRAILING_HYPHEN:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Ends with a hyphen"
));
case $info['errors'] & IDNA_ERROR_HYPHEN_3_4:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Contains hyphen in the third and fourth positions"
));
case $info['errors'] & IDNA_ERROR_LEADING_COMBINING_MARK:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Starts with a combining mark"
));
case $info['errors'] & IDNA_ERROR_DISALLOWED:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Contains disallowed characters"
));
case $info['errors'] & IDNA_ERROR_PUNYCODE:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Starts with \"xn--\" but does not contain valid Punycode"
));
case $info['errors'] & IDNA_ERROR_LABEL_HAS_DOT:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Contains a dot"
));
case $info['errors'] & IDNA_ERROR_INVALID_ACE_LABEL:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"ACE label does not contain a valid label string"
));
case $info['errors'] & IDNA_ERROR_BIDI:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Does not meet the IDNA BiDi requirements (for right-to-left characters)"
));
case $info['errors'] & IDNA_ERROR_CONTEXTJ:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Does not meet the IDNA CONTEXTJ requirements"
));
case $info['errors']:
throw new Horde_Idna_Exception(Horde_Idna_Translation::t(
"Unknown error"
));
}
}
/**
* Return the IDNA backend.
*
* @return mixed IDNA backend (false if none available).
*/
protected static function _getBackend()
{
if (!isset(self::$_backend)) {
if (extension_loaded('intl')) {
/* Only available in PHP > 5.4.0 */
self::$_backend = defined('INTL_IDNA_VARIANT_UTS46')
? 'INTL_UTS46'
: 'INTL';
} else {
self::$_backend = new Horde_Idna_Punycode();
}
}
return self::$_backend;
}
}
Horde_Idna-1.1.1/locale/de/LC_MESSAGES/Horde_Idna.mo 0000664 0001750 0001750 00000003155 13122746314 017566 0 ustar jan jan H / I y 1 G , ! N c { 6
y - 6 M 0 c : % < Z
ACE label does not contain a valid label string Contains a dot Contains disallowed characters Contains hyphen in the third and fourth positions Does not meet the IDNA BiDi requirements (for right-to-left characters) Does not meet the IDNA CONTEXTJ requirements Domain name is empty Domain name is too long Ends with a hyphen Starts with "xn--" but does not contain valid Punycode Starts with a combining mark Starts with a hyphen Unknown error Project-Id-Version: Horde_Idna
Report-Msgid-Bugs-To: dev@lists.horde.org
POT-Creation-Date: 2017-01-24 11:25+0100
PO-Revision-Date: 2017-01-24 11:33+0100
Last-Translator: Automatically generated
Language-Team: i18n@lists.horde.org
Language: de
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Plural-Forms: nplurals=2; plural=(n != 1);
ACE-Label enthält keinen gültigen Labeltext Enthält einen Punkt Enthält ungültige Zeichen Enthält Bindestrich an der dritten und vierten Stelle Entspricht nicht den IDNA-BiDi-Anforderungen (für rechts-nach-links Zeichen) Entspricht nicht den IDNA-CONTEXTJ-Anforderungen Domainname ist leer Domainname ist zu lang Endet mit einem Bindestrich Beginnt mit "xn--" aber enthält keinen gültigen Punycode Beginnt mit einem Kombinationszeichen Beginnt mit einem Bindestrich Unbekannter Fehler Horde_Idna-1.1.1/locale/de/LC_MESSAGES/Horde_Idna.po 0000664 0001750 0001750 00000004163 13122746314 017571 0 ustar jan jan # German translations for Horde_Idna package.
# Copyright (C) 2017 Horde LLC (http://www.horde.org/)
# This file is distributed under the same license as the Horde_Idna package.
# Jan Schneider , 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: Horde_Idna\n"
"Report-Msgid-Bugs-To: dev@lists.horde.org\n"
"POT-Creation-Date: 2017-01-24 11:25+0100\n"
"PO-Revision-Date: 2017-01-24 11:33+0100\n"
"Last-Translator: Automatically generated\n"
"Language-Team: i18n@lists.horde.org\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: lib/Horde/Idna.php:83
msgid "ACE label does not contain a valid label string"
msgstr "ACE-Label enthält keinen gültigen Labeltext"
#: lib/Horde/Idna.php:79
msgid "Contains a dot"
msgstr "Enthält einen Punkt"
#: lib/Horde/Idna.php:71
msgid "Contains disallowed characters"
msgstr "Enthält ungültige Zeichen"
#: lib/Horde/Idna.php:63
msgid "Contains hyphen in the third and fourth positions"
msgstr "Enthält Bindestrich an der dritten und vierten Stelle"
#: lib/Horde/Idna.php:87
msgid "Does not meet the IDNA BiDi requirements (for right-to-left characters)"
msgstr ""
"Entspricht nicht den IDNA-BiDi-Anforderungen (für rechts-nach-links Zeichen)"
#: lib/Horde/Idna.php:91
msgid "Does not meet the IDNA CONTEXTJ requirements"
msgstr "Entspricht nicht den IDNA-CONTEXTJ-Anforderungen"
#: lib/Horde/Idna.php:46
msgid "Domain name is empty"
msgstr "Domainname ist leer"
#: lib/Horde/Idna.php:51
msgid "Domain name is too long"
msgstr "Domainname ist zu lang"
#: lib/Horde/Idna.php:59
msgid "Ends with a hyphen"
msgstr "Endet mit einem Bindestrich"
#: lib/Horde/Idna.php:75
msgid "Starts with \"xn--\" but does not contain valid Punycode"
msgstr "Beginnt mit \"xn--\" aber enthält keinen gültigen Punycode"
#: lib/Horde/Idna.php:67
msgid "Starts with a combining mark"
msgstr "Beginnt mit einem Kombinationszeichen"
#: lib/Horde/Idna.php:55
msgid "Starts with a hyphen"
msgstr "Beginnt mit einem Bindestrich"
#: lib/Horde/Idna.php:95
msgid "Unknown error"
msgstr "Unbekannter Fehler"
Horde_Idna-1.1.1/locale/tr/LC_MESSAGES/Horde_Idna.mo 0000664 0001750 0001750 00000003142 13122746314 017617 0 ustar jan jan H / I y 1 G , ! N c { 6
1 &