twitter is so error prone, we might actually need error checking!
authorPenny Leach <penny@catalyst.net.nz>
Mon, 21 Jul 2008 16:19:02 +0000 (17:19 +0100)
committerPenny Leach <penny@catalyst.net.nz>
Mon, 21 Jul 2008 16:19:02 +0000 (17:19 +0100)
comp/twitter.php

index 63b7866dad607dc0255959d6f05537e9620178cf..1dccc4b5721280cfeb29851a07642a4171d44e4f 100644 (file)
@@ -4,8 +4,13 @@ function comp_twitter() {
     echo '            <h2>latest twitter updates</h2>' . "\n";
     if ($data = parse_rss('http://twitter.com/statuses/user_timeline/' . get_config('twitter_username') . '.rss')) {
         echo '            <ul>' . "\n";
-        foreach ($data->content as $item) {
-            echo '                <li><a href="' . $item->link . '">' . hsc(substr($item->title, strlen(get_config('twitter_username')) + 2)) . '</a></li>' . "\n";
+        if (!is_array($data->content)) {
+            echo '<li>twitter appears to be done again. fail whale!</li>';
+        }
+        else {
+            foreach ($data->content as $item) {
+                echo '                <li><a href="' . $item->link . '">' . hsc(substr($item->title, strlen(get_config('twitter_username')) + 2)) . '</a></li>' . "\n";
+            }
         }
         echo '                <li class="last"><a href="http://twitter.com/' . get_config('twitter_username') . '/">... more</a></li>' . "\n";
         echo '            </ul>' . "\n";