|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata.php'; 00028 00032 require_once 'Zend/Gdata/App/MediaEntry.php'; 00033 00043 class Zend_Gdata_Entry extends Zend_Gdata_App_MediaEntry 00044 { 00045 00046 protected $_entryClassName = 'Zend_Gdata_Entry'; 00047 00048 public function __construct($element = null) 00049 { 00050 $this->registerAllNamespaces(Zend_Gdata::$namespaces); 00051 parent::__construct($element); 00052 } 00053 00054 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00055 { 00056 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00057 // ETags are special. We only support them in protocol >= 2.X. 00058 // This will be duplicated by the HTTP ETag header. 00059 if ($majorVersion >= 2) { 00060 if ($this->_etag != null) { 00061 $element->setAttributeNS($this->lookupNamespace('gd'), 00062 'gd:etag', 00063 $this->_etag); 00064 } 00065 } 00066 return $element; 00067 } 00068 00069 protected function takeChildFromDOM($child) 00070 { 00071 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 00072 switch ($absoluteNodeName) { 00073 case $this->lookupNamespace('atom') . ':' . 'content': 00074 $content = new Zend_Gdata_App_Extension_Content(); 00075 $content->transferFromDOM($child); 00076 $this->_content = $content; 00077 break; 00078 case $this->lookupNamespace('atom') . ':' . 'published': 00079 $published = new Zend_Gdata_App_Extension_Published(); 00080 $published->transferFromDOM($child); 00081 $this->_published = $published; 00082 break; 00083 case $this->lookupNamespace('atom') . ':' . 'source': 00084 $source = new Zend_Gdata_App_Extension_Source(); 00085 $source->transferFromDOM($child); 00086 $this->_source = $source; 00087 break; 00088 case $this->lookupNamespace('atom') . ':' . 'summary': 00089 $summary = new Zend_Gdata_App_Extension_Summary(); 00090 $summary->transferFromDOM($child); 00091 $this->_summary = $summary; 00092 break; 00093 case $this->lookupNamespace('app') . ':' . 'control': 00094 $control = new Zend_Gdata_App_Extension_Control(); 00095 $control->transferFromDOM($child); 00096 $this->_control = $control; 00097 break; 00098 default: 00099 parent::takeChildFromDOM($child); 00100 break; 00101 } 00102 } 00103 00111 protected function takeAttributeFromDOM($attribute) 00112 { 00113 switch ($attribute->localName) { 00114 case 'etag': 00115 // ETags are special, since they can be conveyed by either the 00116 // HTTP ETag header or as an XML attribute. 00117 $etag = $attribute->nodeValue; 00118 if ($this->_etag === null) { 00119 $this->_etag = $etag; 00120 } 00121 elseif ($this->_etag != $etag) { 00122 require_once('Zend/Gdata/App/IOException.php'); 00123 throw new Zend_Gdata_App_IOException("ETag mismatch"); 00124 } 00125 break; 00126 default: 00127 parent::takeAttributeFromDOM($attribute); 00128 break; 00129 } 00130 } 00131 00132 }