--- library/Zend/Gdata/Docs.php (revision 16177) +++ library/Zend/Gdata/Docs.php (working copy) @@ -36,6 +36,12 @@ require_once 'Zend/Gdata/Docs/DocumentListEntry.php'; /** + * App Extensions + */ +require_once 'Zend/Gdata/App/Extension/Category.php'; +require_once 'Zend/Gdata/App/Extension/Title.php'; + +/** * Service class for interacting with the Google Document List data API * @link http://code.google.com/apis/documents/ * @@ -49,6 +55,9 @@ { const DOCUMENTS_LIST_FEED_URI = 'http://docs.google.com/feeds/documents/private/full'; + const DOCUMENTS_FOLDER_FEED_URI = 'http://docs.google.com/feeds/folders/private/full/folder'; + 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'; protected $_defaultPostUri = self::DOCUMENTS_LIST_FEED_URI; @@ -221,8 +230,7 @@ // Set the mime type of the data. if ($mimeType === null) { - $slugHeader = $fs->getSlug(); - $filenameParts = explode('.', $slugHeader); + $filenameParts = explode('.', $fileLocation); $fileExtension = end($filenameParts); $mimeType = self::lookupMimeType($fileExtension); } @@ -235,6 +243,24 @@ } /** + * Creates a new folder in Google Docs + * + * @param string $folderName The folder name to create + * + * @return boolean + */ + public function createFolder($folderName) { + $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); + + return $this->insertEntry($entry, self::DOCUMENTS_LIST_FEED_URI); + } + + /** * Inserts an entry to a given URI and returns the response as an Entry. * * @param mixed $data The Zend_Gdata_Docs_DocumentListEntry or media