function dumprow($fp, $tag, $row) { fwrite($fp, " <row>\n"); foreach ($row as $key => $value) { fwrite($fp, sprintf(" <%s>%s</%s>\n", $key, encode_value($value), $key)); } fwrite($fp, " </row>\n"); }
function url_for_graph($type, $attributes) { if (!empty($attributes)) { $values = array(); foreach ($attributes as $attribute => $value) { $values[] = sprintf('%s=%s', $attribute, encode_value($value)); } $attributes_str = '?' . implode('&', $values); } else { $attributes_str = null; } return url_for(sprintf('graph/%s%s', $type, $attributes_str)); }