web/lib/Zend/Gdata/Docs.php
changeset 886 1e110b03ae96
parent 807 877f952ae2bd
child 1230 68c69c656a2c
equal deleted inserted replaced
885:2251fb41dbc7 886:1e110b03ae96
    14  * to license@zend.com so we can send you a copy immediately.
    14  * to license@zend.com so we can send you a copy immediately.
    15  *
    15  *
    16  * @category   Zend
    16  * @category   Zend
    17  * @package    Zend_Gdata
    17  * @package    Zend_Gdata
    18  * @subpackage Docs
    18  * @subpackage Docs
    19  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    21  * @version    $Id: Docs.php 20112 2010-01-07 02:39:32Z tjohns $
    21  * @version    $Id: Docs.php 24593 2012-01-05 20:35:02Z matthew $
    22  */
    22  */
    23 
    23 
    24 /**
    24 /**
    25  * @see Zend_Gdata
    25  * @see Zend_Gdata
    26  */
    26  */
    51  * @link http://code.google.com/apis/documents/
    51  * @link http://code.google.com/apis/documents/
    52  *
    52  *
    53  * @category   Zend
    53  * @category   Zend
    54  * @package    Zend_Gdata
    54  * @package    Zend_Gdata
    55  * @subpackage Docs
    55  * @subpackage Docs
    56  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    56  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    57  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    57  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    58  */
    58  */
    59 class Zend_Gdata_Docs extends Zend_Gdata
    59 class Zend_Gdata_Docs extends Zend_Gdata
    60 {
    60 {
    61 
    61 
    62     const DOCUMENTS_LIST_FEED_URI = 'http://docs.google.com/feeds/documents/private/full';
    62     const DOCUMENTS_LIST_FEED_URI = 'https://docs.google.com/feeds/documents/private/full';
    63     const DOCUMENTS_FOLDER_FEED_URI = 'http://docs.google.com/feeds/folders/private/full';
    63     const DOCUMENTS_FOLDER_FEED_URI = 'https://docs.google.com/feeds/folders/private/full';
    64     const DOCUMENTS_CATEGORY_SCHEMA = 'http://schemas.google.com/g/2005#kind';
    64     const DOCUMENTS_CATEGORY_SCHEMA = 'http://schemas.google.com/g/2005#kind';
    65     const DOCUMENTS_CATEGORY_TERM = 'http://schemas.google.com/docs/2007#folder';
    65     const DOCUMENTS_CATEGORY_TERM = 'http://schemas.google.com/docs/2007#folder';
    66     const AUTH_SERVICE_NAME = 'writely';
    66     const AUTH_SERVICE_NAME = 'writely';
    67 
    67 
    68     protected $_defaultPostUri = self::DOCUMENTS_LIST_FEED_URI;
    68     protected $_defaultPostUri = self::DOCUMENTS_LIST_FEED_URI;
   160      * @param string $docType The type of the document as used in the Google
   160      * @param string $docType The type of the document as used in the Google
   161      *     Document List URLs. Examples: document, spreadsheet, presentation
   161      *     Document List URLs. Examples: document, spreadsheet, presentation
   162      * @return Zend_Gdata_Docs_DocumentListEntry
   162      * @return Zend_Gdata_Docs_DocumentListEntry
   163      */
   163      */
   164     public function getDoc($docId, $docType) {
   164     public function getDoc($docId, $docType) {
   165         $location = 'http://docs.google.com/feeds/documents/private/full/' .
   165         $location = 'https://docs.google.com/feeds/documents/private/full/' .
   166             $docType . '%3A' . $docId;
   166             $docType . '%3A' . $docId;
   167         return $this->getDocumentListEntry($location);
   167         return $this->getDocumentListEntry($location);
   168     }
   168     }
   169 
   169 
   170     /**
   170     /**
   213      * @param string $mimeType Describes the type of data which is being sent
   213      * @param string $mimeType Describes the type of data which is being sent
   214      *         to the server. This must be one of the accepted mime types
   214      *         to the server. This must be one of the accepted mime types
   215      *         which are enumerated in SUPPORTED_FILETYPES.
   215      *         which are enumerated in SUPPORTED_FILETYPES.
   216      * @param string $uri (optional) The URL to which the upload should be
   216      * @param string $uri (optional) The URL to which the upload should be
   217      *         made.
   217      *         made.
   218      *         Example: 'http://docs.google.com/feeds/documents/private/full'.
   218      *         Example: 'https://docs.google.com/feeds/documents/private/full'.
   219      * @return Zend_Gdata_Docs_DocumentListEntry The entry for the newly
   219      * @return Zend_Gdata_Docs_DocumentListEntry The entry for the newly
   220      *         created Google Document.
   220      *         created Google Document.
   221      */
   221      */
   222     public function uploadFile($fileLocation, $title=null, $mimeType=null,
   222     public function uploadFile($fileLocation, $title=null, $mimeType=null,
   223                                $uri=null)
   223                                $uri=null)
   263      * @return Zend_Gdata_Entry The folder entry created.
   263      * @return Zend_Gdata_Entry The folder entry created.
   264      * @todo ZF-8732: This should return a *subclass* of Zend_Gdata_Entry, but
   264      * @todo ZF-8732: This should return a *subclass* of Zend_Gdata_Entry, but
   265      *       the appropriate type doesn't exist yet.
   265      *       the appropriate type doesn't exist yet.
   266      */
   266      */
   267     public function createFolder($folderName, $folderResourceId=null) {
   267     public function createFolder($folderName, $folderResourceId=null) {
   268         $category = new Zend_Gdata_App_Extension_Category(self::DOCUMENTS_CATEGORY_TERM, 
   268         $category = new Zend_Gdata_App_Extension_Category(self::DOCUMENTS_CATEGORY_TERM,
   269                                                           self::DOCUMENTS_CATEGORY_SCHEMA);
   269                                                           self::DOCUMENTS_CATEGORY_SCHEMA);
   270         $title = new Zend_Gdata_App_Extension_Title($folderName);
   270         $title = new Zend_Gdata_App_Extension_Title($folderName);
   271         $entry = new Zend_Gdata_Entry();
   271         $entry = new Zend_Gdata_Entry();
   272 
   272 
   273         $entry->setCategory(array($category));
   273         $entry->setCategory(array($category));