| 1 |
<?php |
| 2 |
|
| 3 |
class Red_Rss_File extends Red_FileIO |
| 4 |
{ |
| 5 |
var $title; |
| 6 |
|
| 7 |
function collect ($module) |
| 8 |
{ |
| 9 |
$this->name = $module->name; |
| 10 |
$this->items = Red_Item::get_by_module( $module->id ); |
| 11 |
} |
| 12 |
|
| 13 |
function feed () |
| 14 |
{ |
| 15 |
$title = sprintf ('%s log', $this->name); |
| 16 |
|
| 17 |
header ('Content-type: text/xml; charset='.get_option ('blog_charset'), true); |
| 18 |
echo '<?xml version="1.0" encoding="'.get_option ('blog_charset').'"?'.">\r\n"; |
| 19 |
?> |
| 20 |
<rss version="2.0" |
| 21 |
xmlns:content="http://purl.org/rss/1.0/modules/content/" |
| 22 |
xmlns:wfw="http://wellformedweb.org/CommentAPI/" |
| 23 |
xmlns:dc="http://purl.org/dc/elements/1.1/"> |
| 24 |
<channel> |
| 25 |
<title><?php echo esc_html( $title ).' - '; bloginfo_rss ('name'); ?></title> |
| 26 |
<link><?php bloginfo_rss( 'url' ) ?></link> |
| 27 |
<description><?php bloginfo_rss("description") ?></description> |
| 28 |
<pubDate><?php echo esc_html( mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified( 'GMT' ), false ) ); ?></pubDate> |
| 29 |
<generator><?php echo esc_html( 'http://wordpress.org/?v=' ); bloginfo_rss( 'version' ); ?></generator> |
| 30 |
<language><?php echo get_option( 'rss_language' ); ?></language> |
| 31 |
<?php |
| 32 |
if (count ($this->items) > 0) |
| 33 |
{ |
| 34 |
foreach ($this->items as $log) : ?> |
| 35 |
<item> |
| 36 |
<title><?php echo esc_html( $log->url ); ?></title> |
| 37 |
<link><![CDATA[<?php echo home_url(); echo esc_html( $log->url ); ?>]]></link> |
| 38 |
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', $log->created, false); ?></pubDate> |
| 39 |
<guid isPermaLink="false"><?php echo $log->id; ?></guid> |
| 40 |
<description><?php echo esc_html( $log->url ); ?></description> |
| 41 |
<content:encoded><?php if ( $log->referrer ) echo 'Referred by '.esc_html( $log->referrer ); ?></content:encoded> |
| 42 |
</item> |
| 43 |
<?php endforeach; } ?> |
| 44 |
</channel> |
| 45 |
</rss> |
| 46 |
<?php |
| 47 |
die(); |
| 48 |
} |
| 49 |
} |
| 50 |
|