diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-28 14:25:27 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-28 14:25:27 +0000 |
commit | 9fe114978201e2f306a524f4d7382f951f088a2b (patch) | |
tree | 60535537ff36c9f26acc41cfa7ccc152215561cd /engine | |
parent | 60d3843934d6b3388d03f2358b23e9cefa97f4a2 (diff) | |
download | elgg-9fe114978201e2f306a524f4d7382f951f088a2b.tar.gz elgg-9fe114978201e2f306a524f4d7382f951f088a2b.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* Moved XML serialisation functions to export.php
git-svn-id: https://code.elgg.org/elgg/trunk@279 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/api.php | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/engine/lib/api.php b/engine/lib/api.php index 9e2ec6301..d04a7029b 100644 --- a/engine/lib/api.php +++ b/engine/lib/api.php @@ -736,83 +736,6 @@ return false; } - // XML functions ////////////////////////////////////////////////////////////////////////// - - /** - * This function serialises an object recursively into an XML representation. - * @param $data object The object to serialise. - * @param $n int Level, only used for recursion. - * @return string The serialised XML output. - */ - function serialise_object_to_xml($data, $name = "", $n = 0) - { - $classname = ($name=="" ? get_class($data) : $name); - - $vars = get_object_vars($data); - - $output = ""; - - if ($n==0) $output = "<$classname>"; - - foreach ($vars as $key => $value) - { - $output .= "<$key type=\"".gettype($value)."\">"; - - if (is_object($value)) - $output .= serialise_object_to_xml($value, $key, $n+1); - else if (is_array($value)) - $output .= serialise_array_to_xml($value, $n+1); - else - $output .= htmlentities($value); - - $output .= "</$key>\n"; - } - - if ($n==0) $output .= "</$classname>\n"; - - return $output; - } - - /** - * Serialise an array. - * - * @param array $data - * @param int $n Used for recursion - * @return string - */ - function serialise_array_to_xml(array $data, $n = 0) - { - $output = ""; - - if ($n==0) $output = "<array>\n"; - - foreach ($data as $key => $value) - { - $item = "array_item"; - - if (is_numeric($key)) - $output .= "<$item name=\"$key\" type=\"".gettype($value)."\">"; - else - { - $item = $key; - $output .= "<$item type=\"".gettype($value)."\">"; - } - - if (is_object($value)) - $output .= serialise_object_to_xml($value, $item, $n+1); - else if (is_array($value)) - $output .= serialise_array_to_xml($value, $n+1); - else - $output .= htmlentities($value); - - $output .= "</$item>\n"; - } - - if ($n==0) $output = "</array>\n"; - - return $output; - } - // Output functions /////////////////////////////////////////////////////////////////////// $API_OUTPUT_FUNCTIONS = array(); |