File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
- header ('content-type: application/json ' );
2
+ header ('content-type: application/json; charset=utf-8 ' );
3
3
//Sharrre by Julien Hany
4
4
$ json = array ('url ' =>'' ,'count ' =>0 );
5
5
$ json ['url ' ] = $ _GET ['url ' ];
27
27
28
28
}
29
29
}
30
- echo str_replace ('\\/ ' ,'/ ' ,json_encode ($ json ));
30
+
31
+ if (isset ($ _GET ['callback ' ]) && is_valid_callback ($ _GET ['callback ' ])){
32
+ echo $ _GET ['callback ' ] . '( ' .str_replace ('\\/ ' ,'/ ' ,json_encode ($ json )).') ' ;
33
+ }else {
34
+ echo str_replace ('\\/ ' ,'/ ' ,json_encode ($ json ));
35
+ }
36
+
37
+ function is_valid_callback ($ subject )
38
+ {
39
+ $ identifier_syntax = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}\.]*+$/u ' ;
40
+
41
+ return preg_match ($ identifier_syntax , $ subject );
42
+ }
31
43
32
44
function parse ($ encUrl ){
33
45
$ options = array (
You can’t perform that action at this time.
0 commit comments