From ba21f4e5cfc0ba86f6887a89dfd1df9dcf737e36 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Tue, 16 Jul 2019 16:16:05 +0900 Subject: [PATCH] Update catsplit.format.php --- helper/catsplit.format.php | 47 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/helper/catsplit.format.php b/helper/catsplit.format.php index 7bc9e2e..03b077d 100644 --- a/helper/catsplit.format.php +++ b/helper/catsplit.format.php @@ -8,15 +8,15 @@ */ if(!check_function_exists("catsplit_unescape")) { - function catsplit_unescape($data) { - return trim($data); - } + function catsplit_unescape($data) { + return trim($data); + } } if(!check_function_exists("casplit_escape")) { - function casplit_escape($data) { - return htmlspecialchars($data); - } + function casplit_escape($data) { + return htmlspecialchars($data); + } } if(!check_function_exists("catsplit_encode")) { @@ -27,31 +27,32 @@ if(!check_function_exists("catsplit_encode")) { $_ks[] = $k; $_vs[] = make_safe_argument($v); } - $_ks = array_map("casplit_escape", $_ks); - $_vs = array_map("casplit_escape", $_vs); + $_ks = array_map("casplit_escape", $_ks); + $_vs = array_map("casplit_escape", $_vs); + return sprintf("('%s')<=(%s)", implode("','", $_vs), implode(",", $_ks)); } } if(!check_function_exists("catsplit_decode")) { - function catsplit_decode($data) { - $s_final = array(); + function catsplit_decode($data) { + $s_final = array(); - // step 1 - $s1 = explode(")<=(", substr($data, 1, -1)); + // step 1 + $s1 = explode(")<=(", substr($data, 1, -1)); - // step 2 - $s2a = array_map("catsplit_unescape", explode(",", $s1[0])); - $s2b = array_map("catsplit_unescape", explode(",", $s1[1])); + // step 2 + $s2a = array_map("catsplit_unescape", explode(",", $s1[0])); + $s2b = array_map("catsplit_unescape", explode(",", $s1[1])); - // step 3 - $s3 = array_combine($s2b, $s2a); + // step 3 + $s3 = array_combine($s2b, $s2a); - // step 4 - foreach($s3 as $k=>$v) { - $s_final[$k] = substr(stripslashes($v), 1, -1); - } + // step 4 + foreach($s3 as $k=>$v) { + $s_final[$k] = substr(stripslashes($v), 1, -1); + } - return $s_final; - } + return $s_final; + } }