import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -31,7 +31,7 @@ require_once 'Zend/Gdata/App/Exception.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Zend_Gdata_App
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -32,6 +32,7 @@ require_once 'Zend/Gdata/App/Exception.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -20,12 +20,17 @@
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Util
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Util.php';
|
||||
|
||||
/**
|
||||
* Abstract class for all XML elements
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
@ -63,6 +68,14 @@ abstract class Zend_Gdata_App_Base
|
||||
*/
|
||||
protected $_text = null;
|
||||
|
||||
/**
|
||||
* @var array Memoized results from calls to lookupNamespace() to avoid
|
||||
* expensive calls to getGreatestBoundedValue(). The key is in the
|
||||
* form 'prefix-majorVersion-minorVersion', and the value is the
|
||||
* output from getGreatestBoundedValue().
|
||||
*/
|
||||
protected static $_namespaceLookupCache = array();
|
||||
|
||||
/**
|
||||
* List of namespaces, as a three-dimensional array. The first dimension
|
||||
* represents the namespace prefix, the second dimension represents the
|
||||
@ -75,9 +88,10 @@ abstract class Zend_Gdata_App_Base
|
||||
*
|
||||
* @see lookupNamespace()
|
||||
* @see registerNamespace()
|
||||
* @see registerAllNamespaces()
|
||||
* @var array
|
||||
*/
|
||||
protected $_namespaces = array(
|
||||
protected $_namespaces = array(
|
||||
'atom' => array(
|
||||
1 => array(
|
||||
0 => 'http://www.w3.org/2005/Atom'
|
||||
@ -91,7 +105,7 @@ abstract class Zend_Gdata_App_Base
|
||||
0 => 'http://www.w3.org/2007/app'
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -152,8 +166,8 @@ abstract class Zend_Gdata_App_Base
|
||||
|
||||
/**
|
||||
* Returns an array of all extension attributes not transformed into data
|
||||
* model properties during parsing of the XML. Each element of the array
|
||||
* is a hashed array of the format:
|
||||
* model properties during parsing of the XML. Each element of the array
|
||||
* is a hashed array of the format:
|
||||
* array('namespaceUri' => string, 'name' => string, 'value' => string);
|
||||
*
|
||||
* @return array All extension attributes
|
||||
@ -165,8 +179,8 @@ abstract class Zend_Gdata_App_Base
|
||||
|
||||
/**
|
||||
* Sets an array of all extension attributes not transformed into data
|
||||
* model properties during parsing of the XML. Each element of the array
|
||||
* is a hashed array of the format:
|
||||
* model properties during parsing of the XML. Each element of the array
|
||||
* is a hashed array of the format:
|
||||
* array('namespaceUri' => string, 'name' => string, 'value' => string);
|
||||
* This can be used to add arbitrary attributes to any data model element
|
||||
*
|
||||
@ -191,7 +205,7 @@ abstract class Zend_Gdata_App_Base
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
if (is_null($doc)) {
|
||||
if ($doc === null) {
|
||||
$doc = new DOMDocument('1.0', 'utf-8');
|
||||
}
|
||||
if ($this->_rootNamespaceURI != null) {
|
||||
@ -325,7 +339,7 @@ abstract class Zend_Gdata_App_Base
|
||||
{
|
||||
return $this->saveXML();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Alias for saveXML()
|
||||
*
|
||||
@ -358,9 +372,15 @@ abstract class Zend_Gdata_App_Base
|
||||
$majorVersion = 1,
|
||||
$minorVersion = null)
|
||||
{
|
||||
// Check for a memoized result
|
||||
$key = $prefix . ' ' .
|
||||
(is_null($majorVersion) ? 'NULL' : $majorVersion) .
|
||||
' '. (is_null($minorVersion) ? 'NULL' : $minorVersion);
|
||||
if (array_key_exists($key, self::$_namespaceLookupCache))
|
||||
return self::$_namespaceLookupCache[$key];
|
||||
// If no match, return the prefix by default
|
||||
$result = $prefix;
|
||||
|
||||
|
||||
// Find tuple of keys that correspond to the namespace we should use
|
||||
if (isset($this->_namespaces[$prefix])) {
|
||||
// Major version search
|
||||
@ -374,7 +394,10 @@ abstract class Zend_Gdata_App_Base
|
||||
// Extract NS
|
||||
$result = $nsData[$foundMinorV];
|
||||
}
|
||||
|
||||
|
||||
// Memoize result
|
||||
self::$_namespaceLookupCache[$key] = $result;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -385,6 +408,12 @@ abstract class Zend_Gdata_App_Base
|
||||
* list of registered namespaces for use by
|
||||
* $this->lookupNamespace().
|
||||
*
|
||||
* WARNING: Currently, registering a namespace will NOT invalidate any
|
||||
* memoized data stored in $_namespaceLookupCache. Under normal
|
||||
* use, this behavior is acceptable. If you are adding
|
||||
* contradictory data to the namespace lookup table, you must
|
||||
* call flushNamespaceLookupCache().
|
||||
*
|
||||
* @param string $prefix The namespace prefix
|
||||
* @param string $namespaceUri The full namespace URI
|
||||
* @param integer $majorVersion The major protocol version in effect.
|
||||
@ -396,12 +425,43 @@ abstract class Zend_Gdata_App_Base
|
||||
public function registerNamespace($prefix,
|
||||
$namespaceUri,
|
||||
$majorVersion = 1,
|
||||
$minorVersion = null)
|
||||
$minorVersion = 0)
|
||||
{
|
||||
$this->_namespaces[$prefix][$majorVersion][$minorVersion] =
|
||||
$namespaceUri;
|
||||
$namespaceUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush namespace lookup cache.
|
||||
*
|
||||
* Empties the namespace lookup cache. Call this function if you have
|
||||
* added data to the namespace lookup table that contradicts values that
|
||||
* may have been cached during a previous call to lookupNamespace().
|
||||
*/
|
||||
public static function flushNamespaceLookupCache()
|
||||
{
|
||||
self::$_namespaceLookupCache = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an array of namespaces to the registered list.
|
||||
*
|
||||
* Takes an array in the format of:
|
||||
* namespace prefix, namespace URI, major protocol version,
|
||||
* minor protocol version and adds them with calls to ->registerNamespace()
|
||||
*
|
||||
* @param array $namespaceArray An array of namespaces.
|
||||
* @return void
|
||||
*/
|
||||
public function registerAllNamespaces($namespaceArray)
|
||||
{
|
||||
foreach($namespaceArray as $namespace) {
|
||||
$this->registerNamespace(
|
||||
$namespace[0], $namespace[1], $namespace[2], $namespace[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Magic getter to allow access like $entry->foo to call $entry->getFoo()
|
||||
* Alternatively, if no getFoo() is defined, but a $_foo protected variable
|
||||
@ -442,7 +502,7 @@ abstract class Zend_Gdata_App_Base
|
||||
$method = 'set'.ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return call_user_func(array(&$this, $method), $val);
|
||||
} else if (isset($this->{'_' . $name}) || is_null($this->{'_' . $name})) {
|
||||
} else if (isset($this->{'_' . $name}) || ($this->{'_' . $name} === null)) {
|
||||
$this->{'_' . $name} = $val;
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/MediaSource.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
@ -51,8 +52,8 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
||||
* @var string
|
||||
*/
|
||||
protected $_slug = null;
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* The content type for the attached file (example image/png)
|
||||
*
|
||||
* @return string The content type
|
||||
@ -62,7 +63,7 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
||||
return $this->_contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set the content type for the file attached (example image/png)
|
||||
*
|
||||
* @param string $value The content type
|
||||
@ -75,7 +76,7 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Slug header value. Used by some services to determine the
|
||||
* Returns the Slug header value. Used by some services to determine the
|
||||
* title for the uploaded file. Returns null if no slug should be used.
|
||||
*
|
||||
* @return string
|
||||
@ -85,7 +86,7 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Slug header value. Used by some services to determine the
|
||||
* Sets the Slug header value. Used by some services to determine the
|
||||
* title for the uploaded file. A null value indicates no slug header.
|
||||
*
|
||||
* @var string The slug value
|
||||
@ -135,7 +136,7 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
||||
$method = 'set'.ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return call_user_func(array(&$this, $method), $val);
|
||||
} else if (isset($this->{'_' . $name}) || is_null($this->{'_' . $name})) {
|
||||
} else if (isset($this->{'_' . $name}) || ($this->{'_' . $name} === null)) {
|
||||
$this->{'_' . $name} = $val;
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
@ -173,5 +174,5 @@ abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSou
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ require_once 'Zend/Gdata/App/AuthException.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,11 @@ require_once 'Zend/Gdata/App/FeedEntryParent.php';
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Content.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Edited
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Edited.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Published
|
||||
*/
|
||||
@ -55,6 +60,7 @@ require_once 'Zend/Gdata/App/Extension/Control.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
@ -110,6 +116,13 @@ class Zend_Gdata_App_Entry extends Zend_Gdata_App_FeedEntryParent
|
||||
*/
|
||||
protected $_control = null;
|
||||
|
||||
/**
|
||||
* app:edited element
|
||||
*
|
||||
* @var Zend_Gdata_App_Extension_Edited
|
||||
*/
|
||||
protected $_edited = null;
|
||||
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
@ -128,6 +141,9 @@ class Zend_Gdata_App_Entry extends Zend_Gdata_App_FeedEntryParent
|
||||
if ($this->_control != null) {
|
||||
$element->appendChild($this->_control->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_edited != null) {
|
||||
$element->appendChild($this->_edited->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
@ -160,6 +176,11 @@ class Zend_Gdata_App_Entry extends Zend_Gdata_App_FeedEntryParent
|
||||
$control->transferFromDOM($child);
|
||||
$this->_control = $control;
|
||||
break;
|
||||
case $this->lookupNamespace('app') . ':' . 'edited':
|
||||
$edited = new Zend_Gdata_App_Extension_Edited();
|
||||
$edited->transferFromDOM($child);
|
||||
$this->_edited = $edited;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
@ -220,15 +241,15 @@ class Zend_Gdata_App_Entry extends Zend_Gdata_App_FeedEntryParent
|
||||
{
|
||||
// Get URI
|
||||
$editLink = $this->getEditLink();
|
||||
if (is_null($uri) && $editLink != null) {
|
||||
if (($uri === null) && $editLink != null) {
|
||||
$uri = $editLink->getHref();
|
||||
}
|
||||
|
||||
|
||||
// Set classname to current class, if not otherwise set
|
||||
if (is_null($className)) {
|
||||
if ($className === null) {
|
||||
$className = get_class($this);
|
||||
}
|
||||
|
||||
|
||||
// Append ETag, if present (Gdata v2 and above, only) and doesn't
|
||||
// conflict with existing headers
|
||||
if ($this->_etag != null
|
||||
@ -236,7 +257,7 @@ class Zend_Gdata_App_Entry extends Zend_Gdata_App_FeedEntryParent
|
||||
&& !array_key_exists('If-None-Match', $extraHeaders)) {
|
||||
$extraHeaders['If-None-Match'] = $this->_etag;
|
||||
}
|
||||
|
||||
|
||||
// If an HTTP 304 status (Not Modified)is returned, then we return
|
||||
// null.
|
||||
$result = null;
|
||||
@ -246,7 +267,7 @@ class Zend_Gdata_App_Entry extends Zend_Gdata_App_FeedEntryParent
|
||||
if ($e->getResponse()->getStatus() != '304')
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ require_once 'Zend/Exception.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Base.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension/Person.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension/Text.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
@ -66,7 +67,7 @@ class Zend_Gdata_App_Extension_Content extends Zend_Gdata_App_Extension_Text
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Src
|
||||
* @return string
|
||||
*/
|
||||
public function getSrc()
|
||||
{
|
||||
@ -74,7 +75,7 @@ class Zend_Gdata_App_Extension_Content extends Zend_Gdata_App_Extension_Text
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Src $value
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setSrc($value)
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension/Person.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -35,6 +35,7 @@ require_once 'Zend/Gdata/App/Extension/Draft.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
48
libs/Zend/Gdata/App/Extension/Edited.php
Normal file
48
libs/Zend/Gdata/App/Extension/Edited.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the app:edited element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Edited extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'edited';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
@ -31,6 +31,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -45,6 +45,7 @@ require_once 'Zend/Gdata/App/Extension/Uri.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension/Text.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -33,6 +33,7 @@ require_once 'Zend/Gdata/App/FeedSourceParent.php';
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension/Text.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension/Text.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -31,6 +31,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension/Text.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/Extension.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -35,6 +35,7 @@ require_once 'Zend/Gdata/App/FeedSourceParent.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
@ -112,6 +113,8 @@ class Zend_Gdata_App_Feed extends Zend_Gdata_App_FeedSourceParent
|
||||
case $this->lookupNamespace('atom') . ':' . 'entry':
|
||||
$newEntry = new $this->_entryClassName($child);
|
||||
$newEntry->setHttpClient($this->getHttpClient());
|
||||
$newEntry->setMajorProtocolVersion($this->getMajorProtocolVersion());
|
||||
$newEntry->setMinorProtocolVersion($this->getMinorProtocolVersion());
|
||||
$this->_entry[] = $newEntry;
|
||||
break;
|
||||
default:
|
||||
@ -308,4 +311,41 @@ class Zend_Gdata_App_Feed extends Zend_Gdata_App_FeedSourceParent
|
||||
return $service->getFeed($previousLinkHref, get_class($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the major protocol version that should be used. Values < 1 will
|
||||
* cause a Zend_Gdata_App_InvalidArgumentException to be thrown.
|
||||
*
|
||||
* This value will be propogated to all child entries.
|
||||
*
|
||||
* @see _majorProtocolVersion
|
||||
* @param (int|NULL) $value The major protocol version to use.
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
public function setMajorProtocolVersion($value)
|
||||
{
|
||||
parent::setMajorProtocolVersion($value);
|
||||
foreach ($this->entries as $entry) {
|
||||
$entry->setMajorProtocolVersion($value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the minor protocol version that should be used. If set to NULL, no
|
||||
* minor protocol version will be sent to the server. Values < 0 will
|
||||
* cause a Zend_Gdata_App_InvalidArgumentException to be thrown.
|
||||
*
|
||||
* This value will be propogated to all child entries.
|
||||
*
|
||||
* @see _minorProtocolVersion
|
||||
* @param (int|NULL) $value The minor protocol version to use.
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
public function setMinorProtocolVersion($value)
|
||||
{
|
||||
parent::setMinorProtocolVersion($value);
|
||||
foreach ($this->entries as $entry) {
|
||||
$entry->setMinorProtocolVersion($value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ require_once 'Zend/Version.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
@ -87,7 +88,7 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
*/
|
||||
protected $_service = null;
|
||||
|
||||
/**
|
||||
/**
|
||||
* The HTTP ETag associated with this entry. Used for optimistic
|
||||
* concurrency in protoco v2 or greater.
|
||||
*
|
||||
@ -104,6 +105,26 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
protected $_title = null;
|
||||
protected $_updated = null;
|
||||
|
||||
/**
|
||||
* Indicates the major protocol version that should be used.
|
||||
* At present, recognized values are either 1 or 2. However, any integer
|
||||
* value >= 1 is considered valid.
|
||||
*
|
||||
* @see setMajorProtocolVersion()
|
||||
* @see getMajorProtocolVersion()
|
||||
*/
|
||||
protected $_majorProtocolVersion = 1;
|
||||
|
||||
/**
|
||||
* Indicates the minor protocol version that should be used. Can be set
|
||||
* to either an integer >= 0, or NULL if no minor version should be sent
|
||||
* to the server.
|
||||
*
|
||||
* @see setMinorProtocolVersion()
|
||||
* @see getMinorProtocolVersion()
|
||||
*/
|
||||
protected $_minorProtocolVersion = null;
|
||||
|
||||
/**
|
||||
* Constructs a Feed or Entry
|
||||
*/
|
||||
@ -111,25 +132,11 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
{
|
||||
if (!($element instanceof DOMElement)) {
|
||||
if ($element) {
|
||||
// Load the feed as an XML DOMDocument object
|
||||
@ini_set('track_errors', 1);
|
||||
$doc = new DOMDocument();
|
||||
$success = @$doc->loadXML($element);
|
||||
@ini_restore('track_errors');
|
||||
if (!$success) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg");
|
||||
}
|
||||
$element = $doc->getElementsByTagName($this->_rootElement)->item(0);
|
||||
if (!$element) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.');
|
||||
}
|
||||
$this->transferFromDOM($element);
|
||||
$this->transferFromXML($element);
|
||||
}
|
||||
} else {
|
||||
$this->transferFromDOM($element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -180,7 +187,7 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
$this->_service = $instance;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the active service instance for this object. This will be used to
|
||||
* perform network requests, such as when calling save() and delete().
|
||||
@ -362,8 +369,8 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
|
||||
/**
|
||||
* Given a particular 'rel' value, this method returns a matching
|
||||
* Zend_Gdata_App_Extension_Link element. If the 'rel' value
|
||||
* is not provided, the full array of Zend_Gdata_App_Extension_Link
|
||||
* Zend_Gdata_App_Extension_Link element. If the 'rel' value
|
||||
* is not provided, the full array of Zend_Gdata_App_Extension_Link
|
||||
* elements is returned. In an atom feed, each link is represented
|
||||
* by an atom:link element. The 'rel' value passed to this function
|
||||
* is the atom:link/@rel attribute. Example rel values include 'self',
|
||||
@ -392,7 +399,7 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
/**
|
||||
* Returns the Zend_Gdata_App_Extension_Link element which represents
|
||||
* the URL used to edit this resource. This link is in the atom feed/entry
|
||||
* as an atom:link with a rel attribute value of 'edit'.
|
||||
* as an atom:link with a rel attribute value of 'edit'.
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link The link, or null if not found
|
||||
*/
|
||||
@ -404,8 +411,8 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
/**
|
||||
* Returns the Zend_Gdata_App_Extension_Link element which represents
|
||||
* the URL used to retrieve the next chunk of results when paging through
|
||||
* a feed. This link is in the atom feed as an atom:link with a
|
||||
* rel attribute value of 'next'.
|
||||
* a feed. This link is in the atom feed as an atom:link with a
|
||||
* rel attribute value of 'next'.
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link The link, or null if not found
|
||||
*/
|
||||
@ -416,9 +423,9 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
|
||||
/**
|
||||
* Returns the Zend_Gdata_App_Extension_Link element which represents
|
||||
* the URL used to retrieve the previous chunk of results when paging
|
||||
* through a feed. This link is in the atom feed as an atom:link with a
|
||||
* rel attribute value of 'previous'.
|
||||
* the URL used to retrieve the previous chunk of results when paging
|
||||
* through a feed. This link is in the atom feed as an atom:link with a
|
||||
* rel attribute value of 'previous'.
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link The link, or null if not found
|
||||
*/
|
||||
@ -438,8 +445,8 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
/**
|
||||
* Returns the Zend_Gdata_App_Extension_Link element which represents
|
||||
* the URL used to retrieve the entry or feed represented by this object
|
||||
* This link is in the atom feed/entry as an atom:link with a
|
||||
* rel attribute value of 'self'.
|
||||
* This link is in the atom feed/entry as an atom:link with a
|
||||
* rel attribute value of 'self'.
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link The link, or null if not found
|
||||
*/
|
||||
@ -451,11 +458,11 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
/**
|
||||
* Returns the Zend_Gdata_App_Extension_Link element which represents
|
||||
* the URL for an alternate view of the data represented by this feed or
|
||||
* entry. This alternate view is commonly a user-facing webpage, blog
|
||||
* entry. This alternate view is commonly a user-facing webpage, blog
|
||||
* post, etc. The MIME type for the data at the URL is available from the
|
||||
* returned Zend_Gdata_App_Extension_Link element.
|
||||
* This link is in the atom feed/entry as an atom:link with a
|
||||
* rel attribute value of 'self'.
|
||||
* returned Zend_Gdata_App_Extension_Link element.
|
||||
* This link is in the atom feed/entry as an atom:link with a
|
||||
* rel attribute value of 'self'.
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link The link, or null if not found
|
||||
*/
|
||||
@ -505,8 +512,8 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the title of this feed or entry.
|
||||
* The title is an extremely short textual representation of this
|
||||
* Returns a string representation of the title of this feed or entry.
|
||||
* The title is an extremely short textual representation of this
|
||||
* resource and is found as an atom:title element in a feed or entry
|
||||
*
|
||||
* @return string
|
||||
@ -555,7 +562,7 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
/**
|
||||
* Set the Etag for the current entry to $value. Setting $value to null
|
||||
* unsets the Etag.
|
||||
*
|
||||
*
|
||||
* @param string|null $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
@ -573,4 +580,101 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
return $this->_etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the major protocol version that should be used. Values < 1
|
||||
* (excluding NULL) will cause a Zend_Gdata_App_InvalidArgumentException
|
||||
* to be thrown.
|
||||
*
|
||||
* @see _majorProtocolVersion
|
||||
* @param (int|NULL) $value The major protocol version to use.
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
public function setMajorProtocolVersion($value)
|
||||
{
|
||||
if (!($value >= 1) && ($value !== null)) {
|
||||
require_once('Zend/Gdata/App/InvalidArgumentException.php');
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Major protocol version must be >= 1');
|
||||
}
|
||||
$this->_majorProtocolVersion = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the major protocol version that is in use.
|
||||
*
|
||||
* @see _majorProtocolVersion
|
||||
* @return (int|NULL) The major protocol version in use.
|
||||
*/
|
||||
public function getMajorProtocolVersion()
|
||||
{
|
||||
return $this->_majorProtocolVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the minor protocol version that should be used. If set to NULL, no
|
||||
* minor protocol version will be sent to the server. Values < 0 will
|
||||
* cause a Zend_Gdata_App_InvalidArgumentException to be thrown.
|
||||
*
|
||||
* @see _minorProtocolVersion
|
||||
* @param (int|NULL) $value The minor protocol version to use.
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
public function setMinorProtocolVersion($value)
|
||||
{
|
||||
if (!($value >= 0)) {
|
||||
require_once('Zend/Gdata/App/InvalidArgumentException.php');
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Minor protocol version must be >= 0 or null');
|
||||
}
|
||||
$this->_minorProtocolVersion = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minor protocol version that is in use.
|
||||
*
|
||||
* @see _minorProtocolVersion
|
||||
* @return (int|NULL) The major protocol version in use, or NULL if no
|
||||
* minor version is specified.
|
||||
*/
|
||||
public function getMinorProtocolVersion()
|
||||
{
|
||||
return $this->_minorProtocolVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full version of a namespace prefix
|
||||
*
|
||||
* Looks up a prefix (atom:, etc.) in the list of registered
|
||||
* namespaces and returns the full namespace URI if
|
||||
* available. Returns the prefix, unmodified, if it's not
|
||||
* registered.
|
||||
*
|
||||
* The current entry or feed's version will be used when performing the
|
||||
* namespace lookup unless overridden using $majorVersion and
|
||||
* $minorVersion. If the entry/fee has a null version, then the latest
|
||||
* protocol version will be used by default.
|
||||
*
|
||||
* @param string $prefix The namespace prefix to lookup.
|
||||
* @param integer $majorVersion The major protocol version in effect.
|
||||
* Defaults to null (auto-select).
|
||||
* @param integer $minorVersion The minor protocol version in effect.
|
||||
* Defaults to null (auto-select).
|
||||
* @return string
|
||||
*/
|
||||
public function lookupNamespace($prefix,
|
||||
$majorVersion = null,
|
||||
$minorVersion = null)
|
||||
{
|
||||
// Auto-select current version
|
||||
if ($majorVersion === null) {
|
||||
$majorVersion = $this->getMajorProtocolVersion();
|
||||
}
|
||||
if ($minorVersion === null) {
|
||||
$minorVersion = $this->getMinorProtocolVersion();
|
||||
}
|
||||
|
||||
// Perform lookup
|
||||
return parent::lookupNamespace($prefix, $majorVersion, $minorVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ require_once 'Zend/Gdata/App/Extension/Subtitle.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -37,6 +37,7 @@ require_once 'Zend/Http/Client/Exception.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -33,6 +33,7 @@ require_once 'Zend/Gdata/App/Exception.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -32,6 +32,7 @@ require_once 'Zend/Gdata/App/Exception.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -31,22 +31,17 @@ require_once 'Zend/Gdata/App/Entry.php';
|
||||
require_once 'Zend/Gdata/App/MediaSource.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Mime
|
||||
* @see Zend_Gdata_MediaMimeStream
|
||||
*/
|
||||
require_once 'Zend/Mime.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Mime_Message
|
||||
*/
|
||||
require_once 'Zend/Mime/Message.php';
|
||||
|
||||
require_once 'Zend/Gdata/MediaMimeStream.php';
|
||||
|
||||
/**
|
||||
* Concrete class for working with Atom entries containing multi-part data.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_MediaEntry extends Zend_Gdata_App_Entry
|
||||
@ -54,17 +49,10 @@ class Zend_Gdata_App_MediaEntry extends Zend_Gdata_App_Entry
|
||||
/**
|
||||
* The attached MediaSource/file
|
||||
*
|
||||
* @var Zend_Gdata_App_MediaSource
|
||||
* @var Zend_Gdata_App_MediaSource
|
||||
*/
|
||||
protected $_mediaSource = null;
|
||||
|
||||
/**
|
||||
* The Zend_Mime object used to generate the boundary
|
||||
*
|
||||
* @var Zend_Mime
|
||||
*/
|
||||
protected $_mime = null;
|
||||
|
||||
/**
|
||||
* Constructs a new MediaEntry, representing XML data and optional
|
||||
* file to upload
|
||||
@ -75,50 +63,29 @@ class Zend_Gdata_App_MediaEntry extends Zend_Gdata_App_Entry
|
||||
public function __construct($element = null, $mediaSource = null)
|
||||
{
|
||||
parent::__construct($element);
|
||||
$this->_mime = new Zend_Mime();
|
||||
$this->_mediaSource = $mediaSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Zend_Mime object associated with this MediaEntry. This
|
||||
* object is used to generate the media boundaries.
|
||||
*
|
||||
* @return Zend_Mime The Zend_Mime object associated with this MediaEntry.
|
||||
*/
|
||||
public function getMime()
|
||||
{
|
||||
return $this->_mime;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the MIME multipart representation of this MediaEntry.
|
||||
*
|
||||
* @return string The MIME multipart representation of this MediaEntry
|
||||
* @return string|Zend_Gdata_MediaMimeStream The MIME multipart
|
||||
* representation of this MediaEntry. If the entry consisted only
|
||||
* of XML, a string is returned.
|
||||
*/
|
||||
public function encode()
|
||||
{
|
||||
$xmlData = $this->saveXML();
|
||||
if ($this->getMediaSource() === null) {
|
||||
$mediaSource = $this->getMediaSource();
|
||||
if ($mediaSource === null) {
|
||||
// No attachment, just send XML for entry
|
||||
return $xmlData;
|
||||
} else {
|
||||
$mimeMessage = new Zend_Mime_Message();
|
||||
$mimeMessage->setMime($this->_mime);
|
||||
|
||||
$xmlPart = new Zend_Mime_Part($xmlData);
|
||||
$xmlPart->type = 'application/atom+xml';
|
||||
$xmlPart->encoding = null;
|
||||
$mimeMessage->addPart($xmlPart);
|
||||
|
||||
$binaryPart = new Zend_Mime_Part($this->getMediaSource()->encode());
|
||||
$binaryPart->type = $this->getMediaSource()->getContentType();
|
||||
$binaryPart->encoding = null;
|
||||
$mimeMessage->addPart($binaryPart);
|
||||
|
||||
return $mimeMessage->generateMessage();
|
||||
return new Zend_Gdata_MediaMimeStream($xmlData,
|
||||
$mediaSource->getFilename(), $mediaSource->getContentType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the MediaSource object representing the file attached to this
|
||||
* MediaEntry.
|
||||
@ -147,15 +114,5 @@ class Zend_Gdata_App_MediaEntry extends Zend_Gdata_App_Entry
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the boundary used in the MIME multipart message
|
||||
*
|
||||
* @return string The boundary used in the MIME multipart message
|
||||
*/
|
||||
public function getBoundary()
|
||||
{
|
||||
return $this->_mime->boundary();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ require_once 'Zend/Gdata/App/BaseMediaSource.php';
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -25,6 +25,7 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
@ -25,6 +25,7 @@
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
@ -79,7 +80,7 @@ class Zend_Gdata_App_Util
|
||||
throw new Zend_Gdata_App_Exception("Empty namespace collection encountered.");
|
||||
}
|
||||
|
||||
if (is_null($maximumKey)) {
|
||||
if ($maximumKey === null) {
|
||||
// If the key is null, then we return the maximum available
|
||||
$keys = array_keys($collection);
|
||||
sort($keys);
|
||||
|
41
libs/Zend/Gdata/App/VersionException.php
Normal file
41
libs/Zend/Gdata/App/VersionException.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_Exception
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
|
||||
/**
|
||||
* Gdata APP exceptions
|
||||
*
|
||||
* Class to represent version exceptions that occur during Gdata APP operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_VersionException extends Zend_Gdata_App_Exception
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user