- $array = func_get_args();
- $rssurl = $tmplname = $usecache = $usetimestamp = '';
-
- switch (func_num_args()) {
- case 4: $usetimestamp = trim($array[3]);
- case 3: $usecache = $array[2];
- case 2: $tmplname = strtolower(trim($array[1]));
- case 1: $rssurl = trim($array[0]);
+ $class = ($template == '' || $template == 'default') ? 'ShowRSS_html' : 'ShowRSS_html_' . $template;
+ if (! is_numeric($cachehour))
+ return '#showrss: Cache-lifetime seems not numeric: ' . htmlspecialchars($cachehour) . '<br />' . "\n";
+ if (! class_exists($class))
+ return '#showrss: Template not found: ' . htmlspecialchars($template) . '<br />' . "\n";
+ if (! is_url($uri))
+ return '#showrss: Seems not URI: ' . htmlspecialchars($uri) . '<br />' . "\n";
+
+ list($rss, $time) = plugin_showrss_get_rss($uri, $cachehour);
+ if ($rss === FALSE) return '#showrss: Failed fetching RSS from the server<br />' . "\n";
+
+ $time = '';
+ if ($timestamp > 0) {
+ $time = '<p style="font-size:10px; font-weight:bold">Last-Modified:' .
+ get_date('Y/m/d H:i:s', $time) . '</p>';