Skip to content

Commit

Permalink
Merge pull request #23 from jimwins/master
Browse files Browse the repository at this point in the history
Fix very deprecated {} string references
  • Loading branch information
davydovct authored Jan 17, 2020
2 parents a14d7d1 + c828512 commit b951451
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions lib/cleantalk-php-patch.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ function utf8_decode($string){
$offset = 0;
$stringlength = strlen($string);
while ($offset < $stringlength) {
if ((ord($string{$offset}) | 0x07) == 0xF7) {
$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
((ord($string{($offset + 1)}) & 0x3F) << 12) &
((ord($string{($offset + 2)}) & 0x3F) << 6) &
(ord($string{($offset + 3)}) & 0x3F);
if ((ord($string[$offset]) | 0x07) == 0xF7) {
$charval = ((ord($string[($offset + 0)]) & 0x07) << 18) &
((ord($string[($offset + 1)]) & 0x3F) << 12) &
((ord($string[($offset + 2)]) & 0x3F) << 6) &
(ord($string[($offset + 3)]) & 0x3F);
$offset += 4;
} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
((ord($string{($offset + 1)}) & 0x3F) << 6) &
(ord($string{($offset + 2)}) & 0x3F);
} elseif ((ord($string[$offset]) | 0x0F) == 0xEF) {
$charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) &
((ord($string[($offset + 1)]) & 0x3F) << 6) &
(ord($string[($offset + 2)]) & 0x3F);
$offset += 3;
} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
$charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
(ord($string{($offset + 1)}) & 0x3F);
} elseif ((ord($string[$offset]) | 0x1F) == 0xDF) {
$charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) &
(ord($string[($offset + 1)]) & 0x3F);
$offset += 2;
} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
$charval = ord($string{$offset});
} elseif ((ord($string[$offset]) | 0x7F) == 0x7F) {
$charval = ord($string[$offset]);
$offset += 1;
} else {
$charval = false;
Expand All @@ -77,4 +77,4 @@ function utf8_decode($string){
}
return $newcharstring;
}
}
}

0 comments on commit b951451

Please sign in to comment.