X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2FTree%2FNode.php;h=04668ba67a324124b161d9ca81ea8acedbef675c;hb=56aefc1ef7ef2d90499b174648625baa6ccb30b1;hp=65f1f1fdc3743c9f23c90a17415dd46d88ff9abb;hpb=55d2e17d82f3481135c7d438a1f90be6ac9394f8;p=diogenes.git diff --git a/include/Tree/Node.php b/include/Tree/Node.php index 65f1f1f..04668ba 100644 --- a/include/Tree/Node.php +++ b/include/Tree/Node.php @@ -18,6 +18,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +require_once 'diogenes/diogenes.misc.inc.php'; + define('NODE_DUMP_BINARY', 0); define('NODE_DUMP_TEXT', 1); define('NODE_DUMP_NOCHILDREN', 2); @@ -59,15 +61,18 @@ function var_encode_text($var, $level = 0, $no_children = FALSE, $tabstr = ' ', //$code = chop($code, ','); //remove unnecessary coma $code .= str_repeat($tabstr, $level) . ")"; return $code; - } elseif (is_string($var)) { + } elseif (is_scalar($var)) { return "'".$var."'"; - } elseif (is_bool($var)) { - return ($code ? 'TRUE' : 'FALSE'); } else { return 'NULL'; } } +function var_encode_html($var, $level = 0, $no_children = FALSE) +{ + return var_encode_text($var, $level, $no_children, '  ', $eol = "
\n"); +} + function var_encode_bin($var, $no_children = FALSE) { if (is_object($var) && (get_class($var) == 'Diogenes_Tree_Node')) { @@ -158,13 +163,6 @@ class Diogenes_Tree_Node $this->children = $children; } - /** Add a child for this node. - */ - function pushChild($node, $index) - { - array_push($this->children, $node); - } - /** Return the specified child of this node. */ function getChild($index)