]> git.mjollnir.org Git - s9y.git/commitdiff
hooray for debug
authorgarvinhicking <garvinhicking>
Sat, 9 Jul 2005 09:38:41 +0000 (09:38 +0000)
committergarvinhicking <garvinhicking>
Sat, 9 Jul 2005 09:38:41 +0000 (09:38 +0000)
plugins/serendipity_event_spartacus/serendipity_event_spartacus.php

index aa23f0856105e468319a561f7e710b2a70acb777..47120c5b60d459a03de61e85e269730b94a3c2be 100644 (file)
@@ -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.<br />\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.<br />\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;