Mise à jour RSS Feed
This commit is contained in:
parent
ed34728f5e
commit
e640aa327e
74
module/blog/vendor/FeedWriter/CHANGELOG.md
vendored
Normal file
74
module/blog/vendor/FeedWriter/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/) .
|
||||
|
||||
## [v1.1.2] - 2023-05-25
|
||||
### Changed
|
||||
- Throw an exception if required feed elements are set with ```NULL``` value. See issue #46.
|
||||
|
||||
## [v1.1.1] - 2016-11-19
|
||||
### Changed
|
||||
- Improved the documentation.
|
||||
- Changed to PSR-4 autoloader in composer.json.
|
||||
|
||||
### Fixed
|
||||
- Item::addElement did not method chain in error conditions.
|
||||
|
||||
## [v1.1.0] - 2016-11-08
|
||||
### Added
|
||||
- Support for multiple element values.
|
||||
- Support for a feed description in ATOM feeds.
|
||||
- Support for ATOM feeds without ```link``` elements.
|
||||
- Support for a feed image in RSS 1.0 and ATOM feeds.
|
||||
|
||||
### Changed
|
||||
- The script does now throw Exceptions instead of stopping the PHP interpreter on error conditions.
|
||||
- The unique identifier for ATOM feeds / entries use the feed / entry title for generating the ID (previously the feed / entry link).
|
||||
- Some URI schemes for ```Item::setId``` were wrongly allowed.
|
||||
- The parameter order of the ```Feed::setImage``` method was changed.
|
||||
|
||||
### Fixed
|
||||
- Fixed slow generation of the feed with huge amounts of feed entries (like 40k entries).
|
||||
- Fixed PHP warning when ```Feed::setChannelAbout``` for RSS 1.0 feeds was not called.
|
||||
- A feed element was generated twice if the element content & attribute value was ```NULL```.
|
||||
- The detection of twice the same link with ```rel=alternate```, ```hreflang``` & ```type``` did not work.
|
||||
|
||||
### Removed
|
||||
- The deprecated method ```Item::setEnclosure``` was removed. Use ```Item::addEnclosure``` instead.
|
||||
|
||||
## [v1.0.4] - 2016-04-17
|
||||
### Changed
|
||||
- The unique identifier for ATOM feed entries is now compliant to the ATOM standard.
|
||||
|
||||
### Fixed
|
||||
- Filter more invalid XML chars.
|
||||
- Fixed a PHP warning displayed if ```Feed::setTitle``` or ```Feed::setLink``` was not called.
|
||||
|
||||
## [v1.0.3] - 2015-11-11
|
||||
### Added
|
||||
- Method for removing tags which were CDATA encoded.
|
||||
|
||||
### Fixed
|
||||
- Fixed error when the filtering of invalid XML chars failed.
|
||||
- Fixed missing docblock documentation.
|
||||
|
||||
## [v1.0.2] - 2015-01-23
|
||||
### Fixed
|
||||
- Fixed a wrong docblock return data type.
|
||||
|
||||
## [v1.0.1] - 2014-09-21
|
||||
### Fixed
|
||||
- Filter invalid XML chars.
|
||||
|
||||
## v1.0 - 2014-09-14
|
||||
|
||||
|
||||
[Unreleased]: https://github.com/mibe/FeedWriter/compare/v1.1.2...HEAD
|
||||
[v1.1.2]: https://github.com/mibe/FeedWriter/compare/v1.1.1...v1.1.2
|
||||
[v1.1.1]: https://github.com/mibe/FeedWriter/compare/v1.1.0...v1.1.1
|
||||
[v1.1.0]: https://github.com/mibe/FeedWriter/compare/v1.0.4...v1.1.0
|
||||
[v1.0.4]: https://github.com/mibe/FeedWriter/compare/v1.0.3...v1.0.4
|
||||
[v1.0.3]: https://github.com/mibe/FeedWriter/compare/v1.0.2...v1.0.3
|
||||
[v1.0.2]: https://github.com/mibe/FeedWriter/compare/v1.0.1...v1.0.2
|
||||
[v1.0.1]: https://github.com/mibe/FeedWriter/compare/v1.0...v1.0.1
|
39
module/blog/vendor/FeedWriter/Feed.php
vendored
39
module/blog/vendor/FeedWriter/Feed.php
vendored
@ -2,10 +2,11 @@
|
||||
namespace FeedWriter;
|
||||
|
||||
use \DateTime;
|
||||
use \DateTimeInterface;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>
|
||||
* Copyright (C) 2010-2016 Michael Bemmerl <mail@mx-server.de>
|
||||
* Copyright (C) 2010-2016, 2022 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
@ -76,6 +77,13 @@ abstract class Feed
|
||||
*/
|
||||
private $version = null;
|
||||
|
||||
/**
|
||||
* Contains the encoding of this feed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $encoding = 'utf-8';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -87,9 +95,6 @@ abstract class Feed
|
||||
{
|
||||
$this->version = $version;
|
||||
|
||||
// Setting default encoding
|
||||
$this->encoding = 'utf-8';
|
||||
|
||||
// Setting default value for essential channel element
|
||||
$this->setTitle($version . ' Feed');
|
||||
|
||||
@ -396,9 +401,13 @@ abstract class Feed
|
||||
* @access public
|
||||
* @param string $title value of 'title' channel tag
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the title is empty or NULL.
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
if (empty($title))
|
||||
throw new \InvalidArgumentException('The title may not be empty or NULL.');
|
||||
|
||||
return $this->setChannelElement('title', $title);
|
||||
}
|
||||
|
||||
@ -406,15 +415,15 @@ abstract class Feed
|
||||
* Set the date when the feed was lastly updated.
|
||||
*
|
||||
* This adds the 'updated' element to the feed. The value of the date parameter
|
||||
* can be either an instance of the DateTime class, an integer containing a UNIX
|
||||
* can be either a class implementing DateTimeInterface, an integer containing a UNIX
|
||||
* timestamp or a string which is parseable by PHP's 'strtotime' function.
|
||||
*
|
||||
* Not supported in RSS1 feeds.
|
||||
*
|
||||
* @access public
|
||||
* @param DateTime|int|string Date which should be used.
|
||||
* @param DateTimeInterface|int|string Date which should be used.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the given date is not an instance of DateTime, a UNIX timestamp or a date string.
|
||||
* @throws \InvalidArgumentException if the given date is not an implementation of DateTimeInterface, a UNIX timestamp or a date string.
|
||||
* @throws InvalidOperationException if this method is called on an RSS1 feed.
|
||||
*/
|
||||
public function setDate($date)
|
||||
@ -425,7 +434,7 @@ abstract class Feed
|
||||
// The feeds have different date formats.
|
||||
$format = $this->version == Feed::ATOM ? \DATE_ATOM : \DATE_RSS;
|
||||
|
||||
if ($date instanceof DateTime)
|
||||
if ($date instanceof DateTimeInterface || $date instanceof DateTime)
|
||||
$date = $date->format($format);
|
||||
else if(is_numeric($date) && $date >= 0)
|
||||
$date = date($format, $date);
|
||||
@ -438,7 +447,7 @@ abstract class Feed
|
||||
$date = date($format, $timestamp);
|
||||
}
|
||||
else
|
||||
throw new \InvalidArgumentException('The given date is not an instance of DateTime, a UNIX timestamp or a date string.');
|
||||
throw new \InvalidArgumentException('The given date is not an implementation of DateTimeInterface, a UNIX timestamp or a date string.');
|
||||
|
||||
if ($this->version == Feed::ATOM)
|
||||
$this->setChannelElement('updated', $date);
|
||||
@ -454,9 +463,13 @@ abstract class Feed
|
||||
* @access public
|
||||
* @param string $description Description of the feed.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the description is empty or NULL.
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
if (empty($description))
|
||||
throw new \InvalidArgumentException('The description may not be empty or NULL.');
|
||||
|
||||
if ($this->version != Feed::ATOM)
|
||||
$this->setChannelElement('description', $description);
|
||||
else
|
||||
@ -471,9 +484,13 @@ abstract class Feed
|
||||
* @access public
|
||||
* @param string $link value of 'link' channel tag
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the link is empty or NULL.
|
||||
*/
|
||||
public function setLink($link)
|
||||
{
|
||||
if (empty($link))
|
||||
throw new \InvalidArgumentException('The link may not be empty or NULL.');
|
||||
|
||||
if ($this->version == Feed::ATOM)
|
||||
$this->setAtomLink($link);
|
||||
else
|
||||
@ -667,7 +684,7 @@ abstract class Feed
|
||||
/**
|
||||
* Replace invalid XML characters.
|
||||
*
|
||||
* @link http://www.phpwact.org/php/i18n/charsets#xml See utf8_for_xml() function
|
||||
* @link https://web.archive.org/web/20160608013721/http://www.phpwact.org:80/php/i18n/charsets#xml See utf8_for_xml() function
|
||||
* @link http://www.w3.org/TR/REC-xml/#charsets
|
||||
* @link https://github.com/mibe/FeedWriter/issues/30
|
||||
*
|
||||
@ -906,7 +923,7 @@ abstract class Feed
|
||||
$out .= "</rdf:Seq>" . PHP_EOL . "</items>" . PHP_EOL . "</channel>" . PHP_EOL;
|
||||
|
||||
// An image has its own element after the channel elements.
|
||||
if (array_key_exists('image', $this->data))
|
||||
if (array_key_exists('Image', $this->data))
|
||||
$out .= $this->makeNode('image', $this->data['Image'], array('rdf:about' => $this->data['Image']['url']));
|
||||
} else if ($this->version == Feed::ATOM) {
|
||||
// ATOM feeds have a unique feed ID. Use the title channel element as key.
|
||||
|
16
module/blog/vendor/FeedWriter/Item.php
vendored
16
module/blog/vendor/FeedWriter/Item.php
vendored
@ -2,6 +2,7 @@
|
||||
namespace FeedWriter;
|
||||
|
||||
use \DateTime;
|
||||
use \DateTimeInterface;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>
|
||||
@ -217,19 +218,19 @@ class Item
|
||||
/**
|
||||
* Set the 'date' element of the feed item.
|
||||
*
|
||||
* The value of the date parameter can be either an instance of the
|
||||
* DateTime class, an integer containing a UNIX timestamp or a string
|
||||
* The value of the date parameter can be either a class implementing
|
||||
* DateTimeInterface, an integer containing a UNIX timestamp or a string
|
||||
* which is parseable by PHP's 'strtotime' function.
|
||||
*
|
||||
* @access public
|
||||
* @param DateTime|int|string $date Date which should be used.
|
||||
* @param DateTimeInterface|int|string $date Date which should be used.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the given date was not parseable.
|
||||
*/
|
||||
public function setDate($date)
|
||||
{
|
||||
if (!is_numeric($date)) {
|
||||
if ($date instanceof DateTime)
|
||||
if ($date instanceof DateTimeInterface || $date instanceof DateTime)
|
||||
$date = $date->getTimestamp();
|
||||
else {
|
||||
$date = strtotime($date);
|
||||
@ -277,7 +278,7 @@ class Item
|
||||
* Attach a external media to the feed item.
|
||||
* Not supported in RSS 1.0 feeds.
|
||||
*
|
||||
* See RFC 4288 for syntactical correct MIME types.
|
||||
* See RFC 6838 for syntactical correct MIME types.
|
||||
*
|
||||
* Note that you should avoid the use of more than one enclosure in one item,
|
||||
* since some RSS aggregators don't support it.
|
||||
@ -288,7 +289,8 @@ class Item
|
||||
* @param string $type The MIME type attribute of the media.
|
||||
* @param boolean $multiple Specifies if multiple enclosures are allowed
|
||||
* @return self
|
||||
* @link https://tools.ietf.org/html/rfc4288
|
||||
* @link https://tools.ietf.org/html/rfc6838
|
||||
* @link http://www.iana.org/assignments/media-types/media-types.xhtml
|
||||
* @throws \InvalidArgumentException if the length or type parameter is invalid.
|
||||
* @throws InvalidOperationException if this method is called on RSS1 feeds.
|
||||
*/
|
||||
@ -389,7 +391,7 @@ class Item
|
||||
// Check if the given ID is an valid URI scheme (see RFC 4287 4.2.6)
|
||||
// The list of valid schemes was generated from http://www.iana.org/assignments/uri-schemes
|
||||
// by using only permanent or historical schemes.
|
||||
$validSchemes = array('aaa', 'aaas', 'about', 'acap', 'acct', 'cap', 'cid', 'coap', 'coaps', 'crid', 'data', 'dav', 'dict', 'dns', 'example', 'fax', 'file', 'filesystem', 'ftp', 'geo', 'go', 'gopher', 'h323', 'http', 'https', 'iax', 'icap', 'im', 'imap', 'info', 'ipp', 'ipps', 'iris', 'iris.beep', 'iris.lwz', 'iris.xpc', 'iris.xpcs', 'jabber', 'ldap', 'mailserver', 'mailto', 'mid', 'modem', 'msrp', 'msrps', 'mtqp', 'mupdate', 'news', 'nfs', 'ni', 'nih', 'nntp', 'opaquelocktoken', 'pack', 'pkcs11', 'pop', 'pres', 'prospero', 'reload', 'rtsp', 'rtsps', 'rtspu', 'service', 'session', 'shttp', 'sieve', 'sip', 'sips', 'sms', 'snews', 'snmp', 'soap.beep', 'soap.beeps', 'stun', 'stuns', 'tag', 'tel', 'telnet', 'tftp', 'thismessage', 'tip', 'tn3270', 'turn', 'turns', 'tv', 'urn', 'vemmi', 'videotex', 'vnc', 'wais', 'ws', 'wss', 'xcon', 'xcon-userid', 'xmlrpc.beep', 'xmlrpc.beeps', 'xmpp', 'z39.50', 'z39.50r', 'z39.50s');
|
||||
$validSchemes = array('aaa', 'aaas', 'about', 'acap', 'acct', 'bb', 'cap', 'cid', 'coap', 'coap+tcp', 'coap+ws', 'coaps', 'coaps+tcp', 'coaps+ws', 'crid', 'data', 'dav', 'dict', 'dns', 'drop', 'dtn', 'example', 'fax', 'file', 'filesystem', 'ftp', 'geo', 'go', 'gopher', 'grd', 'h323', 'http', 'https', 'iax', 'icap', 'im', 'imap', 'info', 'ipn', 'ipp', 'ipps', 'iris', 'iris.beep', 'iris.lwz', 'iris.xpc', 'iris.xpcs', 'jabber', 'ldap', 'leaptofrogans', 'mailserver', 'mailto', 'mid', 'modem', 'msrp', 'msrps', 'mt', 'mtqp', 'mupdate', 'news', 'nfs', 'ni', 'nih', 'nntp', 'opaquelocktoken', 'p1', 'pack', 'pkcs11', 'pop', 'pres', 'prospero', 'reload', 'rtsp', 'rtsps', 'rtspu', 'service', 'session', 'shttp (OBSOLETE)', 'sieve', 'sip', 'sips', 'sms', 'snews', 'snmp', 'soap.beep', 'soap.beeps', 'stun', 'stuns', 'tag', 'tel', 'telnet', 'tftp', 'thismessage', 'tip', 'tn3270', 'turn', 'turns', 'tv', 'upt', 'urn', 'vemmi', 'videotex', 'vnc', 'wais', 'wpid', 'ws', 'wss', 'xcon', 'xcon-userid', 'xmlrpc.beep', 'xmlrpc.beeps', 'xmpp', 'z39.50', 'z39.50r', 'z39.50s');
|
||||
$found = FALSE;
|
||||
$checkId = strtolower($id);
|
||||
|
||||
|
8
module/blog/vendor/FeedWriter/README.md
vendored
8
module/blog/vendor/FeedWriter/README.md
vendored
@ -12,6 +12,11 @@ Once a feed is fully composed with its items, the feed class can generate the ne
|
||||
|
||||
If you don't have **PHP 5.3** available on your system there is a version supporting **PHP 5.0** and above. See the `legacy-php-5.0` branch.
|
||||
|
||||
## Installation
|
||||
You can install via [Composer](https://getcomposer.org/).
|
||||
|
||||
composer require mibe/feedwriter
|
||||
|
||||
## Documentation
|
||||
|
||||
The documentation can be found in the `gh-pages` branch, or on [GitHub Pages](https://mibe.github.io/FeedWriter/).
|
||||
@ -40,3 +45,6 @@ In chronological order:
|
||||
- Pavel Khakhlou
|
||||
- Daniel
|
||||
- Tino Goratsch
|
||||
- John
|
||||
- Özgür Görgülü
|
||||
- Jan Tojnar
|
||||
|
74
module/news/vendor/FeedWriter/CHANGELOG.md
vendored
Normal file
74
module/news/vendor/FeedWriter/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/) .
|
||||
|
||||
## [v1.1.2] - 2023-05-25
|
||||
### Changed
|
||||
- Throw an exception if required feed elements are set with ```NULL``` value. See issue #46.
|
||||
|
||||
## [v1.1.1] - 2016-11-19
|
||||
### Changed
|
||||
- Improved the documentation.
|
||||
- Changed to PSR-4 autoloader in composer.json.
|
||||
|
||||
### Fixed
|
||||
- Item::addElement did not method chain in error conditions.
|
||||
|
||||
## [v1.1.0] - 2016-11-08
|
||||
### Added
|
||||
- Support for multiple element values.
|
||||
- Support for a feed description in ATOM feeds.
|
||||
- Support for ATOM feeds without ```link``` elements.
|
||||
- Support for a feed image in RSS 1.0 and ATOM feeds.
|
||||
|
||||
### Changed
|
||||
- The script does now throw Exceptions instead of stopping the PHP interpreter on error conditions.
|
||||
- The unique identifier for ATOM feeds / entries use the feed / entry title for generating the ID (previously the feed / entry link).
|
||||
- Some URI schemes for ```Item::setId``` were wrongly allowed.
|
||||
- The parameter order of the ```Feed::setImage``` method was changed.
|
||||
|
||||
### Fixed
|
||||
- Fixed slow generation of the feed with huge amounts of feed entries (like 40k entries).
|
||||
- Fixed PHP warning when ```Feed::setChannelAbout``` for RSS 1.0 feeds was not called.
|
||||
- A feed element was generated twice if the element content & attribute value was ```NULL```.
|
||||
- The detection of twice the same link with ```rel=alternate```, ```hreflang``` & ```type``` did not work.
|
||||
|
||||
### Removed
|
||||
- The deprecated method ```Item::setEnclosure``` was removed. Use ```Item::addEnclosure``` instead.
|
||||
|
||||
## [v1.0.4] - 2016-04-17
|
||||
### Changed
|
||||
- The unique identifier for ATOM feed entries is now compliant to the ATOM standard.
|
||||
|
||||
### Fixed
|
||||
- Filter more invalid XML chars.
|
||||
- Fixed a PHP warning displayed if ```Feed::setTitle``` or ```Feed::setLink``` was not called.
|
||||
|
||||
## [v1.0.3] - 2015-11-11
|
||||
### Added
|
||||
- Method for removing tags which were CDATA encoded.
|
||||
|
||||
### Fixed
|
||||
- Fixed error when the filtering of invalid XML chars failed.
|
||||
- Fixed missing docblock documentation.
|
||||
|
||||
## [v1.0.2] - 2015-01-23
|
||||
### Fixed
|
||||
- Fixed a wrong docblock return data type.
|
||||
|
||||
## [v1.0.1] - 2014-09-21
|
||||
### Fixed
|
||||
- Filter invalid XML chars.
|
||||
|
||||
## v1.0 - 2014-09-14
|
||||
|
||||
|
||||
[Unreleased]: https://github.com/mibe/FeedWriter/compare/v1.1.2...HEAD
|
||||
[v1.1.2]: https://github.com/mibe/FeedWriter/compare/v1.1.1...v1.1.2
|
||||
[v1.1.1]: https://github.com/mibe/FeedWriter/compare/v1.1.0...v1.1.1
|
||||
[v1.1.0]: https://github.com/mibe/FeedWriter/compare/v1.0.4...v1.1.0
|
||||
[v1.0.4]: https://github.com/mibe/FeedWriter/compare/v1.0.3...v1.0.4
|
||||
[v1.0.3]: https://github.com/mibe/FeedWriter/compare/v1.0.2...v1.0.3
|
||||
[v1.0.2]: https://github.com/mibe/FeedWriter/compare/v1.0.1...v1.0.2
|
||||
[v1.0.1]: https://github.com/mibe/FeedWriter/compare/v1.0...v1.0.1
|
39
module/news/vendor/FeedWriter/Feed.php
vendored
39
module/news/vendor/FeedWriter/Feed.php
vendored
@ -2,10 +2,11 @@
|
||||
namespace FeedWriter;
|
||||
|
||||
use \DateTime;
|
||||
use \DateTimeInterface;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>
|
||||
* Copyright (C) 2010-2016 Michael Bemmerl <mail@mx-server.de>
|
||||
* Copyright (C) 2010-2016, 2022 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
@ -76,6 +77,13 @@ abstract class Feed
|
||||
*/
|
||||
private $version = null;
|
||||
|
||||
/**
|
||||
* Contains the encoding of this feed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $encoding = 'utf-8';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -87,9 +95,6 @@ abstract class Feed
|
||||
{
|
||||
$this->version = $version;
|
||||
|
||||
// Setting default encoding
|
||||
$this->encoding = 'utf-8';
|
||||
|
||||
// Setting default value for essential channel element
|
||||
$this->setTitle($version . ' Feed');
|
||||
|
||||
@ -396,9 +401,13 @@ abstract class Feed
|
||||
* @access public
|
||||
* @param string $title value of 'title' channel tag
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the title is empty or NULL.
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
if (empty($title))
|
||||
throw new \InvalidArgumentException('The title may not be empty or NULL.');
|
||||
|
||||
return $this->setChannelElement('title', $title);
|
||||
}
|
||||
|
||||
@ -406,15 +415,15 @@ abstract class Feed
|
||||
* Set the date when the feed was lastly updated.
|
||||
*
|
||||
* This adds the 'updated' element to the feed. The value of the date parameter
|
||||
* can be either an instance of the DateTime class, an integer containing a UNIX
|
||||
* can be either a class implementing DateTimeInterface, an integer containing a UNIX
|
||||
* timestamp or a string which is parseable by PHP's 'strtotime' function.
|
||||
*
|
||||
* Not supported in RSS1 feeds.
|
||||
*
|
||||
* @access public
|
||||
* @param DateTime|int|string Date which should be used.
|
||||
* @param DateTimeInterface|int|string Date which should be used.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the given date is not an instance of DateTime, a UNIX timestamp or a date string.
|
||||
* @throws \InvalidArgumentException if the given date is not an implementation of DateTimeInterface, a UNIX timestamp or a date string.
|
||||
* @throws InvalidOperationException if this method is called on an RSS1 feed.
|
||||
*/
|
||||
public function setDate($date)
|
||||
@ -425,7 +434,7 @@ abstract class Feed
|
||||
// The feeds have different date formats.
|
||||
$format = $this->version == Feed::ATOM ? \DATE_ATOM : \DATE_RSS;
|
||||
|
||||
if ($date instanceof DateTime)
|
||||
if ($date instanceof DateTimeInterface || $date instanceof DateTime)
|
||||
$date = $date->format($format);
|
||||
else if(is_numeric($date) && $date >= 0)
|
||||
$date = date($format, $date);
|
||||
@ -438,7 +447,7 @@ abstract class Feed
|
||||
$date = date($format, $timestamp);
|
||||
}
|
||||
else
|
||||
throw new \InvalidArgumentException('The given date is not an instance of DateTime, a UNIX timestamp or a date string.');
|
||||
throw new \InvalidArgumentException('The given date is not an implementation of DateTimeInterface, a UNIX timestamp or a date string.');
|
||||
|
||||
if ($this->version == Feed::ATOM)
|
||||
$this->setChannelElement('updated', $date);
|
||||
@ -454,9 +463,13 @@ abstract class Feed
|
||||
* @access public
|
||||
* @param string $description Description of the feed.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the description is empty or NULL.
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
if (empty($description))
|
||||
throw new \InvalidArgumentException('The description may not be empty or NULL.');
|
||||
|
||||
if ($this->version != Feed::ATOM)
|
||||
$this->setChannelElement('description', $description);
|
||||
else
|
||||
@ -471,9 +484,13 @@ abstract class Feed
|
||||
* @access public
|
||||
* @param string $link value of 'link' channel tag
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the link is empty or NULL.
|
||||
*/
|
||||
public function setLink($link)
|
||||
{
|
||||
if (empty($link))
|
||||
throw new \InvalidArgumentException('The link may not be empty or NULL.');
|
||||
|
||||
if ($this->version == Feed::ATOM)
|
||||
$this->setAtomLink($link);
|
||||
else
|
||||
@ -667,7 +684,7 @@ abstract class Feed
|
||||
/**
|
||||
* Replace invalid XML characters.
|
||||
*
|
||||
* @link http://www.phpwact.org/php/i18n/charsets#xml See utf8_for_xml() function
|
||||
* @link https://web.archive.org/web/20160608013721/http://www.phpwact.org:80/php/i18n/charsets#xml See utf8_for_xml() function
|
||||
* @link http://www.w3.org/TR/REC-xml/#charsets
|
||||
* @link https://github.com/mibe/FeedWriter/issues/30
|
||||
*
|
||||
@ -906,7 +923,7 @@ abstract class Feed
|
||||
$out .= "</rdf:Seq>" . PHP_EOL . "</items>" . PHP_EOL . "</channel>" . PHP_EOL;
|
||||
|
||||
// An image has its own element after the channel elements.
|
||||
if (array_key_exists('image', $this->data))
|
||||
if (array_key_exists('Image', $this->data))
|
||||
$out .= $this->makeNode('image', $this->data['Image'], array('rdf:about' => $this->data['Image']['url']));
|
||||
} else if ($this->version == Feed::ATOM) {
|
||||
// ATOM feeds have a unique feed ID. Use the title channel element as key.
|
||||
|
16
module/news/vendor/FeedWriter/Item.php
vendored
16
module/news/vendor/FeedWriter/Item.php
vendored
@ -2,6 +2,7 @@
|
||||
namespace FeedWriter;
|
||||
|
||||
use \DateTime;
|
||||
use \DateTimeInterface;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>
|
||||
@ -217,19 +218,19 @@ class Item
|
||||
/**
|
||||
* Set the 'date' element of the feed item.
|
||||
*
|
||||
* The value of the date parameter can be either an instance of the
|
||||
* DateTime class, an integer containing a UNIX timestamp or a string
|
||||
* The value of the date parameter can be either a class implementing
|
||||
* DateTimeInterface, an integer containing a UNIX timestamp or a string
|
||||
* which is parseable by PHP's 'strtotime' function.
|
||||
*
|
||||
* @access public
|
||||
* @param DateTime|int|string $date Date which should be used.
|
||||
* @param DateTimeInterface|int|string $date Date which should be used.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the given date was not parseable.
|
||||
*/
|
||||
public function setDate($date)
|
||||
{
|
||||
if (!is_numeric($date)) {
|
||||
if ($date instanceof DateTime)
|
||||
if ($date instanceof DateTimeInterface || $date instanceof DateTime)
|
||||
$date = $date->getTimestamp();
|
||||
else {
|
||||
$date = strtotime($date);
|
||||
@ -277,7 +278,7 @@ class Item
|
||||
* Attach a external media to the feed item.
|
||||
* Not supported in RSS 1.0 feeds.
|
||||
*
|
||||
* See RFC 4288 for syntactical correct MIME types.
|
||||
* See RFC 6838 for syntactical correct MIME types.
|
||||
*
|
||||
* Note that you should avoid the use of more than one enclosure in one item,
|
||||
* since some RSS aggregators don't support it.
|
||||
@ -288,7 +289,8 @@ class Item
|
||||
* @param string $type The MIME type attribute of the media.
|
||||
* @param boolean $multiple Specifies if multiple enclosures are allowed
|
||||
* @return self
|
||||
* @link https://tools.ietf.org/html/rfc4288
|
||||
* @link https://tools.ietf.org/html/rfc6838
|
||||
* @link http://www.iana.org/assignments/media-types/media-types.xhtml
|
||||
* @throws \InvalidArgumentException if the length or type parameter is invalid.
|
||||
* @throws InvalidOperationException if this method is called on RSS1 feeds.
|
||||
*/
|
||||
@ -389,7 +391,7 @@ class Item
|
||||
// Check if the given ID is an valid URI scheme (see RFC 4287 4.2.6)
|
||||
// The list of valid schemes was generated from http://www.iana.org/assignments/uri-schemes
|
||||
// by using only permanent or historical schemes.
|
||||
$validSchemes = array('aaa', 'aaas', 'about', 'acap', 'acct', 'cap', 'cid', 'coap', 'coaps', 'crid', 'data', 'dav', 'dict', 'dns', 'example', 'fax', 'file', 'filesystem', 'ftp', 'geo', 'go', 'gopher', 'h323', 'http', 'https', 'iax', 'icap', 'im', 'imap', 'info', 'ipp', 'ipps', 'iris', 'iris.beep', 'iris.lwz', 'iris.xpc', 'iris.xpcs', 'jabber', 'ldap', 'mailserver', 'mailto', 'mid', 'modem', 'msrp', 'msrps', 'mtqp', 'mupdate', 'news', 'nfs', 'ni', 'nih', 'nntp', 'opaquelocktoken', 'pack', 'pkcs11', 'pop', 'pres', 'prospero', 'reload', 'rtsp', 'rtsps', 'rtspu', 'service', 'session', 'shttp', 'sieve', 'sip', 'sips', 'sms', 'snews', 'snmp', 'soap.beep', 'soap.beeps', 'stun', 'stuns', 'tag', 'tel', 'telnet', 'tftp', 'thismessage', 'tip', 'tn3270', 'turn', 'turns', 'tv', 'urn', 'vemmi', 'videotex', 'vnc', 'wais', 'ws', 'wss', 'xcon', 'xcon-userid', 'xmlrpc.beep', 'xmlrpc.beeps', 'xmpp', 'z39.50', 'z39.50r', 'z39.50s');
|
||||
$validSchemes = array('aaa', 'aaas', 'about', 'acap', 'acct', 'bb', 'cap', 'cid', 'coap', 'coap+tcp', 'coap+ws', 'coaps', 'coaps+tcp', 'coaps+ws', 'crid', 'data', 'dav', 'dict', 'dns', 'drop', 'dtn', 'example', 'fax', 'file', 'filesystem', 'ftp', 'geo', 'go', 'gopher', 'grd', 'h323', 'http', 'https', 'iax', 'icap', 'im', 'imap', 'info', 'ipn', 'ipp', 'ipps', 'iris', 'iris.beep', 'iris.lwz', 'iris.xpc', 'iris.xpcs', 'jabber', 'ldap', 'leaptofrogans', 'mailserver', 'mailto', 'mid', 'modem', 'msrp', 'msrps', 'mt', 'mtqp', 'mupdate', 'news', 'nfs', 'ni', 'nih', 'nntp', 'opaquelocktoken', 'p1', 'pack', 'pkcs11', 'pop', 'pres', 'prospero', 'reload', 'rtsp', 'rtsps', 'rtspu', 'service', 'session', 'shttp (OBSOLETE)', 'sieve', 'sip', 'sips', 'sms', 'snews', 'snmp', 'soap.beep', 'soap.beeps', 'stun', 'stuns', 'tag', 'tel', 'telnet', 'tftp', 'thismessage', 'tip', 'tn3270', 'turn', 'turns', 'tv', 'upt', 'urn', 'vemmi', 'videotex', 'vnc', 'wais', 'wpid', 'ws', 'wss', 'xcon', 'xcon-userid', 'xmlrpc.beep', 'xmlrpc.beeps', 'xmpp', 'z39.50', 'z39.50r', 'z39.50s');
|
||||
$found = FALSE;
|
||||
$checkId = strtolower($id);
|
||||
|
||||
|
8
module/news/vendor/FeedWriter/README.md
vendored
8
module/news/vendor/FeedWriter/README.md
vendored
@ -12,6 +12,11 @@ Once a feed is fully composed with its items, the feed class can generate the ne
|
||||
|
||||
If you don't have **PHP 5.3** available on your system there is a version supporting **PHP 5.0** and above. See the `legacy-php-5.0` branch.
|
||||
|
||||
## Installation
|
||||
You can install via [Composer](https://getcomposer.org/).
|
||||
|
||||
composer require mibe/feedwriter
|
||||
|
||||
## Documentation
|
||||
|
||||
The documentation can be found in the `gh-pages` branch, or on [GitHub Pages](https://mibe.github.io/FeedWriter/).
|
||||
@ -40,3 +45,6 @@ In chronological order:
|
||||
- Pavel Khakhlou
|
||||
- Daniel
|
||||
- Tino Goratsch
|
||||
- John
|
||||
- Özgür Görgülü
|
||||
- Jan Tojnar
|
||||
|
Loading…
Reference in New Issue
Block a user