Update PicoFeed (improve feed writers and opml import)
This commit is contained in:
parent
06b4d87a06
commit
5d78960212
1
vendor/PicoFeed/Import.php
vendored
1
vendor/PicoFeed/Import.php
vendored
@ -51,6 +51,7 @@ class Import
|
|||||||
else if ((isset($item['text']) || isset($item['title'])) && isset($item['xmlUrl'])) {
|
else if ((isset($item['text']) || isset($item['title'])) && isset($item['xmlUrl'])) {
|
||||||
|
|
||||||
$entry = new \StdClass;
|
$entry = new \StdClass;
|
||||||
|
$entry->category = isset($tree['title']) ? (string) $tree['title'] : (string) $tree['text'];
|
||||||
$entry->title = isset($item['title']) ? (string) $item['title'] : (string) $item['text'];
|
$entry->title = isset($item['title']) ? (string) $item['title'] : (string) $item['text'];
|
||||||
$entry->feed_url = (string) $item['xmlUrl'];
|
$entry->feed_url = (string) $item['xmlUrl'];
|
||||||
$entry->site_url = isset($item['htmlUrl']) ? (string) $item['htmlUrl'] : $entry->feed_url;
|
$entry->site_url = isset($item['htmlUrl']) ? (string) $item['htmlUrl'] : $entry->feed_url;
|
||||||
|
35
vendor/PicoFeed/Writers/Atom.php
vendored
35
vendor/PicoFeed/Writers/Atom.php
vendored
@ -35,10 +35,14 @@ class Atom extends \PicoFeed\Writer
|
|||||||
$feed->appendChild($generator);
|
$feed->appendChild($generator);
|
||||||
|
|
||||||
// <title/>
|
// <title/>
|
||||||
$feed->appendChild($this->dom->createElement('title', $this->title));
|
$title = $this->dom->createElement('title');
|
||||||
|
$title->appendChild($this->dom->createTextNode($this->title));
|
||||||
|
$feed->appendChild($title);
|
||||||
|
|
||||||
// <id/>
|
// <id/>
|
||||||
$feed->appendChild($this->dom->createElement('id', $this->site_url));
|
$id = $this->dom->createElement('id');
|
||||||
|
$id->appendChild($this->dom->createTextNode($this->site_url));
|
||||||
|
$feed->appendChild($id);
|
||||||
|
|
||||||
// <updated/>
|
// <updated/>
|
||||||
$this->addUpdated($feed, isset($this->updated) ? $this->updated : '');
|
$this->addUpdated($feed, isset($this->updated) ? $this->updated : '');
|
||||||
@ -60,16 +64,14 @@ class Atom extends \PicoFeed\Writer
|
|||||||
$entry = $this->dom->createElement('entry');
|
$entry = $this->dom->createElement('entry');
|
||||||
|
|
||||||
// <title/>
|
// <title/>
|
||||||
$entry->appendChild($this->dom->createElement('title', $item['title']));
|
$title = $this->dom->createElement('title');
|
||||||
|
$title->appendChild($this->dom->createTextNode($item['title']));
|
||||||
|
$entry->appendChild($title);
|
||||||
|
|
||||||
// <id/>
|
// <id/>
|
||||||
if (isset($item['id'])) {
|
$id = $this->dom->createElement('id');
|
||||||
$entry->appendChild($this->dom->createElement('id', $item['id']));
|
$id->appendChild($this->dom->createTextNode(isset($item['id']) ? $item['id'] : $item['url']));
|
||||||
}
|
$entry->appendChild($id);
|
||||||
else {
|
|
||||||
$entry->appendChild($this->dom->createElement('id', $item['url']));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// <updated/>
|
// <updated/>
|
||||||
$this->addUpdated($entry, isset($item['updated']) ? $item['updated'] : '');
|
$this->addUpdated($entry, isset($item['updated']) ? $item['updated'] : '');
|
||||||
@ -84,7 +86,9 @@ class Atom extends \PicoFeed\Writer
|
|||||||
|
|
||||||
// <summary/>
|
// <summary/>
|
||||||
if (isset($item['summary'])) {
|
if (isset($item['summary'])) {
|
||||||
$entry->appendChild($this->dom->createElement('summary', $item['summary']));
|
$summary = $this->dom->createElement('summary');
|
||||||
|
$summary->appendChild($this->dom->createTextNode($item['summary']));
|
||||||
|
$entry->appendChild($summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <content/>
|
// <content/>
|
||||||
@ -136,17 +140,20 @@ class Atom extends \PicoFeed\Writer
|
|||||||
$author = $this->dom->createElement('author');
|
$author = $this->dom->createElement('author');
|
||||||
|
|
||||||
if (isset($values['name'])) {
|
if (isset($values['name'])) {
|
||||||
$name = $this->dom->createElement('name', $values['name']);
|
$name = $this->dom->createElement('name');
|
||||||
|
$name->appendChild($this->dom->createTextNode($values['name']));
|
||||||
$author->appendChild($name);
|
$author->appendChild($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($values['email'])) {
|
if (isset($values['email'])) {
|
||||||
$email = $this->dom->createElement('email', $values['email']);
|
$email = $this->dom->createElement('email');
|
||||||
|
$email->appendChild($this->dom->createTextNode($values['email']));
|
||||||
$author->appendChild($email);
|
$author->appendChild($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($values['url'])) {
|
if (isset($values['url'])) {
|
||||||
$uri = $this->dom->createElement('uri', $values['url']);
|
$uri = $this->dom->createElement('uri');
|
||||||
|
$uri->appendChild($this->dom->createTextNode($values['url']));
|
||||||
$author->appendChild($uri);
|
$author->appendChild($uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
vendor/PicoFeed/Writers/Rss20.php
vendored
33
vendor/PicoFeed/Writers/Rss20.php
vendored
@ -38,10 +38,14 @@ class Rss20 extends \PicoFeed\Writer
|
|||||||
$channel->appendChild($generator);
|
$channel->appendChild($generator);
|
||||||
|
|
||||||
// <title/>
|
// <title/>
|
||||||
$channel->appendChild($this->dom->createElement('title', $this->title));
|
$title = $this->dom->createElement('title');
|
||||||
|
$title->appendChild($this->dom->createTextNode($this->title));
|
||||||
|
$channel->appendChild($title);
|
||||||
|
|
||||||
// <description/>
|
// <description/>
|
||||||
$channel->appendChild($this->dom->createElement('description', isset($this->description) ? $this->description : $this->title));
|
$description = $this->dom->createElement('description');
|
||||||
|
$description->appendChild($this->dom->createTextNode(isset($this->description) ? $this->description : $this->title));
|
||||||
|
$channel->appendChild($description);
|
||||||
|
|
||||||
// <pubDate/>
|
// <pubDate/>
|
||||||
$this->addPubDate($channel, isset($this->updated) ? $this->updated : '');
|
$this->addPubDate($channel, isset($this->updated) ? $this->updated : '');
|
||||||
@ -54,7 +58,9 @@ class Rss20 extends \PicoFeed\Writer
|
|||||||
$channel->appendChild($link);
|
$channel->appendChild($link);
|
||||||
|
|
||||||
// <link/>
|
// <link/>
|
||||||
$channel->appendChild($this->dom->createElement('link', $this->site_url));
|
$link = $this->dom->createElement('link');
|
||||||
|
$link->appendChild($this->dom->createTextNode($this->site_url));
|
||||||
|
$channel->appendChild($link);
|
||||||
|
|
||||||
// <webMaster/>
|
// <webMaster/>
|
||||||
if (isset($this->author)) $this->addAuthor($channel, 'webMaster', $this->author);
|
if (isset($this->author)) $this->addAuthor($channel, 'webMaster', $this->author);
|
||||||
@ -67,20 +73,26 @@ class Rss20 extends \PicoFeed\Writer
|
|||||||
$entry = $this->dom->createElement('item');
|
$entry = $this->dom->createElement('item');
|
||||||
|
|
||||||
// <title/>
|
// <title/>
|
||||||
$entry->appendChild($this->dom->createElement('title', $item['title']));
|
$title = $this->dom->createElement('title');
|
||||||
|
$title->appendChild($this->dom->createTextNode($item['title']));
|
||||||
|
$entry->appendChild($title);
|
||||||
|
|
||||||
// <link/>
|
// <link/>
|
||||||
$entry->appendChild($this->dom->createElement('link', $item['url']));
|
$link = $this->dom->createElement('link');
|
||||||
|
$link->appendChild($this->dom->createTextNode($item['url']));
|
||||||
|
$entry->appendChild($link);
|
||||||
|
|
||||||
// <guid/>
|
// <guid/>
|
||||||
if (isset($item['id'])) {
|
if (isset($item['id'])) {
|
||||||
$guid = $this->dom->createElement('guid', $item['id']);
|
$guid = $this->dom->createElement('guid');
|
||||||
$guid->setAttribute('isPermaLink', 'false');
|
$guid->setAttribute('isPermaLink', 'false');
|
||||||
|
$guid->appendChild($this->dom->createTextNode($item['id']));
|
||||||
$entry->appendChild($guid);
|
$entry->appendChild($guid);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$guid = $this->dom->createElement('guid', $item['url']);
|
$guid = $this->dom->createElement('guid');
|
||||||
$guid->setAttribute('isPermaLink', 'true');
|
$guid->setAttribute('isPermaLink', 'true');
|
||||||
|
$guid->appendChild($this->dom->createTextNode($item['url']));
|
||||||
$entry->appendChild($guid);
|
$entry->appendChild($guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +101,9 @@ class Rss20 extends \PicoFeed\Writer
|
|||||||
|
|
||||||
// <description/>
|
// <description/>
|
||||||
if (isset($item['summary'])) {
|
if (isset($item['summary'])) {
|
||||||
$entry->appendChild($this->dom->createElement('description', $item['summary']));
|
$description = $this->dom->createElement('description');
|
||||||
|
$description->appendChild($this->dom->createTextNode($item['summary']));
|
||||||
|
$entry->appendChild($description);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <content/>
|
// <content/>
|
||||||
@ -134,7 +148,8 @@ class Rss20 extends \PicoFeed\Writer
|
|||||||
if ($value && isset($values['name'])) $value .= ' ('.$values['name'].')';
|
if ($value && isset($values['name'])) $value .= ' ('.$values['name'].')';
|
||||||
|
|
||||||
if ($value) {
|
if ($value) {
|
||||||
$author = $this->dom->createElement($tag, $value);
|
$author = $this->dom->createElement($tag);
|
||||||
|
$author->appendChild($this->dom->createTextNode($value));
|
||||||
$xml->appendChild($author);
|
$xml->appendChild($author);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user