Ejemplo n.º 1
0
    $albums = $dataProvider->getPublicAlbums();
    $albumId = getAlbumIdByName($albums, $_GET['album']);
    if (empty($albumId)) {
        die('Could not find a public album with title: ' . $_GET['album'] . '. Please make sure that this album exists and that it is public!');
    }
    $photos = $dataProvider->getPhotosByAlbum($albumId);
    if (!empty($_GET['format']) && $_GET['format'] === "json") {
        # Generate RSS as JSON
        echo $jsonGenerator->buildJsonFeedForAlbum($_GET['album'], $photos);
    } else {
        # Generate RSS
        echo $rssGenerator->buildRssFeedForAlbum($_GET['album'], $photos);
    }
} else {
    # Get latest photos
    $photos = $dataProvider->getPhotostream();
    if (!empty($_GET['format']) && $_GET['format'] === "json") {
        # Generate RSS as JSON
        echo $jsonGenerator->buildJsonFeedLatestPhotos($photos);
    } else {
        # Generate RSS
        echo $rssGenerator->buildRssFeedLatestPhotos($photos);
    }
}
function getAlbumIdByName($albums, $name)
{
    foreach ($albums['albums'] as $album) {
        if (strtolower($album['title']) === strtolower($name)) {
            return $album['id'];
        }
    }