import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
62
libs/Zend/Gdata/Docs.php
Executable file → Normal file
62
libs/Zend/Gdata/Docs.php
Executable file → Normal file
@ -18,7 +18,7 @@
|
||||
* @subpackage Docs
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Docs.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Docs.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -80,11 +80,11 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
||||
|
||||
/**
|
||||
* Looks up the mime type based on the file name extension. For example,
|
||||
* calling this method with 'csv' would return
|
||||
* 'text/comma-separated-values'. The Mime type is sent as a header in
|
||||
* calling this method with 'csv' would return
|
||||
* 'text/comma-separated-values'. The Mime type is sent as a header in
|
||||
* the upload HTTP POST request.
|
||||
*
|
||||
* @param string $fileExtension
|
||||
* @param string $fileExtension
|
||||
* @return string The mime type to be sent to the server to tell it how the
|
||||
* multipart mime data should be interpreted.
|
||||
*/
|
||||
@ -135,14 +135,14 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
||||
*
|
||||
* This method builds the URL where this item is stored using the type
|
||||
* and the id of the document.
|
||||
* @param string $docId The URL key for the document. Examples:
|
||||
* @param string $docId The URL key for the document. Examples:
|
||||
* dcmg89gw_62hfjj8m, pKq0CzjiF3YmGd0AIlHKqeg
|
||||
* @param string $docType The type of the document as used in the Google
|
||||
* Document List URLs. Examples: document, spreadsheet, presentation
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry
|
||||
*/
|
||||
public function getDoc($docId, $docType) {
|
||||
$location = 'http://docs.google.com/feeds/documents/private/full/' .
|
||||
$location = 'http://docs.google.com/feeds/documents/private/full/' .
|
||||
$docType . '%3A' . $docId;
|
||||
return $this->getDocumentListEntry($location);
|
||||
}
|
||||
@ -150,27 +150,27 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
||||
/**
|
||||
* Retreive entry object for the desired word processing document.
|
||||
*
|
||||
* @param string $id The URL id for the document. Example:
|
||||
* @param string $id The URL id for the document. Example:
|
||||
* dcmg89gw_62hfjj8m
|
||||
*/
|
||||
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:
|
||||
* @param string $id The URL id for the document. Example:
|
||||
* pKq0CzjiF3YmGd0AIlHKqeg
|
||||
*/
|
||||
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:
|
||||
* @param string $id The URL id for the document. Example:
|
||||
* dcmg89gw_21gtrjcn
|
||||
*/
|
||||
public function getPresentation($id) {
|
||||
@ -178,35 +178,35 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a local file to create a new Google Document entry.
|
||||
* Upload a local file to create a new Google Document entry.
|
||||
*
|
||||
* @param string $fileLocation The full or relative path of the file to
|
||||
* be uploaded.
|
||||
* @param string $title The name that this document should have on the
|
||||
* @param string $title The name that this document should have on the
|
||||
* server. If set, the title is used as the slug header in the
|
||||
* POST request. If no title is provided, the location of the
|
||||
* file will be used as the slug header in the request. If no
|
||||
* POST request. If no title is provided, the location of the
|
||||
* file will be used as the slug header in the request. If no
|
||||
* mimeType is provided, this method attempts to determine the
|
||||
* mime type based on the slugHeader by looking for .doc,
|
||||
* mime type based on the slugHeader by looking for .doc,
|
||||
* .csv, .txt, etc. at the end of the file name.
|
||||
* Example value: 'test.doc'.
|
||||
* @param string $mimeType Describes the type of data which is being sent
|
||||
* to the server. This must be one of the accepted mime types
|
||||
* to the server. This must be one of the accepted mime types
|
||||
* which are enumerated in SUPPORTED_FILETYPES.
|
||||
* @param string $uri (optional) The URL to which the upload should be
|
||||
* @param string $uri (optional) The URL to which the upload should be
|
||||
* made.
|
||||
* Example: 'http://docs.google.com/feeds/documents/private/full'.
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry The entry for the newly
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry The entry for the newly
|
||||
* created Google Document.
|
||||
*/
|
||||
public function uploadFile($fileLocation, $title=null, $mimeType=null,
|
||||
public function uploadFile($fileLocation, $title=null, $mimeType=null,
|
||||
$uri=null)
|
||||
{
|
||||
// Set the URI to which the file will be uploaded.
|
||||
if ($uri === null) {
|
||||
$uri = $this->_defaultPostUri;
|
||||
}
|
||||
|
||||
|
||||
// Create the media source which describes the file.
|
||||
$fs = $this->newMediaFileSource($fileLocation);
|
||||
if ($title !== null) {
|
||||
@ -214,9 +214,9 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
||||
} else {
|
||||
$slugHeader = $fileLocation;
|
||||
}
|
||||
|
||||
// Set the slug header to tell the Google Documents server what the
|
||||
// title of the document should be and what the file extension was
|
||||
|
||||
// Set the slug header to tell the Google Documents server what the
|
||||
// title of the document should be and what the file extension was
|
||||
// for the original file.
|
||||
$fs->setSlug($slugHeader);
|
||||
|
||||
@ -226,10 +226,10 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
||||
$fileExtension = end($filenameParts);
|
||||
$mimeType = self::lookupMimeType($fileExtension);
|
||||
}
|
||||
|
||||
|
||||
// Set the mime type for the upload request.
|
||||
$fs->setContentType($mimeType);
|
||||
|
||||
|
||||
// Send the data to the server.
|
||||
return $this->insertDocument($fs, $uri);
|
||||
}
|
||||
@ -237,17 +237,17 @@ class Zend_Gdata_Docs extends Zend_Gdata
|
||||
/**
|
||||
* Inserts an entry to a given URI and returns the response as an Entry.
|
||||
*
|
||||
* @param mixed $data The Zend_Gdata_Docs_DocumentListEntry or media
|
||||
* @param mixed $data The Zend_Gdata_Docs_DocumentListEntry or media
|
||||
* source to post. If it is a DocumentListEntry, the mediaSource
|
||||
* should already have been set. If $data is a mediaSource, it
|
||||
* should already have been set. If $data is a mediaSource, it
|
||||
* should have the correct slug header and mime type.
|
||||
* @param string $uri POST URI
|
||||
* @param string $className (optional) The class of entry to be returned.
|
||||
* @param string $className (optional) The class of entry to be returned.
|
||||
* The default is a 'Zend_Gdata_Docs_DocumentListEntry'.
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry The entry returned by the
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry The entry returned by the
|
||||
* service after insertion.
|
||||
*/
|
||||
public function insertDocument($data, $uri,
|
||||
public function insertDocument($data, $uri,
|
||||
$className='Zend_Gdata_Docs_DocumentListEntry')
|
||||
{
|
||||
return $this->insertEntry($data, $uri, $className);
|
||||
|
Reference in New Issue
Block a user