diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-04-07 20:09:36 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-04-07 20:09:36 +0000 |
commit | 7d3d5532dfb93d1ed9e04b64e2576312591f1f28 (patch) | |
tree | 17e7eba2d9f4256ae1dfa278fdce1202250fd046 | |
parent | 6ba8f32ccab1c50ca1ef9365fb795597f4f3878d (diff) | |
download | brdo-7d3d5532dfb93d1ed9e04b64e2576312591f1f28.tar.gz brdo-7d3d5532dfb93d1ed9e04b64e2576312591f1f28.tar.bz2 |
- Fixed warning.
-rw-r--r-- | modules/taxonomy.module | 22 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 22 |
2 files changed, 24 insertions, 20 deletions
diff --git a/modules/taxonomy.module b/modules/taxonomy.module index 150796ff3..d6212fcec 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -624,16 +624,18 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) { } $max_depth = (is_null($max_depth)) ? count($children[$vid]) : $max_depth; - foreach ($children[$vid][$parent] as $child) { - if ($max_depth > $depth) { - $terms[$vid][$child]->depth = $depth; - // The "parent" attribute is not useful, as it would show one parent only. - unset($terms[$vid][$child]->parent); - $terms[$vid][$child]->parents = $parents[$vid][$child]; - $tree[] = $terms[$vid][$child]; - - if ($children[$vid][$child]) { - $tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth)); + if ($children[$vid][$parent]) { + foreach ($children[$vid][$parent] as $child) { + if ($max_depth > $depth) { + $terms[$vid][$child]->depth = $depth; + // The "parent" attribute is not useful, as it would show one parent only. + unset($terms[$vid][$child]->parent); + $terms[$vid][$child]->parents = $parents[$vid][$child]; + $tree[] = $terms[$vid][$child]; + + if ($children[$vid][$child]) { + $tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth)); + } } } } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 150796ff3..d6212fcec 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -624,16 +624,18 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) { } $max_depth = (is_null($max_depth)) ? count($children[$vid]) : $max_depth; - foreach ($children[$vid][$parent] as $child) { - if ($max_depth > $depth) { - $terms[$vid][$child]->depth = $depth; - // The "parent" attribute is not useful, as it would show one parent only. - unset($terms[$vid][$child]->parent); - $terms[$vid][$child]->parents = $parents[$vid][$child]; - $tree[] = $terms[$vid][$child]; - - if ($children[$vid][$child]) { - $tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth)); + if ($children[$vid][$parent]) { + foreach ($children[$vid][$parent] as $child) { + if ($max_depth > $depth) { + $terms[$vid][$child]->depth = $depth; + // The "parent" attribute is not useful, as it would show one parent only. + unset($terms[$vid][$child]->parent); + $terms[$vid][$child]->parents = $parents[$vid][$child]; + $tree[] = $terms[$vid][$child]; + + if ($children[$vid][$child]) { + $tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth)); + } } } } |