$o[$pl] = $stat[9]; } } } arsort($o); $latest = array_slice($o, 0, 10, true); $mydir = preg_replace('/(.*)\\/.*/', '$1/', $_SERVER['PHP_SELF']); $self = $prot . $_SERVER['HTTP_HOST'] . $mydir; //var_dump( $latest ); try { include 'feed/FeedGenerator.php'; $feeds = new FeedGenerator(); $feeds->setGenerator(new AtomGenerator()); $feeds->setAuthor('Jart'); $feeds->setTitle('New and Updated Jart Playlists'); $feeds->setChanneLink($self); $feeds->setLink($self); $feeds->setDescription('New and Updated Jart Playlists'); $feeds->setID($self); foreach ($latest as $playlist => $pldate) { $shortpl = preg_replace('/.pspl$/', '', $playlist); $name = preg_replace('/.*\\/(.*)/', '$1', $shortpl); $author = preg_replace('|([^/]*)/.*|', '$1', $playlist); $item = new FeedItem("{$self}?pl={$shortpl}", $name, "{$self}?pl={$shortpl}", "<a href=\"{$self}?pl={$shortpl}\">{$name}</a>", date3339($pldate)); $item->author = $author; $feeds->addItem($item); } $feeds->display(); } catch (FeedGeneratorException $e) { echo 'Error: ' . $e->getMessage(); }