Skip to content
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.idea/
/vendor
boilerplate/bower_components
.DS_Store
4 changes: 2 additions & 2 deletions src/LZCompressor/LZString.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static function compressToEncodedURIComponent($input)
$input,
6,
function($a) {
return LZUtil::$keyStrUriSafe{$a};
return LZUtil::$keyStrUriSafe[$a];
}
);
}
Expand Down Expand Up @@ -57,7 +57,7 @@ function($data) {
public static function compressToBase64($input)
{
$res = self::_compress($input, 6, function($a) {
return LZUtil::$keyStrBase64{$a};
return LZUtil::$keyStrBase64[$a];
});
switch (strlen($res) % 4) { // To produce valid Base64
default: // When could this happen ?
Expand Down
10 changes: 5 additions & 5 deletions src/LZCompressor/LZUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function getBaseValue($alphabet, $character)
if(!array_key_exists($alphabet, self::$baseReverseDic)) {
self::$baseReverseDic[$alphabet] = array();
for($i=0; $i<strlen($alphabet); $i++) {
self::$baseReverseDic[$alphabet][$alphabet{$i}] = $i;
self::$baseReverseDic[$alphabet][$alphabet[$i]] = $i;
}
}
return self::$baseReverseDic[$alphabet][$character];
Expand Down Expand Up @@ -79,13 +79,13 @@ public static function utf8_ord($ch)
if ($len <= 0) {
return -1;
}
$h = ord($ch{0});
$h = ord($ch[0]);
if ($h <= 0x7F) return $h;
if ($h < 0xC2) return -3;
if ($h <= 0xDF && $len > 1) return ($h & 0x1F) << 6 | (ord($ch{1}) & 0x3F);
if ($h <= 0xEF && $len > 2) return ($h & 0x0F) << 12 | (ord($ch{1}) & 0x3F) << 6 | (ord($ch{2}) & 0x3F);
if ($h <= 0xDF && $len > 1) return ($h & 0x1F) << 6 | (ord($ch[1]) & 0x3F);
if ($h <= 0xEF && $len > 2) return ($h & 0x0F) << 12 | (ord($ch[1]) & 0x3F) << 6 | (ord($ch[2]) & 0x3F);
if ($h <= 0xF4 && $len > 3)
return ($h & 0x0F) << 18 | (ord($ch{1}) & 0x3F) << 12 | (ord($ch{2}) & 0x3F) << 6 | (ord($ch{3}) & 0x3F);
return ($h & 0x0F) << 18 | (ord($ch[1]) & 0x3F) << 12 | (ord($ch[2]) & 0x3F) << 6 | (ord($ch[3]) & 0x3F);
return -2;
}

Expand Down