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
-9
@@ -11,23 +11,29 @@
|
||||
namespace IPS\Xml;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use Exception;
|
||||
use IPS\DateTime;
|
||||
use IPS\Http\Url;
|
||||
use function defined;
|
||||
|
||||
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 managing Atom documents
|
||||
*/
|
||||
class _Atom extends SimpleXML
|
||||
class Atom extends SimpleXML
|
||||
{
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function title()
|
||||
public function title(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
@@ -35,10 +41,10 @@ class _Atom extends SimpleXML
|
||||
/**
|
||||
* Get articles
|
||||
*
|
||||
* @param mixed $guidKey In previous versions, we encoded a key with the GUID. For legacy purposes, this can be passed here.
|
||||
* @param mixed|null $guidKey In previous versions, we encoded a key with the GUID. For legacy purposes, this can be passed here.
|
||||
* @return array
|
||||
*/
|
||||
public function articles( $guidKey=NULL )
|
||||
public function articles( mixed $guidKey=NULL ): array
|
||||
{
|
||||
$articles = array();
|
||||
|
||||
@@ -64,16 +70,16 @@ class _Atom extends SimpleXML
|
||||
{
|
||||
try
|
||||
{
|
||||
$link = \IPS\Http\Url::external( $linkToCheck );
|
||||
$link = Url::external( $linkToCheck );
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
catch ( Exception $e ) { }
|
||||
}
|
||||
}
|
||||
|
||||
$articles[ md5( $guidKey . ( (string) $item->id ) ) ] = array(
|
||||
'title' => ( (string) $item->title ) ?: ( mb_substr( strip_tags( $item->content ), 0, 47 ) . '...' ),
|
||||
'content' => isset( $item->content ) ? (string) $item->content : (string) $item->title,
|
||||
'date' => \IPS\DateTime::ts( strtotime( $item->updated ) ),
|
||||
'date' => DateTime::ts( strtotime( $item->updated ) ),
|
||||
'link' => $link
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user