REDROOM
PHP 8.1.33
Path:
Logout
Edit File
Size: 1.94 KB
Close
/home/jambtst2015/public_html/ida.com.ng/libraries/vendor/algo26-matthias/idna-convert/src/ToIdn.php
Text
Base64
<?php namespace Algo26\IdnaConvert; use Algo26\IdnaConvert\Exception\InvalidCharacterException; use Algo26\IdnaConvert\Exception\InvalidIdnVersionException; use Algo26\IdnaConvert\Punycode\ToPunycode; use Algo26\IdnaConvert\TranscodeUnicode\TranscodeUnicode; class ToIdn extends AbstractIdnaConvert implements IdnaConvertInterface { /** @var TranscodeUnicode */ private $unicodeTransCoder; /** @var ToPunycode */ private $punycodeEncoder; /** * @throws InvalidIdnVersionException */ public function __construct($idnVersion = null) { $this->unicodeTransCoder = new TranscodeUnicode(); $this->punycodeEncoder = new ToPunycode($idnVersion); } /** * @param string $host * * @return string * @throws InvalidCharacterException * @throws Exception\AlreadyPunycodeException */ public function convert(string $host): string { if (strlen($host) === 0) { return $host; } if (strpos('/', $host) !== false || strpos(':', $host) !== false || strpos('?', $host) !== false || strpos('@', $host) !== false ) { throw new InvalidCharacterException('Neither email addresses nor URLs are allowed', 205); } // These three punctuation characters are treated like the dot $host = str_replace(['。', '.', '。'], '.', $host); // Operate per label $hostLabels = explode('.', $host); foreach ($hostLabels as $index => $label) { $asUcs4Array = $this->unicodeTransCoder->convert( $label, $this->unicodeTransCoder::FORMAT_UTF8, $this->unicodeTransCoder::FORMAT_UCS4_ARRAY ); $encoded = $this->punycodeEncoder->convert($asUcs4Array); if ($encoded) { $hostLabels[$index] = $encoded; } } return implode('.', $hostLabels); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 5 × Files: 4
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
EncodingHelper
DIR
-
drwxr-xr-x
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Exception
DIR
-
drwxr-xr-x
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
NamePrep
DIR
-
drwxr-xr-x
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Punycode
DIR
-
drwxr-xr-x
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TranscodeUnicode
DIR
-
drwxr-xr-x
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
AbstractIdnaConvert.php
1.18 KB
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
IdnaConvertInterface.php
249 B
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ToIdn.php
1.94 KB
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ToUnicode.php
969 B
lrw-r--r--
2024-11-22 17:53:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).