diff -r 5a6b6e770365 -r 68c69c656a2c web/lib/Zend/Gdata/Docs.php --- a/web/lib/Zend/Gdata/Docs.php Thu May 07 15:10:09 2015 +0200 +++ b/web/lib/Zend/Gdata/Docs.php Thu May 07 15:16:02 2015 +0200 @@ -16,9 +16,9 @@ * @category Zend * @package Zend_Gdata * @subpackage Docs - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Docs.php 24593 2012-01-05 20:35:02Z matthew $ + * @version $Id$ */ /** @@ -53,36 +53,43 @@ * @category Zend * @package Zend_Gdata * @subpackage Docs - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Gdata_Docs extends Zend_Gdata { - const DOCUMENTS_LIST_FEED_URI = 'https://docs.google.com/feeds/documents/private/full'; const DOCUMENTS_FOLDER_FEED_URI = 'https://docs.google.com/feeds/folders/private/full'; const DOCUMENTS_CATEGORY_SCHEMA = 'http://schemas.google.com/g/2005#kind'; const DOCUMENTS_CATEGORY_TERM = 'http://schemas.google.com/docs/2007#folder'; const AUTH_SERVICE_NAME = 'writely'; + /** + * @var string + */ protected $_defaultPostUri = self::DOCUMENTS_LIST_FEED_URI; - private static $SUPPORTED_FILETYPES = array( - 'TXT'=>'text/plain', - 'CSV'=>'text/csv', - 'TSV'=>'text/tab-separated-values', - 'TAB'=>'text/tab-separated-values', - 'HTML'=>'text/html', - 'HTM'=>'text/html', - 'DOC'=>'application/msword', - 'ODS'=>'application/vnd.oasis.opendocument.spreadsheet', - 'ODT'=>'application/vnd.oasis.opendocument.text', - 'RTF'=>'application/rtf', - 'SXW'=>'application/vnd.sun.xml.writer', - 'XLS'=>'application/vnd.ms-excel', - 'XLSX'=>'application/vnd.ms-excel', - 'PPT'=>'application/vnd.ms-powerpoint', - 'PPS'=>'application/vnd.ms-powerpoint'); + /** + * @var array + */ + protected static $SUPPORTED_FILETYPES = array( + 'TXT' => 'text/plain', + 'CSV' => 'text/csv', + 'TSV' => 'text/tab-separated-values', + 'TAB' => 'text/tab-separated-values', + 'HTML' => 'text/html', + 'HTM' => 'text/html', + 'DOC' => 'application/msword', + 'DOCX' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'ODS' => 'application/vnd.oasis.opendocument.spreadsheet', + 'ODT' => 'application/vnd.oasis.opendocument.text', + 'RTF' => 'application/rtf', + 'SXW' => 'application/vnd.sun.xml.writer', + 'XLS' => 'application/vnd.ms-excel', + 'XLSX' => 'application/vnd.ms-excel', + 'PPT' => 'application/vnd.ms-powerpoint', + 'PPS' => 'application/vnd.ms-powerpoint' + ); /** * Create Gdata_Docs object @@ -108,8 +115,9 @@ * @return string The mime type to be sent to the server to tell it how the * multipart mime data should be interpreted. */ - public static function lookupMimeType($fileExtension) { - return self::$SUPPORTED_FILETYPES[strtoupper($fileExtension)]; + public static function lookupMimeType($fileExtension) + { + return self::$SUPPORTED_FILETYPES[strtoupper($fileExtension)]; } /** @@ -135,13 +143,15 @@ * * @param mixed $location The location for the entry, as a URL or Query * @return Zend_Gdata_Docs_DocumentListEntry + * @throws Zend_Gdata_App_InvalidArgumentException */ public function getDocumentListEntry($location = null) { if ($location === null) { require_once 'Zend/Gdata/App/InvalidArgumentException.php'; throw new Zend_Gdata_App_InvalidArgumentException( - 'Location must not be null'); + 'Location must not be null' + ); } else if ($location instanceof Zend_Gdata_Query) { $uri = $location->getQueryUrl(); } else { @@ -161,40 +171,45 @@ * Document List URLs. Examples: document, spreadsheet, presentation * @return Zend_Gdata_Docs_DocumentListEntry */ - public function getDoc($docId, $docType) { + public function getDoc($docId, $docType) + { $location = 'https://docs.google.com/feeds/documents/private/full/' . $docType . '%3A' . $docId; + return $this->getDocumentListEntry($location); } /** * Retreive entry object for the desired word processing document. * - * @param string $id The URL id for the document. Example: - * dcmg89gw_62hfjj8m + * @param string $id The URL id for the document. Example: dcmg89gw_62hfjj8m + * @return Zend_Gdata_Docs_DocumentListEntry */ - public function getDocument($id) { - return $this->getDoc($id, 'document'); + public function getDocument($id) + { + return $this->getDoc($id, 'document'); } /** * Retreive entry object for the desired spreadsheet. * - * @param string $id The URL id for the document. Example: - * pKq0CzjiF3YmGd0AIlHKqeg + * @param string $id The URL id for the document. Example: pKq0CzjiF3YmGd0AIlHKqeg + * @return Zend_Gdata_Docs_DocumentListEntry */ - public function getSpreadsheet($id) { - return $this->getDoc($id, 'spreadsheet'); + public function getSpreadsheet($id) + { + return $this->getDoc($id, 'spreadsheet'); } /** * Retreive entry object for the desired presentation. * - * @param string $id The URL id for the document. Example: - * dcmg89gw_21gtrjcn + * @param string $id The URL id for the document. Example: dcmg89gw_21gtrjcn + * @return Zend_Gdata_Docs_DocumentListEntry */ - public function getPresentation($id) { - return $this->getDoc($id, 'presentation'); + public function getPresentation($id) + { + return $this->getDoc($id, 'presentation'); } /** @@ -219,8 +234,9 @@ * @return Zend_Gdata_Docs_DocumentListEntry The entry for the newly * created Google Document. */ - public function uploadFile($fileLocation, $title=null, $mimeType=null, - $uri=null) + public function uploadFile($fileLocation, $title = null, $mimeType = null, + $uri = null + ) { // Set the URI to which the file will be uploaded. if ($uri === null) { @@ -264,11 +280,14 @@ * @todo ZF-8732: This should return a *subclass* of Zend_Gdata_Entry, but * the appropriate type doesn't exist yet. */ - public function createFolder($folderName, $folderResourceId=null) { - $category = new Zend_Gdata_App_Extension_Category(self::DOCUMENTS_CATEGORY_TERM, - self::DOCUMENTS_CATEGORY_SCHEMA); - $title = new Zend_Gdata_App_Extension_Title($folderName); - $entry = new Zend_Gdata_Entry(); + public function createFolder($folderName, $folderResourceId = null) + { + $category = new Zend_Gdata_App_Extension_Category( + self::DOCUMENTS_CATEGORY_TERM, + self::DOCUMENTS_CATEGORY_SCHEMA + ); + $title = new Zend_Gdata_App_Extension_Title($folderName); + $entry = new Zend_Gdata_Entry(); $entry->setCategory(array($category)); $entry->setTitle($title); @@ -295,9 +314,8 @@ * service after insertion. */ public function insertDocument($data, $uri, - $className='Zend_Gdata_Docs_DocumentListEntry') + $className = 'Zend_Gdata_Docs_DocumentListEntry') { return $this->insertEntry($data, $uri, $className); } - }