| 1 |
<?php |
| 2 |
/** |
| 3 |
* Renders an Atom feed of records. |
| 4 |
* |
| 5 |
* @package WP_Stream |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
header( 'Content-Type: ' . feed_content_type( 'atom' ) . '; charset=' . get_option( 'blog_charset' ), true ); |
| 13 |
printf( '<?xml version="1.0" encoding="%s"?>', esc_attr( get_option( 'blog_charset' ) ) ); |
| 14 |
?> |
| 15 |
|
| 16 |
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xml:lang="<?php echo esc_attr( bloginfo_rss( 'language' ) ); ?>" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" <?php do_action( 'atom_ns' ); ?>> |
| 17 |
<title><?php bloginfo_rss( 'name' ); ?> - <?php esc_html_e( 'Stream Feed', 'stream' ); ?></title> |
| 18 |
<link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> |
| 19 |
<link href="<?php echo esc_url( $records_admin_url ); ?>" /> |
| 20 |
<subtitle type="html"><?php esc_html( bloginfo_rss( 'description' ) ); ?></subtitle> |
| 21 |
<updated><?php echo esc_html( mysql2date( 'c', $latest_record, false ) ); ?></updated> |
| 22 |
<id><?php echo esc_url( $latest_link ); ?></id> |
| 23 |
<sy:updatePeriod><?php echo esc_html( 'hourly' ); ?></sy:updatePeriod> |
| 24 |
<sy:updateFrequency><?php echo absint( 1 ); ?></sy:updateFrequency> |
| 25 |
<?php |
| 26 |
/** |
| 27 |
* Action fires during RSS head |
| 28 |
*/ |
| 29 |
do_action( 'atom_head' ); |
| 30 |
|
| 31 |
foreach ( $records as $record ) : |
| 32 |
$record_link = add_query_arg( |
| 33 |
array( |
| 34 |
'record__in' => $record->ID, |
| 35 |
), |
| 36 |
$records_admin_url |
| 37 |
); |
| 38 |
|
| 39 |
$author = get_userdata( $record->author ); |
| 40 |
$display_name = isset( $author->display_name ) ? $author->display_name : 'N/A'; |
| 41 |
?> |
| 42 |
<entry> |
| 43 |
<title type="html"><![CDATA[[<?php echo esc_html( $domain ); ?>] <?php echo esc_html( $record->summary ); ?> ]]></title> |
| 44 |
<link href="<?php echo esc_url( $record_link ); ?>" /> |
| 45 |
<updated><?php echo esc_html( mysql2date( 'c', $record->created, false ) ); ?></updated> |
| 46 |
<author> |
| 47 |
<name><?php echo esc_html( $display_name ); ?></name> |
| 48 |
</author> |
| 49 |
<category term="connector" label="<?php echo esc_html( $record->connector ); ?>" /> |
| 50 |
<category term="context" label="<?php echo esc_html( $record->context ); ?>"/> |
| 51 |
<category term="action" label="<?php echo esc_html( $record->action ); ?>" /> |
| 52 |
<category term="ip" label="<?php echo esc_html( $record->ip ); ?>" /> |
| 53 |
<id><?php echo esc_url( $record_link ); ?></id> |
| 54 |
<summary type="html"><![CDATA[- <?php echo esc_html( $display_name ); ?> ]]></summary> |
| 55 |
<?php |
| 56 |
/** |
| 57 |
* Action fires during Atom item |
| 58 |
*/ |
| 59 |
do_action( 'atom_item' ) |
| 60 |
?> |
| 61 |
</entry> |
| 62 |
<?php endforeach; ?> |
| 63 |
</feed> |
| 64 |
<?php |
| 65 |
|