photos.php

来自「Bug tracker, and reporter.」· PHP 代码 · 共 562 行 · 第 1/2 页

PHP
562
字号
            $location->setType('entry');            $uri = $location->getQueryUrl();        } else if ($location instanceof Zend_Gdata_Query) {            $uri = $location->getQueryUrl();        } else {            $uri = $location;        }        return parent::getEntry($uri, 'Zend_Gdata_Photos_PhotoEntry');    }    /**     * Retreive a single TagEntry object.     *     * @param mixed $location The location for the feed, as a URL or Query.     * @return Zend_Gdata_Photos_TagEntry     * @throws Zend_Gdata_App_Exception     * @throws Zend_Gdata_App_HttpException     */    public function getTagEntry($location)    {        if ($location === null) {            require_once 'Zend/Gdata/App/InvalidArgumentException.php';            throw new Zend_Gdata_App_InvalidArgumentException(                    'Location must not be null');        } else if ($location instanceof Zend_Gdata_Photos_UserQuery) {            $location->setType('entry');            $uri = $location->getQueryUrl();        } else if ($location instanceof Zend_Gdata_Query) {            $uri = $location->getQueryUrl();        } else {            $uri = $location;        }        return parent::getEntry($uri, 'Zend_Gdata_Photos_TagEntry');    }    /**     * Retreive a single CommentEntry object.     *     * @param mixed $location The location for the feed, as a URL or Query.     * @return Zend_Gdata_Photos_CommentEntry     * @throws Zend_Gdata_App_Exception     * @throws Zend_Gdata_App_HttpException     */    public function getCommentEntry($location)    {        if ($location === null) {            require_once 'Zend/Gdata/App/InvalidArgumentException.php';            throw new Zend_Gdata_App_InvalidArgumentException(                    'Location must not be null');        } else if ($location instanceof Zend_Gdata_Photos_UserQuery) {            $location->setType('entry');            $uri = $location->getQueryUrl();        } else if ($location instanceof Zend_Gdata_Query) {            $uri = $location->getQueryUrl();        } else {            $uri = $location;        }        return parent::getEntry($uri, 'Zend_Gdata_Photos_CommentEntry');    }    /**     * Create a new album from a AlbumEntry.     *      * @param Zend_Gdata_Photos_AlbumEntry $album The album entry to      *          insert.     * @param string $url (optional) The URI that the album should be      *          uploaded to. If null, the default album creation URI for      *          this domain will be used.     * @return Zend_Gdata_Photos_AlbumEntry The inserted album entry as      *          returned by the server.     * @throws Zend_Gdata_App_Exception     * @throws Zend_Gdata_App_HttpException     */    public function insertAlbumEntry($album, $uri = null)    {        if ($uri === null) {            $uri = self::PICASA_BASE_FEED_URI . '/' .                self::DEFAULT_PROJECTION . '/' . self::USER_PATH . '/' .                self::DEFAULT_USER;        }        $newEntry = $this->insertEntry($album, $uri, 'Zend_Gdata_Photos_AlbumEntry');        return $newEntry;    }    /**     * Create a new photo from a PhotoEntry.     *      * @param Zend_Gdata_Photos_PhotoEntry $photo The photo to insert.     * @param string $url The URI that the photo should be uploaded      *          to. Alternatively, an AlbumEntry can be provided and the      *          photo will be added to that album.     * @return Zend_Gdata_Photos_PhotoEntry The inserted photo entry      *          as returned by the server.     * @throws Zend_Gdata_App_Exception     * @throws Zend_Gdata_App_HttpException     */    public function insertPhotoEntry($photo, $uri = null)    {        if ($uri instanceof Zend_Gdata_Photos_AlbumEntry) {            $uri = $uri->getLink(self::FEED_LINK_PATH)->href;        }        if ($uri === null) {            require_once 'Zend/Gdata/App/InvalidArgumentException.php';            throw new Zend_Gdata_App_InvalidArgumentException(                    'URI must not be null');        }        $newEntry = $this->insertEntry($photo, $uri, 'Zend_Gdata_Photos_PhotoEntry');        return $newEntry;    }        /**     * Create a new tag from a TagEntry.     *      * @param Zend_Gdata_Photos_TagEntry $tag The tag entry to insert.     * @param string $url The URI where the tag should be      *          uploaded to. Alternatively, a PhotoEntry can be provided and      *          the tag will be added to that photo.     * @return Zend_Gdata_Photos_TagEntry The inserted tag entry as returned     *          by the server.     * @throws Zend_Gdata_App_Exception     * @throws Zend_Gdata_App_HttpException     */    public function insertTagEntry($tag, $uri = null)    {        if ($uri instanceof Zend_Gdata_Photos_PhotoEntry) {            $uri = $uri->getLink(self::FEED_LINK_PATH)->href;        }        if ($uri === null) {            require_once 'Zend/Gdata/App/InvalidArgumentException.php';            throw new Zend_Gdata_App_InvalidArgumentException(                    'URI must not be null');        }        $newEntry = $this->insertEntry($tag, $uri, 'Zend_Gdata_Photos_TagEntry');        return $newEntry;    }    /**     * Create a new comment from a CommentEntry.     *      * @param Zend_Gdata_Photos_CommentEntry $comment The comment entry to     *          insert.     * @param string $url The URI where the comment should be uploaded to.     *          Alternatively, a PhotoEntry can be provided and      *          the comment will be added to that photo.     * @return Zend_Gdata_Photos_CommentEntry The inserted comment entry     *          as returned by the server.     * @throws Zend_Gdata_App_Exception     * @throws Zend_Gdata_App_HttpException     */    public function insertCommentEntry($comment, $uri = null)    {        if ($uri instanceof Zend_Gdata_Photos_PhotoEntry) {            $uri = $uri->getLink(self::FEED_LINK_PATH)->href;        }        if ($uri === null) {            require_once 'Zend/Gdata/App/InvalidArgumentException.php';            throw new Zend_Gdata_App_InvalidArgumentException(                    'URI must not be null');        }        $newEntry = $this->insertEntry($comment, $uri, 'Zend_Gdata_Photos_CommentEntry');        return $newEntry;    }    /**     * Delete an AlbumEntry.     *      * @param Zend_Gdata_Photos_AlbumEntry $album The album entry to      *          delete.     * @param boolean $catch Whether to catch an exception when     *            modified and re-delete or throw     * @return void.     * @throws Zend_Gdata_App_Exception     * @throws Zend_Gdata_App_HttpException     */    public function deleteAlbumEntry($album, $catch)    {        if ($catch) {            try {                $this->delete($album);            } catch (Zend_Gdata_App_HttpException $e) {                if ($e->getResponse()->getStatus() === 409) {                    $entry = new Zend_Gdata_Photos_AlbumEntry($e->getResponse()->getBody());                    $this->delete($entry->getLink('edit')->href);                } else {                    throw $e;                }            }        } else {            $this->delete($album);        }    }    /**     * Delete a PhotoEntry.     *      * @param Zend_Gdata_Photos_PhotoEntry $photo The photo entry to      *          delete.     * @param boolean $catch Whether to catch an exception when     *            modified and re-delete or throw     * @return void.     * @throws Zend_Gdata_App_Exception     * @throws Zend_Gdata_App_HttpException     */    public function deletePhotoEntry($photo, $catch)    {        if ($catch) {            try {                $this->delete($photo);            } catch (Zend_Gdata_App_HttpException $e) {                if ($e->getResponse()->getStatus() === 409) {                    $entry = new Zend_Gdata_Photos_PhotoEntry($e->getResponse()->getBody());                    $this->delete($entry->getLink('edit')->href);                } else {                    throw $e;                }            }        } else {            $this->delete($photo);        }    }        /**     * Delete a CommentEntry.     *      * @param Zend_Gdata_Photos_CommentEntry $comment The comment entry to      *          delete.     * @param boolean $catch Whether to catch an exception when     *            modified and re-delete or throw     * @return void.     * @throws Zend_Gdata_App_Exception     * @throws Zend_Gdata_App_HttpException     */    public function deleteCommentEntry($comment, $catch)    {        if ($catch) {            try {                $this->delete($comment);            } catch (Zend_Gdata_App_HttpException $e) {                if ($e->getResponse()->getStatus() === 409) {                    $entry = new Zend_Gdata_Photos_CommentEntry($e->getResponse()->getBody());                    $this->delete($entry->getLink('edit')->href);                } else {                    throw $e;                }            }        } else {            $this->delete($comment);        }    }    /**     * Delete a TagEntry.     *      * @param Zend_Gdata_Photos_TagEntry $tag The tag entry to      *          delete.     * @param boolean $catch Whether to catch an exception when     *            modified and re-delete or throw     * @return void.     * @throws Zend_Gdata_App_Exception     * @throws Zend_Gdata_App_HttpException     */    public function deleteTagEntry($tag, $catch)    {        if ($catch) {            try {                $this->delete($tag);            } catch (Zend_Gdata_App_HttpException $e) {                if ($e->getResponse()->getStatus() === 409) {                    $entry = new Zend_Gdata_Photos_TagEntry($e->getResponse()->getBody());                    $this->delete($entry->getLink('edit')->href);                } else {                    throw $e;                }            }        } else {            $this->delete($tag);        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?