Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

20 changes: 10 additions & 10 deletions Urlizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ public static function utf8ToAscii($str, $unknown = '?')

foreach ($chars as $i => $c) {
$ud = 0;
if (ord($c{0})>=0 && ord($c{0})<=127) { continue; } // ASCII - next please
if (ord($c{0})>=192 && ord($c{0})<=223) { $ord = (ord($c{0})-192)*64 + (ord($c{1})-128); }
if (ord($c{0})>=224 && ord($c{0})<=239) { $ord = (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128); }
if (ord($c{0})>=240 && ord($c{0})<=247) { $ord = (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128); }
if (ord($c{0})>=248 && ord($c{0})<=251) { $ord = (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128); }
if (ord($c{0})>=252 && ord($c{0})<=253) { $ord = (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128); }
if (ord($c{0})>=254 && ord($c{0})<=255) { $chars{$i} = $unknown; continue; } //error
if (ord($c[0])>=0 && ord($c[0])<=127) { continue; } // ASCII - next please
if (ord($c[0])>=192 && ord($c[0])<=223) { $ord = (ord($c[0])-192)*64 + (ord($c[1])-128); }
if (ord($c[0])>=224 && ord($c[0])<=239) { $ord = (ord($c[0])-224)*4096 + (ord($c[1])-128)*64 + (ord($c[2])-128); }
if (ord($c[0])>=240 && ord($c[0])<=247) { $ord = (ord($c[0])-240)*262144 + (ord($c[1])-128)*4096 + (ord($c[2])-128)*64 + (ord($c[3])-128); }
if (ord($c[0])>=248 && ord($c[0])<=251) { $ord = (ord($c[0])-248)*16777216 + (ord($c[1])-128)*262144 + (ord($c[2])-128)*4096 + (ord($c[3])-128)*64 + (ord($c[4])-128); }
if (ord($c[0])>=252 && ord($c[0])<=253) { $ord = (ord($c[0])-252)*1073741824 + (ord($c[1])-128)*16777216 + (ord($c[2])-128)*262144 + (ord($c[3])-128)*4096 + (ord($c[4])-128)*64 + (ord($c[5])-128); }
if (ord($c[0])>=254 && ord($c[0])<=255) { $chars[$i] = $unknown; continue; } //error

$bank = $ord >> 8;

Expand All @@ -242,9 +242,9 @@ public static function utf8ToAscii($str, $unknown = '?')

$newchar = $ord & 255;
if (array_key_exists($newchar, $UTF8_TO_ASCII[$bank])) {
$chars{$i} = $UTF8_TO_ASCII[$bank][$newchar];
$chars[$i] = $UTF8_TO_ASCII[$bank][$newchar];
} else {
$chars{$i} = $unknown;
$chars[$i] = $unknown;
}
}

Expand Down Expand Up @@ -297,7 +297,7 @@ public static function validUtf8($str)

$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
$in = ord($str{$i});
$in = ord($str[$i]);
if ($mState == 0) {
// When mState is zero we expect either a US-ASCII character or a
// multi-octet sequence.
Expand Down