Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
+15
-10
@@ -11,33 +11,38 @@
|
||||
namespace IPS\Xml;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\DateTime;
|
||||
use function defined;
|
||||
use function in_array;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for reading an RSS 1.0 document
|
||||
*/
|
||||
class _Rss1 extends Rss
|
||||
class Rss1 extends Rss
|
||||
{
|
||||
/**
|
||||
* Fetch the date
|
||||
*
|
||||
* @param object $item RSS item
|
||||
* @return NULL|\IPS\DateTime
|
||||
* @param object $item RSS item
|
||||
* @return NULL|DateTime
|
||||
*/
|
||||
protected function getDate( $item )
|
||||
protected function getDate( object $item ): ?DateTime
|
||||
{
|
||||
$pubDate = NULL;
|
||||
|
||||
/* If we use the Dublin Core (dc) namespace, we will probably have dc:date */
|
||||
$namespaces = $this->getNamespaces( TRUE );
|
||||
|
||||
if( \in_array( 'http://purl.org/dc/elements/1.1/', $namespaces ) AND $item->children( $namespaces['dc'] )->date )
|
||||
if( in_array( 'https://purl.org/dc/elements/1.1/', $namespaces ) AND $item->children( $namespaces['dc'] )->date )
|
||||
{
|
||||
$pubDate = \IPS\DateTime::ts( strtotime( $item->children( $namespaces['dc'] )->date ) );
|
||||
$pubDate = DateTime::ts( strtotime( $item->children( $namespaces['dc'] )->date ) );
|
||||
}
|
||||
|
||||
return $pubDate ?: parent::getDate( $item );
|
||||
@@ -46,9 +51,9 @@ class _Rss1 extends Rss
|
||||
/**
|
||||
* Fetch the items
|
||||
*
|
||||
* @return array
|
||||
* @return Rss
|
||||
*/
|
||||
protected function getItems()
|
||||
protected function getItems(): Rss
|
||||
{
|
||||
return $this->item;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user