Zend_Gdata_App_MediaEntry

Concrete class for working with Atom entries containing multi-part data.

Defined (1)

The class is defined in the following location(s).

/inc/VideoUploader/includes/Zend/Gdata/App/MediaEntry.php  
  1. class Zend_Gdata_App_MediaEntry extends Zend_Gdata_App_Entry 
  2. /** 
  3. * The attached MediaSource/file 
  4. * @var Zend_Gdata_App_MediaSource 
  5. */ 
  6. protected $_mediaSource = null; 
  7.  
  8. /** 
  9. * Constructs a new MediaEntry, representing XML data and optional 
  10. * file to upload 
  11. * @param DOMElement $element (optional) DOMElement from which this 
  12. * object should be constructed. 
  13. */ 
  14. public function __construct($element = null, $mediaSource = null) 
  15. parent::__construct($element); 
  16. $this->_mediaSource = $mediaSource; 
  17.  
  18. /** 
  19. * Return the MIME multipart representation of this MediaEntry. 
  20. * @return string|Zend_Gdata_MediaMimeStream The MIME multipart 
  21. * representation of this MediaEntry. If the entry consisted only 
  22. * of XML, a string is returned. 
  23. */ 
  24. public function encode() 
  25. $xmlData = $this->saveXML(); 
  26. $mediaSource = $this->getMediaSource(); 
  27. if ($mediaSource === null) { 
  28. // No attachment, just send XML for entry 
  29. return $xmlData; 
  30. } else { 
  31. return new Zend_Gdata_MediaMimeStream($xmlData,  
  32. $mediaSource->getFilename(), $mediaSource->getContentType()); 
  33.  
  34. /** 
  35. * Return the MediaSource object representing the file attached to this 
  36. * MediaEntry. 
  37. * @return Zend_Gdata_App_MediaSource The attached MediaSource/file 
  38. */ 
  39. public function getMediaSource() 
  40. return $this->_mediaSource; 
  41.  
  42. /** 
  43. * Set the MediaSource object (file) for this MediaEntry 
  44. * @param Zend_Gdata_App_MediaSource $value The attached MediaSource/file 
  45. * @return Zend_Gdata_App_MediaEntry Provides a fluent interface 
  46. */ 
  47. public function setMediaSource($value) 
  48. if ($value instanceof Zend_Gdata_App_MediaSource) { 
  49. $this->_mediaSource = $value; 
  50. } else { 
  51. require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 
  52. throw new Zend_Gdata_App_InvalidArgumentException( 
  53. 'You must specify the media data as a class that conforms to Zend_Gdata_App_MediaSource.'); 
  54. return $this; 
  55.