From: garvinhicking Date: Sat, 9 Jul 2005 09:38:41 +0000 (+0000) Subject: hooray for debug X-Git-Tag: 0.9~326 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1f2c4706b88c1d5f65fa3430043987a91a44079f;p=s9y.git hooray for debug --- diff --git a/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php b/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php index aa23f08..47120c5 100644 --- a/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php +++ b/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php @@ -429,6 +429,8 @@ class serendipity_event_spartacus extends serendipity_event $pluginstack = array(); $i = 0; + $this->checkArray($tree); + foreach($tree[0]['children'] AS $idx => $subtree) { if ($subtree['tag'] == 'package') { $i++; @@ -489,6 +491,12 @@ class serendipity_event_spartacus extends serendipity_event return $pluginstack; } + function checkArray(&$tree) { + if (!is_array($tree) || !is_array($tree[0]['children'])) { + echo "DEBUG: Tree not an array, but: " . print_r($tree, true) . ". Please report this bug. This might be an error with the downloaded XML file. You can try to go to the plugin configuration of the Spartacus Plugin and simply click on 'Save' - this will purge all cached XML files and try to download it again.
\n"; + } + } + function &buildTemplateList(&$tree) { $pluginstack = array(); $i = 0; @@ -496,9 +504,7 @@ class serendipity_event_spartacus extends serendipity_event $mirrors = $this->getMirrors('files', true); $mirror = $mirrors[$this->get_config('mirror_files', 0)]; - if (!is_array($tree) || !is_array($tree[0]['children'])) { - echo "DEBUG: Tree not an array, but: " . print_r($tree, true) . ". Please report this bug.
\n"; - } + $this->checkArray($tree); foreach($tree[0]['children'] AS $idx => $subtree) { if ($subtree['tag'] == 'package') { @@ -588,6 +594,9 @@ class serendipity_event_spartacus extends serendipity_event $files = array(); $found = false; + + $this->checkArray($tree); + foreach($tree[0]['children'] AS $idx => $subtree) { if ($subtree['tag'] != 'package') { continue;