Update catsplit.format.php
This commit is contained in:
parent
61876c7566
commit
f84f194709
|
@ -7,6 +7,18 @@
|
||||||
* @documentation https://github.com/gnh1201/catsplit-format
|
* @documentation https://github.com/gnh1201/catsplit-format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if(!check_function_exists("catsplit_unescape")) {
|
||||||
|
function catsplit_unescape($data) {
|
||||||
|
return trim($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!check_function_exists("casplit_escape")) {
|
||||||
|
function casplit_escape($data) {
|
||||||
|
return htmlspecialchars($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!check_function_exists("catsplit_encode")) {
|
if(!check_function_exists("catsplit_encode")) {
|
||||||
function catsplit_encode($data) {
|
function catsplit_encode($data) {
|
||||||
$_ks = array();
|
$_ks = array();
|
||||||
|
@ -15,6 +27,8 @@ if(!check_function_exists("catsplit_encode")) {
|
||||||
$_ks[] = $k;
|
$_ks[] = $k;
|
||||||
$_vs[] = make_safe_argument($v);
|
$_vs[] = make_safe_argument($v);
|
||||||
}
|
}
|
||||||
|
$_ks = array_map("casplit_escape", $_ks);
|
||||||
|
$_vs = array_map("casplit_escape", $_vs);
|
||||||
return sprintf("('%s')<=(%s)", implode("','", $_vs), implode(",", $_ks));
|
return sprintf("('%s')<=(%s)", implode("','", $_vs), implode(",", $_ks));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +41,8 @@ if(!check_function_exists("catsplit_decode")) {
|
||||||
$s1 = explode(")<=(", substr($data, 1, -1));
|
$s1 = explode(")<=(", substr($data, 1, -1));
|
||||||
|
|
||||||
// step 2
|
// step 2
|
||||||
$s2a = array_map("trim", explode(",", $s1[0]));
|
$s2a = array_map("catsplit_unescape", explode(",", $s1[0]));
|
||||||
$s2b = array_map("trim", explode(",", $s1[1]));
|
$s2b = array_map("catsplit_unescape", explode(",", $s1[1]));
|
||||||
|
|
||||||
// step 3
|
// step 3
|
||||||
$s3 = array_combine($s2b, $s2a);
|
$s3 = array_combine($s2b, $s2a);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user