Add support for the creative commons license Tag in RSS 2.0
Logged In: YES user_id=2243 Originator: YES
Here's my implementation for this:
class FeedItem: Add: /** * Creative commons license */ var $createCommonsLicense;
class RSSCreator091: Change function createFeed: function createFeed() { $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; $feed.= $this->_createGeneratorComment(); $feed.= $this->_createStylesheetReferences(); $feed.= "<rss version=\"".$this->RSSVersion."\"\n"; if ($this->createCommonsLicense != '') { $feed .= " xmlns:creativeCommons=\"http://backend.userland.com/creativeCommonsRssModule\"\n"; } if ((is_array($this->namespace)) && (count($this->namespace > 0))) { foreach($this->namespace as $index => $value) { $feed.= " xmlns:".$value."\n"; } } $feed.= ">\n"; $feed.= " <channel>\n"; $feed.= " <title>".FeedCreator::iTrunc(htmlspecialchars($this->title),100)."</title>\n"; $this->descriptionTruncSize = 500; $feed.= " <description>".$this->getDescription()."</description>\n"; $feed.= " <link>".$this->link."</link>\n"; $now = new FeedDate(); $feed.= " <lastBuildDate>".htmlspecialchars($now->rfc822())."</lastBuildDate>\n"; $feed.= " <generator>". $this->version()."</generator>\n"; if ($this->createCommonsLicense != '') { $feed.= " <creativeCommons:license>" . $this->createCommonsLicense . "</creativeCommons:license>\n"; }
Log in to post a comment.
Logged In: YES
user_id=2243
Originator: YES
Here's my implementation for this:
class FeedItem:
Add:
/**
* Creative commons license
*/
var $createCommonsLicense;
class RSSCreator091:
Change function createFeed:
function createFeed() {
$feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
$feed.= $this->_createGeneratorComment();
$feed.= $this->_createStylesheetReferences();
$feed.= "<rss version=\"".$this->RSSVersion."\"\n";
if ($this->createCommonsLicense != '') {
$feed .= " xmlns:creativeCommons=\"http://backend.userland.com/creativeCommonsRssModule\"\n";
}
if ((is_array($this->namespace)) && (count($this->namespace > 0))) {
foreach($this->namespace as $index => $value) {
$feed.= " xmlns:".$value."\n";
}
}
$feed.= ">\n";
$feed.= " <channel>\n";
$feed.= " <title>".FeedCreator::iTrunc(htmlspecialchars($this->title),100)."</title>\n";
$this->descriptionTruncSize = 500;
$feed.= " <description>".$this->getDescription()."</description>\n";
$feed.= " <link>".$this->link."</link>\n";
$now = new FeedDate();
$feed.= " <lastBuildDate>".htmlspecialchars($now->rfc822())."</lastBuildDate>\n";
$feed.= " <generator>". $this->version()."</generator>\n";
if ($this->createCommonsLicense != '') {
$feed.= " <creativeCommons:license>" . $this->createCommonsLicense . "</creativeCommons:license>\n";
}