本文整理汇总了PHP中FeedDate::iso8601方法的典型用法代码示例。如果您正苦于以下问题:PHP FeedDate::iso8601方法的具体用法?PHP FeedDate::iso8601怎么用?PHP FeedDate::iso8601使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeedDate
的用法示例。
在下文中一共展示了FeedDate::iso8601方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFeed
function createFeed()
{
$feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
$feed .= $this->_createStylesheetReferences();
$feed .= "<feed version=\"0.1\" xmlns=\"http://www.tbray.org/ongoing/pie/0.1/pie.rnc\">\n";
$feed .= " <title>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars($this->title), 100) . "</title>\n";
$this->truncSize = 500;
$feed .= " <subtitle>" . $this->getDescription() . "</subtitle>\n";
$feed .= " <link>" . $this->link . "</link>\n";
for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <entry>\n";
$feed .= " <title>" . FeedCreator::iTrunc(FeedCreator::htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . "</title>\n";
$feed .= " <link>" . FeedCreator::htmlspecialchars($this->items[$i]->link) . "</link>\n";
$itemDate = new FeedDate($this->items[$i]->date);
$feed .= " <created>" . FeedCreator::htmlspecialchars($itemDate->iso8601()) . "</created>\n";
$feed .= " <issued>" . FeedCreator::htmlspecialchars($itemDate->iso8601()) . "</issued>\n";
$feed .= " <modified>" . FeedCreator::htmlspecialchars($itemDate->iso8601()) . "</modified>\n";
$feed .= " <id>" . FeedCreator::htmlspecialchars($this->items[$i]->guid) . "</id>\n";
if ($this->items[$i]->author != "") {
$feed .= " <author>\n";
$feed .= " <name>" . FeedCreator::htmlspecialchars($this->items[$i]->author) . "</name>\n";
if ($this->items[$i]->authorEmail != "") {
$feed .= " <email>" . $this->items[$i]->authorEmail . "</email>\n";
}
$feed .= " </author>\n";
}
$feed .= " <content type=\"text/html\" xml:lang=\"en-us\">\n";
$feed .= " <div xmlns=\"http://www.w3.org/1999/xhtml\">" . $this->items[$i]->getDescription() . "</div>\n";
$feed .= " </content>\n";
$feed .= " </entry>\n";
}
$feed .= "</feed>\n";
return $feed;
}
示例2: createFeed
function createFeed()
{
$feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
$feed .= $this->_createGeneratorComment();
$feed .= $this->_createStylesheetReferences();
$feed .= "<feed xmlns=\"http://www.w3.org/2005/Atom\"";
if ($this->language != "") {
$feed .= " xml:lang=\"" . $this->language . "\"";
}
$feed .= ">\n";
$feed .= " <title>" . htmlspecialchars($this->title) . "</title>\n";
$feed .= " <subtitle>" . htmlspecialchars($this->description) . "</subtitle>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->link) . "\"/>\n";
$feed .= " <id>" . htmlspecialchars($this->link) . "</id>\n";
$now = new FeedDate();
$feed .= " <updated>" . htmlspecialchars($now->iso8601()) . "</updated>\n";
if ($this->editor != "") {
$feed .= " <author>\n";
$feed .= " <name>" . $this->editor . "</name>\n";
if ($this->editorEmail != "") {
$feed .= " <email>" . $this->editorEmail . "</email>\n";
}
$feed .= " </author>\n";
}
$feed .= " <generator>" . FEEDCREATOR_VERSION . "</generator>\n";
$feed .= "<link rel=\"self\" type=\"application/atom+xml\" href=\"" . $this->syndicationURL . "\" />\n";
$feed .= $this->_createAdditionalElements($this->additionalElements, " ");
for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <entry>\n";
$feed .= " <title>" . htmlspecialchars(strip_tags($this->items[$i]->title)) . "</title>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->items[$i]->link) . "\"/>\n";
if ($this->items[$i]->date == "") {
$this->items[$i]->date = time();
}
$itemDate = new FeedDate($this->items[$i]->date);
$feed .= " <published>" . htmlspecialchars($itemDate->iso8601()) . "</published>\n";
$feed .= " <updated>" . htmlspecialchars($itemDate->iso8601()) . "</updated>\n";
$feed .= " <id>" . htmlspecialchars($this->items[$i]->link) . "</id>\n";
$feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
if ($this->items[$i]->author != "") {
$feed .= " <author>\n";
$feed .= " <name>" . htmlspecialchars($this->items[$i]->author) . "</name>\n";
$feed .= " </author>\n";
}
if ($this->items[$i]->description != "") {
$feed .= " <summary>" . htmlspecialchars($this->items[$i]->description) . "</summary>\n";
}
if ($this->items[$i]->enclosure != NULL) {
$feed .= " <link rel=\"enclosure\" href=\"" . $this->items[$i]->enclosure->url . "\" type=\"" . $this->items[$i]->enclosure->type . "\" length=\"" . $this->items[$i]->enclosure->length . "\" />\n";
}
$feed .= " </entry>\n";
}
$feed .= "</feed>\n";
return $feed;
}
示例3: createFeed
function createFeed()
{
$feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
$feed .= $this->_createGeneratorComment();
$feed .= $this->_createStylesheetReferences();
$feed .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\"";
if ($this->language != "") {
$feed .= " xml:lang=\"" . $this->language . "\"";
}
$feed .= ">\n";
$feed .= " <title>" . htmlspecialchars($this->title) . "</title>\n";
$feed .= " <tagline>" . htmlspecialchars($this->description) . "</tagline>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->link) . "\"/>\n";
$feed .= " <id>" . htmlspecialchars($this->link) . "</id>\n";
$now = new FeedDate();
$feed .= " <modified>" . htmlspecialchars($now->iso8601()) . "</modified>\n";
if ($this->editor != "") {
$feed .= " <author>\n";
$feed .= " <name>" . $this->editor . "</name>\n";
if ($this->editorEmail != "") {
$feed .= " <email>" . $this->editorEmail . "</email>\n";
}
$feed .= " </author>\n";
}
$feed .= " <generator>" . FEEDCREATOR_VERSION . "</generator>\n";
$feed .= $this->_createAdditionalElements($this->additionalElements, " ");
for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <entry>\n";
$feed .= " <title>" . htmlspecialchars(strip_tags($this->items[$i]->title)) . "</title>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->items[$i]->link) . "\"/>\n";
if ($this->items[$i]->date == "") {
$this->items[$i]->date = time();
}
$itemDate = new FeedDate($this->items[$i]->date);
$feed .= " <created>" . htmlspecialchars($itemDate->iso8601()) . "</created>\n";
$feed .= " <issued>" . htmlspecialchars($itemDate->iso8601()) . "</issued>\n";
$feed .= " <modified>" . htmlspecialchars($itemDate->iso8601()) . "</modified>\n";
$feed .= " <id>" . htmlspecialchars($this->items[$i]->link) . "</id>\n";
$feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
if ($this->items[$i]->author != "") {
$feed .= " <author>\n";
$feed .= " <name>" . htmlspecialchars($this->items[$i]->author) . "</name>\n";
$feed .= " </author>\n";
}
if ($this->items[$i]->description != "") {
$feed .= " <summary>" . htmlspecialchars($this->items[$i]->description) . "</summary>\n";
}
$feed .= " </entry>\n";
}
$feed .= "</feed>\n";
return $feed;
}
示例4: createFeed
/**
* Builds the Google Sitemap feed's text.
* The feed will contain all items previously added in the same order.
* @return string the feed's complete text
*/
function createFeed() {
$feed = "<?xml version=\"1.0\" encoding=\"{$this->encoding}\"?>\n";
$feed.= "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\"\n";
$feed.= " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
$feed.= " xsi:schemaLocation=\"http://www.google.com/schemas/sitemap/0.84\n";
$feed.= " http://www.google.com/schemas/sitemap/0.84/sitemap.xsd\">\n";
$ci = count($this->items);
for ($i=0;$i<$ci;$i++) {
$feed.= " <url>\n";
$feed.= " <loc>".$this->htmlspecialchars($this->items[$i]->link)."</loc>\n";
if (!empty($this->items[$i]->date)) {
$itemDate = new FeedDate($this->items[$i]->date);
$feed.= " <lastmod>".$this->htmlspecialchars($itemDate->iso8601())."</lastmod>\n";
}
if (!empty($this->items[$i]->priority)) {
$feed.= " <priority>".$this->htmlspecialchars($this->items[$i]->priority)."</priority>\n";
}
if (!empty($this->items[$i]->changefreq)) {
$feed.= " <changefreq>".$this->htmlspecialchars($this->items[$i]->changefreq)."</changefreq>\n";
}
$feed.= " </url>\n";
}
$feed.= "</urlset>\n";
return $feed;
}
示例5: createFeed
/**
* Builds the Google Sitemap feed's text.
* The feed will contain all items previously added in the same order.
* @return string the feed's complete text
*/
function createFeed()
{
$feed = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$feed .= "<sitemapindex xmlns=\"http://www.google.com/schemas/sitemap/0.84\"\n";
$feed .= "\t\t\t xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
$feed .= "\t\t\t xsi:schemaLocation=\"http://www.google.com/schemas/sitemap/0.84\n";
$feed .= "\t\t\t http://www.google.com/schemas/sitemap/0.84/siteindex.xsd\">\n";
$total = count($this->items);
for ($i = 0; $i < $total; $i++) {
$feed .= " <sitemap>\n";
$feed .= "\t<loc>" . htmlspecialchars($this->items[$i]->link) . "</loc>\n";
if ($this->items[$i]->date != "") {
$itemDate = new FeedDate($this->items[$i]->date);
$feed .= "\t<lastmod>" . htmlspecialchars($itemDate->iso8601()) . "</lastmod>\n";
}
$feed .= " </sitemap>\n";
}
$feed .= "</sitemapindex>\n";
return $feed;
}
示例6: createFeed
/**
* Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0.
* The feed will contain all items previously added in the same order.
* @return string the feed's complete text
*/
function createFeed()
{
$feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
$feed .= $this->_createGeneratorComment();
if ($this->cssStyleSheet == "") {
$cssStyleSheet = "http://www.w3.org/2000/08/w3c-synd/style.css";
}
$feed .= $this->_createStylesheetReferences();
$feed .= "<rdf:RDF\n";
$feed .= " xmlns=\"http://purl.org/rss/1.0/\"\n";
$feed .= " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
$feed .= " xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\n";
$feed .= " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
$feed .= " <channel rdf:about=\"" . $this->syndicationURL . "\">\n";
$feed .= " <title>" . htmlspecialchars($this->title) . "</title>\n";
$feed .= " <description>" . htmlspecialchars($this->description) . "</description>\n";
$feed .= " <link>" . $this->link . "</link>\n";
if ($this->image != null) {
$feed .= " <image rdf:resource=\"" . $this->image->url . "\" />\n";
}
$now = new FeedDate();
$feed .= " <dc:date>" . htmlspecialchars($now->iso8601()) . "</dc:date>\n";
$feed .= " <items>\n";
$feed .= " <rdf:Seq>\n";
for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <rdf:li rdf:resource=\"" . htmlspecialchars($this->items[$i]->link) . "\"/>\n";
}
$feed .= " </rdf:Seq>\n";
$feed .= " </items>\n";
$feed .= " </channel>\n";
if ($this->image != null) {
$feed .= " <image rdf:about=\"" . $this->image->url . "\">\n";
$feed .= " <title>" . $this->image->title . "</title>\n";
$feed .= " <link>" . $this->image->link . "</link>\n";
$feed .= " <url>" . $this->image->url . "</url>\n";
$feed .= " </image>\n";
}
$feed .= $this->_createAdditionalElements($this->additionalElements, " ");
for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <item rdf:about=\"" . htmlspecialchars($this->items[$i]->link) . "\">\n";
//$feed.= " <dc:type>Posting</dc:type>\n";
$feed .= " <dc:format>text/html</dc:format>\n";
if ($this->items[$i]->date != null) {
$itemDate = new FeedDate($this->items[$i]->date);
$feed .= " <dc:date>" . htmlspecialchars($itemDate->iso8601()) . "</dc:date>\n";
}
if ($this->items[$i]->source != "") {
$feed .= " <dc:source>" . htmlspecialchars($this->items[$i]->source) . "</dc:source>\n";
}
if ($this->items[$i]->author != "") {
$feed .= " <dc:creator>" . htmlspecialchars($this->items[$i]->author) . "</dc:creator>\n";
}
$feed .= " <title>" . htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", " "))) . "</title>\n";
$feed .= " <link>" . htmlspecialchars($this->items[$i]->link) . "</link>\n";
$feed .= " <description>" . htmlspecialchars($this->items[$i]->description) . "</description>\n";
$feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
$feed .= " </item>\n";
}
$feed .= "</rdf:RDF>\n";
return $feed;
}
示例7: createFeed
function createFeed()
{
$feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
$feed .= $this->_createGeneratorComment();
$feed .= "<feed xmlns=\"http://www.w3.org/2005/Atom\"";
if ($this->language != "") {
$feed .= " xml:lang=\"" . $this->language . "\"";
}
$feed .= ">\n";
$feed .= " <title type=\"html\">" . htmlspecialchars($this->title, ENT_COMPAT | ENT_HTML401, $this->encoding) . "</title>\n";
$feed .= " <tagline>" . htmlspecialchars($this->description, ENT_COMPAT | ENT_HTML401, $this->encoding) . "</tagline>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->link, ENT_COMPAT | ENT_HTML401, $this->encoding) . "\"/>\n";
$feed .= " <id>" . htmlspecialchars($this->link, ENT_COMPAT | ENT_HTML401, $this->encoding) . "</id>\n";
$now = new FeedDate();
$feed .= " <updated>" . htmlspecialchars($now->iso8601(), ENT_COMPAT | ENT_HTML401, $this->encoding) . "</updated>\n";
if ($this->editor != "") {
$feed .= " <author>\n";
$feed .= " <name>" . $this->editor . "</name>\n";
if ($this->editorEmail != "") {
$feed .= " <email>" . $this->editorEmail . "</email>\n";
}
$feed .= " </author>\n";
}
$feed .= " <generator>" . FEEDCREATOR_VERSION . "</generator>\n";
$feed .= $this->_createAdditionalElements($this->additionalElements, " ");
for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <entry>\n";
$feed .= " <title>" . htmlspecialchars(strip_tags($this->items[$i]->title), ENT_COMPAT | ENT_HTML401, $this->encoding) . "</title>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->items[$i]->link, ENT_COMPAT | ENT_HTML401, $this->encoding) . "\"/>\n";
if ($this->items[$i]->date == "") {
$this->items[$i]->date = time();
}
$itemDate = new FeedDate($this->items[$i]->date);
$feed .= " <created>" . htmlspecialchars($itemDate->iso8601(), ENT_COMPAT | ENT_HTML401, $this->encoding) . "</created>\n";
$feed .= " <issued>" . htmlspecialchars($itemDate->iso8601(), ENT_COMPAT | ENT_HTML401, $this->encoding) . "</issued>\n";
$feed .= " <updated>" . htmlspecialchars($itemDate->iso8601(), ENT_COMPAT | ENT_HTML401, $this->encoding) . "</updated>\n";
$feed .= " <id>" . htmlspecialchars($this->items[$i]->link, ENT_COMPAT | ENT_HTML401, $this->encoding) . "</id>\n";
$feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
if ($this->items[$i]->author != "") {
$feed .= " <author>\n";
$feed .= " <name>" . htmlspecialchars($this->items[$i]->author, ENT_COMPAT | ENT_HTML401, $this->encoding) . "</name>\n";
$feed .= " </author>\n";
}
if ($this->items[$i]->description != "") {
$feed .= " <summary type=\"html\">" . htmlspecialchars($this->items[$i]->description, ENT_COMPAT | ENT_HTML401, $this->encoding) . "</summary>\n";
}
$feed .= " </entry>\n";
}
$feed .= "</feed>\n";
return $feed;
}
示例8: createFeed
/**
* Builds the Google Sitemap feed's text.
* The feed will contain all items previously added in the same order.
* @return string the feed's complete text
*/
function createFeed()
{
$feed = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">';
$total = count($this->items);
$feed .= '
';
for ($i = 0; $i < $total; $i++) {
$feed .= "\t<url>\n";
$feed .= "\t\t<loc>" . htmlspecialchars($this->items[$i]->link) . "</loc>\n";
if ($this->items[$i]->date != "") {
$itemDate = new FeedDate($this->items[$i]->date);
$feed .= "\t\t<lastmod>" . htmlspecialchars($itemDate->iso8601()) . "</lastmod>\n";
}
$feed .= "\t</url>\n";
}
$feed .= "</urlset>\n";
return $feed;
}
示例9: createFeed
/**
* Builds the PIE feed's text.
* @return string the feed's complete text
*/
function createFeed()
{
$feed = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$feed .= "<feed version=\"0.1\" xmlns=\"http://example.com/newformat#\">\n";
$feed .= " <title>" . FeedCreator::iTrunc(htmlspecialchars($this->title), 100) . "</title>\n";
$feed .= " <subtitle>" . FeedCreator::iTrunc(htmlspecialchars($this->description), 500) . "</subtitle>\n";
$feed .= " <link>" . $this->link . "</link>\n";
for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <entry>\n";
$feed .= " <title>" . FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)), 100) . "</title>\n";
$feed .= " <link>" . htmlspecialchars($this->items[$i]->link) . "</link>\n";
$itemDate = new FeedDate($this->items[$i]->date);
$feed .= " <created>" . htmlspecialchars($itemDate->iso8601()) . "</created>\n";
$feed .= " <issued>" . htmlspecialchars($itemDate->iso8601()) . "</issued>\n";
$feed .= " <modified>" . htmlspecialchars($itemDate->iso8601()) . "</modified>\n";
$feed .= " <id>" . $this->items[$i]->guid . "</id>\n";
if ($this->items[$i]->author != "") {
$feed .= " <author>\n";
$feed .= " <name>" . htmlspecialchars($this->items[$i]->author) . "</name>\n";
$feed .= " <weblog>" . $this->link . "</weblog>\n";
$feed .= " </author>\n";
}
$feed .= " <content type=\"text/html\" xml:lang=\"en-us\">\n";
$feed .= " <div xmlns=\"http://www.w3.org/1999/xhtml\">" . $this->items[$i]->description . "</div>\n";
$feed .= " </content>\n";
/*
// on hold
if ($this->items[$i]->source!="") {
$feed.= " <source>".htmlspecialchars($this->items[$i]->source)."</source>\n";
}
*/
$feed .= " </entry>\n";
}
$feed .= "</feed>\n";
return $feed;
}
示例10: createFeed
function createFeed()
{
$now = new FeedDate();
$feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
$feed .= $this->_createGeneratorComment();
$feed .= $this->_createStylesheetReferences();
$feed .= "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n";
$feed .= " <title type=\"text\">" . htmlspecialchars($this->title) . "</title>\n";
$feed .= " <subtitle>" . htmlspecialchars($this->description) . "</subtitle>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" hreflang=\"en\" href=\"" . htmlspecialchars($this->link) . "\"/>\n";
$feed .= " <link rel=\"self\" type=\"application/atom+xml\" hreflang=\"en\" href=\"" . htmlspecialchars($this->link) . "/index2.php?option=com_rss&feed=ATOM1.0&no_html=1\"/>\n";
$feed .= " <id>" . htmlspecialchars($this->link) . "/</id>\n";
$feed .= " <updated>" . htmlspecialchars($now->iso8601()) . "</updated>\n";
if ($this->editor != "") {
$feed .= " <rights>" . $this->editor;
if ($this->editorEmail != "") {
$feed .= $this->editorEmail;
}
$feed .= " </rights>\n";
}
$feed .= " <generator>" . FEEDCREATOR_VERSION . "</generator>\n";
$feed .= $this->_createAdditionalElements($this->additionalElements, " ");
for ($i = 0; $i < count($this->items); $i++) {
$this->items[$i]->created = time();
$itemDate = new FeedDate($this->items[$i]->created);
$feed .= " <entry>\n";
$feed .= " <title>" . htmlspecialchars(strip_tags($this->items[$i]->title)) . "</title>\n";
$feed .= " <link rel=\"self\" type=\"application/atom+xml\" href=\"" . htmlspecialchars($this->items[$i]->link) . "\"/>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->items[$i]->link) . "\"/>\n";
$feed .= " <updated>" . htmlspecialchars($itemDate->iso8601()) . "</updated>\n";
$feed .= " <id>" . htmlspecialchars($this->items[$i]->link) . "</id>\n";
$feed .= " <author>\n";
if ($this->items[$i]->author != "") {
$feed .= " <name>" . htmlspecialchars($this->items[$i]->author) . "</name>\n";
} else {
$feed .= " <name>" . htmlspecialchars($this->link) . "</name>\n";
}
$feed .= " </author>\n";
if ($this->items[$i]->description != "") {
$feed .= " <summary type=\"html\">" . htmlspecialchars($this->items[$i]->description) . "</summary>\n";
}
$feed .= " </entry>\n";
}
$feed .= "</feed>\n";
return $feed;
}
示例11: createFeed
function createFeed()
{
$feed = "<?xml version=\"1.0\" encoding=\"{$this->encoding}\"?>\n";
$feed .= "<!DOCTYPE xbel PUBLIC\n";
$feed .= ' "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML"' . "\n";
$feed .= ' "http://www.python.org/topics/xml/dtds/xbel-1.0.dtd">' . "\n";
$feed .= $this->_createGeneratorComment();
$feed .= '<xbel version="1.0"';
$now = new FeedDate();
$feed .= ' added="' . $this->htmlspecialchars($now->iso8601()) . '"';
if ($this->language != "") {
$feed .= " xml:lang=\"" . $this->language . "\"";
}
$feed .= ">\n";
if ($this->title != "") {
$feed .= "<folder>\n";
$feed .= "\t<title>" . $this->htmlspecialchars($this->title) . "</title>\n";
$feed .= "\t<desc>" . $this->htmlspecialchars($this->description) . "</desc>\n";
}
$feed .= $this->_createAdditionalElements($this->additionalElements, "\t\t");
$ocat = '';
for ($i = 0; $i < count($this->items); $i++) {
if ($this->items[$i]->category != $ocat) {
if ($ocat != '') {
$feed .= "\t</folder>\n";
}
$ocat = $this->items[$i]->category;
if ($ocat != '') {
$feed .= "\t<folder>\n";
$feed .= "\t\t<title>" . $this->htmlspecialchars($ocat) . "</title>\n";
}
}
if (preg_match('/^\\-+$/', $this->items[$i]->title)) {
$feed .= "\t<separator/>\n";
continue;
}
$feed .= ' <bookmark';
$feed .= ' href="' . $this->htmlspecialchars($this->items[$i]->link) . '"';
if ($this->items[$i]->date == "") {
$itemDate = $now;
} else {
$itemDate = new FeedDate($this->items[$i]->date);
}
$feed .= ' added="' . $this->htmlspecialchars($itemDate->iso8601()) . '"';
$feed .= ">\n";
$feed .= "\t\t\t<title>" . $this->htmlspecialchars($this->items[$i]->title) . "</title>\n";
if ($this->items[$i]->description != "") {
$feed .= "\t\t\t<desc>" . $this->htmlspecialchars($this->items[$i]->description) . "</desc>\n";
}
$feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, "\t\t");
$feed .= "\t\t</bookmark>\n";
}
if ($ocat != '') {
$feed .= "\t</folder>\n";
}
if ($this->title != "") {
$feed .= "</folder>\n";
}
$feed .= "</xbel>\n";
return $feed;
}
示例12: createFeed
function createFeed()
{
$feed = "<?xml version=\"1.0\" encoding=\"" . $this->encoding . "\"?>\n";
$feed .= $this->_createGeneratorComment();
$feed .= $this->_createStylesheetReferences();
$feed .= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\"";
if ($this->format == 'TOOLBAR') {
$feed .= " xmlns:gtb=\"http://toolbar.google.com/custombuttons/\"";
}
if ($this->language != "") {
$feed .= " xml:lang=\"" . $this->language . "\"";
}
$feed .= ">\n";
$feed .= " <title>" . htmlspecialchars($this->title) . "</title>\n";
$feed .= " <tagline>" . htmlspecialchars($this->description) . "</tagline>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->link) . "\"/>\n";
$feed .= " <id>" . htmlspecialchars($this->link) . "</id>\n";
$now = new FeedDate();
$feed .= " <modified>" . htmlspecialchars($now->iso8601()) . "</modified>\n";
if ($this->editor != "") {
$feed .= " <author>\n";
$feed .= " <name>" . $this->editor . "</name>\n";
if ($this->editorEmail != "") {
$feed .= " <email>" . $this->editorEmail . "</email>\n";
}
$feed .= " </author>\n";
}
$feed .= " <generator>" . FEEDCREATOR_VERSION . "</generator>\n";
$feed .= $this->_createAdditionalElements($this->additionalElements, " ");
for ($i = 0; $i < count($this->items); $i++) {
$feed .= " <entry>\n";
$feed .= " <title>" . utf8_encode(htmlnumericentities(strip_tags($this->items[$i]->title))) . "</title>\n";
$feed .= " <link rel=\"alternate\" type=\"text/html\" href=\"" . htmlspecialchars($this->items[$i]->link) . "\"/>\n";
if ($this->items[$i]->date == "") {
$this->items[$i]->date = time();
}
$itemDate = new FeedDate($this->items[$i]->date);
$feed .= " <created>" . htmlspecialchars($itemDate->iso8601()) . "</created>\n";
$feed .= " <issued>" . htmlspecialchars($itemDate->iso8601()) . "</issued>\n";
$feed .= " <modified>" . htmlspecialchars($itemDate->iso8601()) . "</modified>\n";
$feed .= " <id>" . htmlspecialchars($this->items[$i]->link) . "</id>\n";
$feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, " ");
if ($this->items[$i]->author != "") {
$feed .= " <author>\n";
$feed .= " <name>" . htmlnumericentities($this->items[$i]->author) . "</name>\n";
$feed .= " </author>\n";
}
if ($this->items[$i]->description != "") {
$feed .= " <summary>" . utf8_encode(htmlnumericentities($this->items[$i]->description)) . "</summary>\n";
}
if ($this->items[$i]->thumbdata) {
$feed .= " <gtb:icon mode=\"base64\" type=\"image/jpeg\">\n";
$feed .= chunk_split(base64_encode($this->items[$i]->thumbdata)) . "\n";
$feed .= " </gtb:icon>\n";
}
$feed .= " </entry>\n";
}
$feed .= "</feed>\n";
return $feed;
}
示例13: createFeed
/**
* Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0.
* The feed will contain all items previously added in the same order.
* @return string the feed's complete text
*/
function createFeed()
{
$feed = "<?xml version=\"1.0\" encoding=\"{$this->encoding}\"?>\n";
$feed .= $this->_createGeneratorComment();
if ($this->cssStyleSheet == "") {
$cssStyleSheet = "http://www.w3.org/2000/08/w3c-synd/style.css";
}
$feed .= $this->_createStylesheetReferences();
$feed .= "<rdf:RDF\n";
$feed .= "\txmlns=\"http://purl.org/rss/1.0/\"\n";
$feed .= "\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
$feed .= "\txmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\n";
$feed .= "\txmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
$feed .= "\t<channel rdf:about=\"{$this->syndicationURL}\">\n";
$feed .= "\t\t<title>" . $this->htmlspecialchars($this->title) . "</title>\n";
$feed .= "\t\t<description>" . $this->htmlspecialchars($this->description) . "</description>\n";
$feed .= "\t\t<link>{$this->link}</link>\n";
if (!empty($this->image)) {
$feed .= "\t\t<image rdf:resource=\"{$this->image->url}\" />\n";
}
$now = new FeedDate();
$feed .= "\t\t<dc:date>" . $this->htmlspecialchars($now->iso8601()) . "</dc:date>\n";
$feed .= "\t\t<items>\n";
$feed .= "\t\t\t<rdf:Seq>\n";
for ($i = 0; $i < count($this->items); $i++) {
$feed .= "\t\t\t\t<rdf:li rdf:resource=\"" . $this->htmlspecialchars($this->items[$i]->link) . "\"/>\n";
}
$feed .= "\t\t\t</rdf:Seq>\n";
$feed .= "\t\t</items>\n";
$feed .= "\t</channel>\n";
if (!empty($this->image)) {
$feed .= "\t<image rdf:about=\"{$this->image->url}\">\n";
$feed .= "\t\t<title>" . $this->htmlspecialchars($this->image->title) . "</title>\n";
$feed .= "\t\t<link>{$this->image->link}</link>\n";
$feed .= "\t\t<url>{$this->image->url}</url>\n";
$feed .= "\t</image>\n";
}
$feed .= $this->_createAdditionalElements($this->additionalElements, "\t");
for ($i = 0; $i < count($this->items); $i++) {
$feed .= "\t<item rdf:about=\"" . $this->htmlspecialchars($this->items[$i]->link) . "\">\n";
$feed .= "\t\t<dc:format>text/html</dc:format>\n";
if ($this->items[$i]->date != null) {
$itemDate = new FeedDate($this->items[$i]->date);
$feed .= "\t\t<dc:date>" . $this->htmlspecialchars($itemDate->iso8601()) . "</dc:date>\n";
}
if ($this->items[$i]->source != "") {
$feed .= "\t\t<dc:source>" . $this->htmlspecialchars($this->items[$i]->source) . "</dc:source>\n";
}
if ($this->items[$i]->author != "") {
$feed .= "\t\t<dc:creator>" . $this->htmlspecialchars($this->items[$i]->author) . "</dc:creator>\n";
}
$feed .= "\t\t<title>" . $this->htmlspecialchars(strip_tags(strtr($this->items[$i]->title, "\n\r", " "))) . "</title>\n";
$feed .= "\t\t<link>" . $this->htmlspecialchars($this->items[$i]->link) . "</link>\n";
$feed .= "\t\t<description>" . $this->htmlspecialchars($this->items[$i]->description) . "</description>\n";
$feed .= $this->_createAdditionalElements($this->items[$i]->additionalElements, "\t\t");
// added by Joseph LeBlanc, contact@jlleblanc.com
if (count($this->items[$i]->enclosures)) {
foreach ($this->items[$i]->enclosures as $enc) {
$feed .= "\t\t\t<enclosure url=\"{$enc['url']}\" length=\"{$enc['length']}\" type=\"{$enc['type']}\" />";
}
}
// end add, Joseph LeBlanc
$feed .= "\t</item>\n";
}
$feed .= "</rdf:RDF>\n";
return $feed;
}