From a93ea924a091ca35f6330c6ee157daf00d075ba6 Mon Sep 17 00:00:00 2001 From: dhawes Date: Sun, 26 Sep 2004 04:49:39 +0000 Subject: [PATCH] Converted comments to phpdoc style comments --- lib/xmlize.php | 84 +++++++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 35 deletions(-) diff --git a/lib/xmlize.php b/lib/xmlize.php index 3b2c570fcd..59e0c33c56 100644 --- a/lib/xmlize.php +++ b/lib/xmlize.php @@ -1,6 +1,7 @@ + * + * $xml = xmlize($array); + * + * See the function {@link traverse_xmlize()} for information about the * structure of the array, it's much easier to explain by showing you. * Be aware that the array is somewhat tricky. I use xmlize all the time, - * but still need to use traverse_xmlize quite often to show me the structure! - - ## THIS IS A PHP 5 VERSION: - - > attached is the modified script. Basically it has a new optional parameter - > to specify an OUTPUT encoding. If not specified, it defaults to UTF-8. - > I recommend you to read this PHP bug. There you can see how PHP4, PHP5.0.0 - > and PHP5.0.2 will handle this. - > http://bugs.php.net/bug.php?id=29711 - > Ciao, Eloy :-) - ## + * but still need to use {@link traverse_xmlize()} quite often to show me the structure! * + * THIS IS A PHP 5 VERSION: + * + * This modified version basically has a new optional parameter + * to specify an OUTPUT encoding. If not specified, it defaults to UTF-8. + * I recommend you to read this PHP bug. There you can see how PHP4, PHP5.0.0 + * and PHP5.0.2 will handle this. + * {@link http://bugs.php.net/bug.php?id=29711} + * Ciao, Eloy :-) + * + * + * @author Hans Anderson + * @param array $data The array to be converted + * @param int $WHITE If set to 1 allows the parser to skip "space" characters in xml document. Default is 0 + * @param string $encoding Specify an OUTPUT encoding. If not specified, it defaults to UTF-8. + * @return array */ - function xmlize($data, $WHITE=1, $encoding='UTF-8') { $data = trim($data); @@ -56,15 +69,11 @@ function xmlize($data, $WHITE=1, $encoding='UTF-8') { return $array; } -/* - * - * You don't need to do anything with this function, it's called by - * xmlize. It's a recursive function, calling itself as it goes deeper +/** + * @internal You don't need to do anything with this function, it's called by + * xmlize. It's a recursive function, calling itself as it goes deeper * into the xml levels. If you make any improvements, please let me know. - * - * */ - function xml_depth($vals, &$i) { $children = array(); @@ -144,24 +153,29 @@ function xml_depth($vals, &$i) { } -/* function by acebone@f2s.com, a HUGE help! +/** + * This helps you understand the structure of the array {@link xmlize()} outputs * - * this helps you understand the structure of the array xmlize() outputs - * - * usage: + * Function by acebone@f2s.com, a HUGE help!
+ * Usage:
+ * * traverse_xmlize($xml, 'xml_'); * print '
' . implode("", $traverse_array . '
'; - * - * + *
+ * @author acebone@f2s.com + * @param array $array ? + * @param string $arrName ? + * @param int $level ? + * @return int + * @todo Finish documenting this function */ - -function traverse_xmlize($array, $arrName = "array", $level = 0) { +function traverse_xmlize($array, $arrName = 'array', $level = 0) { foreach($array as $key=>$val) { if ( is_array($val) ) { - traverse_xmlize($val, $arrName . "[" . $key . "]", $level + 1); + traverse_xmlize($val, $arrName . '[' . $key . ']', $level + 1); } else { $GLOBALS['traverse_array'][] = '$' . $arrName . '[' . $key . '] = "' . $val . "\"\n"; } @@ -171,4 +185,4 @@ function traverse_xmlize($array, $arrName = "array", $level = 0) { } -?> +?> \ No newline at end of file -- 2.39.5