Shapley RSS Aggregator Configuration

/>
/>

ID, "url", true)) { $exists = true; } } return $exists; } function shapley_rss_aggregate() { $options = get_option("shapley_rss_aggregator"); // Only check every 24 hours (this will eventually be an option) if ($options['lastcheck'] < ( mktime() - $options['seconds'] ) ) { $feed_list = split("[\n\r\t ]+",$options['feeds']); foreach($feed_list as $feed) { $valid = strpos($feed, "http://" , 0); if($valid === false) // string contains http:// { // do nothing if the string doesn't contain HTTP } else { if( ! $rssxml = simplexml_load_file( $feed )) { echo "

Unable to access the RSS Feed

"; } else { foreach( $rssxml->channel->item as $items) { // This function will check to see if the post is unique $unique = unique_post($items->link); // if the post is unique, create a new one if ($unique === false) { // Create post array $post_content = $items->description; if($options['nofollow'] === true) { $rel = "rel='nofollow'"; } else { $rel = ""; } if($options['linkback'] === true) { $post_content .= "

Originally posted from ".$items->title.""; } $my_post = array(); $my_post['post_title'] = $items->title; $my_post['post_content'] = $post_content; $my_post['post_status'] = 'publish'; $my_post['post_author'] = 1; $my_post['post_category'] = array($options['categories']); // wp_insert_post, returns the post id, ideal we can then add the source URL to check for uniqueness $post_id = wp_insert_post( $my_post ); // adds the source URL, this is purely to check that each post is unique add_post_meta( $post_id, 'url', "".$items->link."", true); } } } } } $options['lastcheck']= mktime(); update_option("shapley_rss_aggregator",$options); } } // Run the plugin each time the footer is loaded, the plugin will cache and run hourly, could be controllable from the admin page add_action('wp_footer', 'shapley_rss_aggregate'); // Add Admin Page add_action('admin_menu', array('shapley_aggregator','add_config_page')); ?>