コード例 #1
0
ファイル: Feed.php プロジェクト: hybridneo/zendgdata
 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 {
     $element = parent::getDOM($doc, $majorVersion, $minorVersion);
     if ($this->_totalResults != null) {
         $element->appendChild($this->_totalResults->getDOM($element->ownerDocument));
     }
     if ($this->_startIndex != null) {
         $element->appendChild($this->_startIndex->getDOM($element->ownerDocument));
     }
     if ($this->_itemsPerPage != null) {
         $element->appendChild($this->_itemsPerPage->getDOM($element->ownerDocument));
     }
     // ETags are special. We only support them in protocol >= 2.X.
     // This will be duplicated by the HTTP ETag header.
     if ($majorVersion >= 2) {
         if ($this->_etag != null) {
             $element->setAttributeNS($this->lookupNamespace('gd'), 'gd:etag', $this->_etag->getFieldValue());
         }
     }
     return $element;
 }
コード例 #2
0
ファイル: Feed.php プロジェクト: hybridneo/zendgdata
 /**
  * Creates individual Entry objects of the appropriate type and
  * stores them in the $_entry array based upon DOM data.
  *
  * @param DOMNode $child The DOMNode to process
  */
 protected function takeChildFromDOM($child)
 {
     $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
     switch ($absoluteNodeName) {
         case $this->lookupNamespace('openSearch') . ':' . 'totalResults':
             $totalResults = new Extension\OpenSearchTotalResults();
             $totalResults->transferFromDOM($child);
             $this->_totalResults = $totalResults;
             break;
         case $this->lookupNamespace('openSearch') . ':' . 'startIndex':
             $startIndex = new Extension\OpenSearchStartIndex();
             $startIndex->transferFromDOM($child);
             $this->_startIndex = $startIndex;
             break;
         case $this->lookupNamespace('openSearch') . ':' . 'itemsPerPage':
             $itemsPerPage = new Extension\OpenSearchItemsPerPage();
             $itemsPerPage->transferFromDOM($child);
             $this->_itemsPerPage = $itemsPerPage;
             break;
         default:
             parent::takeChildFromDOM($child);
             break;
     }
 }
コード例 #3
0
 public function testExtensionAttributes()
 {
     $extensionAttributes = $this->openSearchTotalResults->extensionAttributes;
     $extensionAttributes['foo1'] = array('name' => 'foo1', 'value' => 'bar');
     $extensionAttributes['foo2'] = array('name' => 'foo2', 'value' => 'rab');
     $this->openSearchTotalResults->extensionAttributes = $extensionAttributes;
     $this->assertEquals('bar', $this->openSearchTotalResults->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $this->openSearchTotalResults->extensionAttributes['foo2']['value']);
     $openSearchTotalResultsXml = $this->openSearchTotalResults->saveXML();
     $newOpenSearchTotalResults = new Extension\OpenSearchTotalResults();
     $newOpenSearchTotalResults->transferFromXML($openSearchTotalResultsXml);
     $this->assertEquals('bar', $newOpenSearchTotalResults->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $newOpenSearchTotalResults->extensionAttributes['foo2']['value']);
 }