function normalizeKS($value, $ks) { $ksObj = new ks(); if (!$ksObj->parseKS($ks)) { return $value; } $ksFields = array($ksObj->partner_id, $ksObj->partner_id, 0, $ksObj->type, 0, $ksObj->user, $ksObj->privileges, $ksObj->master_partner_id, $ksObj->additional_data); $ksFields = implode(';', $ksFields); return str_replace($ks, $ksFields, $value); }
/** * @param string $encoded_str * @return ks */ public static function fromSecureString($encoded_str) { if (empty($encoded_str)) { return null; } $ks = new ks(); if (!$ks->parseKS($encoded_str)) { throw new Exception(self::getErrorStr(self::INVALID_STR)); } $ks->valid_string = true; return $ks; }