public function setItemLink($link) { if ($this->version == RSS2 || $this->version == RSS1) { $this->addElement('link', $link); } else { $this->addElement('link', '', array('href' => $link)); $this->addElement('id', FeedWriter::uuid($link, 'urn:uuid:')); } }
/** * @desc Print channels * @access private * @return void */ private function printChannels() { //Start channel tag switch ($this->version) { case RSS2: echo '<channel>' . PHP_EOL; break; case RSS1: echo isset($this->data['ChannelAbout']) ? "<channel rdf:about=\"{$this->data['ChannelAbout']}\">" : "<channel rdf:about=\"{$this->channels['link']}\">"; break; } //Print Items of channel foreach ($this->channels as $key => $value) { if ($this->version == ATOM && $key == 'link') { // ATOM prints link element as href attribute echo $this->makeNode($key, '', array('href' => $value)); //Add the id for ATOM echo $this->makeNode('id', FeedWriter::uuid($value, 'urn:uuid:')); } else { echo $this->makeNode($key, $value); } } //RSS 1.0 have special tag <rdf:Seq> with channel if ($this->version == RSS1) { echo "<items>" . PHP_EOL . "<rdf:Seq>" . PHP_EOL; foreach ($this->items as $item) { $thisItems = $item->getElements(); echo "<rdf:li resource=\"{$thisItems['link']['content']}\"/>" . PHP_EOL; } echo "</rdf:Seq>" . PHP_EOL . "</items>" . PHP_EOL . "</channel>" . PHP_EOL; } }
/** * Set the unique identifier of the feed item * * @access public * @param string The unique identifier of this item * @return void */ public function setId($id) { if ($this->version == RSS2) { $this->addElement('guid', $id, array('isPermaLink' => 'false')); } else { if ($this->version == ATOM) { $this->addElement('id', FeedWriter::uuid($id, 'urn:uuid:'), NULL, TRUE); } } }
/** * Set the 'id' feed element * * @access public * @see http://essfeed.org/index.php/ESS_structure * * @param String value of 'id' feed tag * * @return void */ public function setId($el = NULL) { if ($el != NULL) { if ($this->controlRoot('id', $el) == FALSE) { throw new Exception("Error: '< id >' element is mandatory."); return; } $this->setRootElement('id', FeedWriter::uuid($el, 'EVENTID:')); } }