Пример #1
0
/**
 * Deletes the specified tag
 *
 * @param  Zend_Http_Client $client     The authenticated client
 * @param  string           $user       The user's account name
 * @param  integer          $albumId    The album's id
 * @param  integer          $photoId    The photo's id
 * @param  string           $tagContent The name of the tag to be deleted
 * @return void
 */
function deleteTag($client, $user, $albumId, $photoId, $tagContent)
{
    $photos = new Zend_Gdata_Photos($client);
    $photoQuery = new Zend_Gdata_Photos_PhotoQuery();
    $photoQuery->setUser($user);
    $photoQuery->setAlbumId($albumId);
    $photoQuery->setPhotoId($photoId);
    $query = $photoQuery->getQueryUrl() . "?kind=tag";
    $photoFeed = $photos->getPhotoFeed($query);
    foreach ($photoFeed as $entry) {
        if ($entry instanceof Zend_Gdata_Photos_TagEntry) {
            if ($entry->getContent() == $tagContent) {
                $tagEntry = $entry;
            }
        }
    }
    $photos->deleteTagEntry($tagEntry, true);
    outputPhotoFeed($client, $user, $albumId, $photoId);
}