function update_cache_file() { global $__status, $__config, $__blog_data_items; $cache_file = $__config['blog_data_dir'] . '/' . $__config['cache_file']; find_blog_data_files(); file_put_contents($cache_file, serialize($__blog_data_items), LOCK_EX); if (function_exists('hash_init')) { set_stored_sha1(get_data_sha1()); } $__status['debug'] .= " /**/ Updated cache\n"; }
function blog_feed() { global $__status, $__config, $__status, $__blog_data_items; // // Populate the $__blog_data_items array with qualifying blog data // file names // find_blog_data_files(); $now = date("D, d M Y H:i:s T"); header("Content-Type: application/rss+xml"); echo <<<END <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" \txmlns:content="http://purl.org/rss/1.0/modules/content/" \txmlns:wfw="http://wellformedweb.org/CommentAPI/" \txmlns:dc="http://purl.org/dc/elements/1.1/" \txmlns:atom="http://www.w3.org/2005/Atom" \t> <channel> <title>{$__config['blog_name']}</title> <atom:link href="{$__config['blog_url']}" rel="self" type="application/rss+xml" /> <link>{$__config['blog_url']}</link> <description>{$__config['blog_tag_line']}</description> <pubDate>{$now}</pubDate> <generator>http://onlyblog.googlecode.com/</generator> <language>en</language> END; foreach ($__blog_data_items as $data_item) { $pub_date = date("D, d M Y H:i:s T", $data_item['time']); $excerpt = substr(strip_tags($data_item['entry']), 0, 200); $excerpt = preg_replace('/(\\w+)$/', '', $excerpt); // // Feed readers don't quite like tags in the title // $item_title = preg_replace('/<.*?>/', '', $data_item['header_title']); echo <<<END <item> <title>{$item_title}</title> <link>{$__config['blog_url']}?post={$data_item['data_file']}</link> <pubDate>{$pub_date}</pubDate> <description><![CDATA[{$excerpt} [...] ]]></description> <content:encoded><![CDATA[{$data_item['entry']}]]></content:encoded> </item> END; } echo <<<END </channel> </rss> END; }