Created
March 15, 2010 00:40
-
-
Save jackboberg/332376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
/** | |
* Feed Helper | |
* | |
* @package CodeIgniter | |
* @subpackage Helpers | |
* @category Helpers | |
* | |
* @author Jack Boberg | |
* @copyright ( coded by hand ) 2010-03 | |
* @license http://creativecommons.org/licenses/BSD/ | |
*/ | |
// ------------------------------------------------------------------------ | |
/** | |
* get a Simplepie object with feed loaded | |
* | |
* @access public | |
* @param string $url - URL of feed to load | |
* @return object Simplepie | |
*/ | |
if ( ! function_exists('get_feed')) | |
{ | |
function get_feed($url) | |
{ | |
$CI =& get_instance(); | |
$CI->load->library('simplepie'); | |
$feed = new SimplePie(); | |
$feed->set_cache_location(BASEPATH . 'cache'); | |
$feed->set_feed_url($url); | |
if ( ! $feed->init()) { | |
log_message('debug', $feed->error()); | |
return FALSE; | |
} | |
$feed->handle_content_type(); | |
return $feed; | |
} | |
} | |
// ------------------------------------------------------------------------ | |
/* End of feed_helper.php */ | |
/* Location: ./applications/helpers/feed_helper.php */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment