Permalink
Browse files

Adds a new parameter in data_encoding_properties, in data library.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Oct 29, 2018
1 parent feeadaa commit 30744d0cae6340d28c259b8f49c7e6bdf8f5eef2
Showing with 10 additions and 9 deletions.
  1. +10 −9 engine/lib/tool/data.php.inc
@@ -4,11 +4,11 @@
* @details Engine / Tool Library
* @file engine/lib/tool/data.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.1
* @version 1.0.2
* @date Creation: Jul 2005
* @date Modification: Apr 2018
* @date Modification: Oct 2018
* @copyright 2005 - 2018 CaMykS Team
* @note This program is distributed as is - WITHOUT ANY WARRANTY;
* @note This program is distributed as is - WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
@@ -18,14 +18,15 @@
* @param string $separator
* @return string
*/
function data_encode_properties($properties, $separator='"') {
if (!is_array($properties) or count($properties) == 0)
function data_encode_properties($properties, $separator='"', $disableEmpty=false) {
if (!is_array($properties) or count($properties) == 0)
return '';
$data = array();
foreach ($properties as $p_name => $p_value) {
$data[] = $p_name;
$data[] = addSlashes($p_value);
if ($p_value != '' or $disableEmpty == false)
$data[] = addSlashes($p_value);
}
$data = implode($separator, $data);
return $data;
@@ -44,7 +45,7 @@ function data_decode_properties($data, $separator='"') {
$t = explode($separator, $data);
for ($i=0; $i < count($t); $i+=2) {
$properties[$t[$i]] = (isset($t[$i+1]) ? stripslashes($t[$i+1]) : '');
}
}
return $properties;
}
@@ -116,4 +117,4 @@ function data_serializeArray($data) {
function data_unserialize($data) {
return eval ($data);
}
?>
?>

0 comments on commit 30744d0

Please sign in to comment.