Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
+25
-2
@@ -47,6 +47,7 @@ class Atom extends SimpleXML
|
||||
public function articles( mixed $guidKey=NULL ): array
|
||||
{
|
||||
$articles = array();
|
||||
$namespaces = $this->getDocNamespaces();
|
||||
|
||||
foreach ( $this->entry as $item )
|
||||
{
|
||||
@@ -75,13 +76,35 @@ class Atom extends SimpleXML
|
||||
catch ( Exception $e ) { }
|
||||
}
|
||||
}
|
||||
|
||||
$articles[ md5( $guidKey . ( (string) $item->id ) ) ] = array(
|
||||
|
||||
$key = md5( $guidKey . ( (string) $item->id ) );
|
||||
$articles[ $key ] = array(
|
||||
'title' => ( (string) $item->title ) ?: ( mb_substr( strip_tags( $item->content ), 0, 47 ) . '...' ),
|
||||
'content' => isset( $item->content ) ? (string) $item->content : (string) $item->title,
|
||||
'date' => DateTime::ts( strtotime( $item->updated ) ),
|
||||
'link' => $link
|
||||
);
|
||||
|
||||
/* Loop through all child elements and just add them to the array
|
||||
in case there is a custom extension to process them */
|
||||
foreach( $item->children() as $name => $element )
|
||||
{
|
||||
if( !in_array( $name, [ 'link', 'title', 'content', 'updated' ] ) )
|
||||
{
|
||||
$articles[ $key ][ $name ] = (string) $element;
|
||||
}
|
||||
}
|
||||
|
||||
foreach( $namespaces as $prefix => $namespace )
|
||||
{
|
||||
if( $elements = $item->children( $prefix, true ) )
|
||||
{
|
||||
foreach( $elements as $name => $element )
|
||||
{
|
||||
$articles[ $key ][ $name ] = (string) $element;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $articles;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user