File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
class LZString
5
5
{
6
+ /**
7
+ * Compress into a string that is already URI encoded
8
+ *
9
+ * @param string $input
10
+ *
11
+ * @return string
12
+ */
13
+ public static function compressToEncodedURIComponent ($ input )
14
+ {
15
+ if ($ input === null ) {
16
+ return "" ;
17
+ }
18
+ return self ::_compress (
19
+ $ input ,
20
+ 6 ,
21
+ function ($ a ) {
22
+ return LZUtil::$ keyStrUriSafe {$ a };
23
+ }
24
+ );
25
+ }
26
+
27
+ /**
28
+ * Decompress from an output of compressToEncodedURIComponent
29
+ *
30
+ * @param string $input
31
+ *
32
+ * @return null|string
33
+ */
34
+ public static function decompressFromEncodedURIComponent ($ input )
35
+ {
36
+ if ($ input === null ) {
37
+ return "" ;
38
+ }
39
+ if ($ input === "" ) {
40
+ return null ;
41
+ }
42
+
43
+ $ input = str_replace (' ' , "+ " , $ input );
44
+
45
+ return self ::_decompress (
46
+ $ input ,
47
+ 32 ,
48
+ function ($ feed , $ index ) {
49
+ return LZUtil::getBaseValue (
50
+ LZUtil::$ keyStrUriSafe ,
51
+ LZUtil::utf8_charAt ($ feed , $ index )
52
+ );
53
+ });
54
+ }
6
55
7
56
public static function compressToBase64 ($ input )
8
57
{
You can’t perform that action at this time.
0 commit comments