This repository has been archived by the owner on Nov 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b64b3f
commit 10ed760
Showing
2 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* TLDExtract: Library for extraction of domain parts e.g. TLD. Domain parser that uses Public Suffix List. | ||
* | ||
* @link https://github.com/layershifter/TLDExtract | ||
* | ||
* @copyright Copyright (c) 2016, Alexander Fedyashov | ||
* @license https://raw.githubusercontent.com/layershifter/TLDExtract/master/LICENSE Apache 2.0 License | ||
*/ | ||
|
||
namespace | ||
{ | ||
use TrueBV\Punycode; | ||
|
||
if (!function_exists('idn_to_utf8')) { | ||
|
||
/** | ||
* Polyfill for idn_to_utf8. | ||
* | ||
* @link http://php.net/manual/de/function.idn-to-utf8.php | ||
* | ||
* @param $domain | ||
* | ||
* @return string | ||
*/ | ||
function idn_to_utf8($domain) | ||
{ | ||
$punyCode = new Punycode(); | ||
|
||
return $punyCode->encode($domain); | ||
} | ||
} | ||
|
||
if (!function_exists('idn_to_ascii')) { | ||
|
||
/** | ||
* Polyfill for idn_to_ascii. | ||
* | ||
* @link http://php.net/manual/de/function.idn-to-ascii.php | ||
* | ||
* @param string $domain | ||
* | ||
* @return string | ||
*/ | ||
function idn_to_ascii($domain) | ||
{ | ||
$punyCode = new Punycode(); | ||
|
||
return $punyCode->decode($domain); | ||
} | ||
} | ||
} |