baser/plugins/feed/models/rss.php
/**
 * A simple function for parsing RSS data. Only returns Items for now.
 *
 * @param string $data
 * @return array 
 * @access private
 */
A simple function for parsing RSS data. Only returns Items for now.
@param string $data
@return array
@access private
A simple function for parsing RSS data . Only returns Items for now . @param string $data @return array @access private
function __parseRSS($data)
    {
        if (empty($data))
            return array();
        $regex = '/\<rss.+version="(.+)".*\>/iUs';
        preg_match($regex, $data, $match);
        if (empty($match))
            return array('Error' => 'No valid feed (no feed version found).');
        list($raw, $version) = $match;
        if (empty($version))
            $version = '2.0';
        if (!preg_match('/^[0-9.]+$/iUs', $version))
        {
            return array('Error' => '"'.$version.'" is no valid RSS version.');
        }
        $rssFunction = '__parseRSS_'.str_replace('.', '_', $version);
        if (method_exists($this, $rssFunction))
        {
            return call_user_func(array(&$this, $rssFunction), $data);
        }
        else 
        {
            return array('Error' => 'No function for parsing RSS feeds of version "'.$version.'" available.');
        }
    }
function __parseRSS ( $ data ) { if ( empty ( $ data ) ) return array ( ) ; $ regex = '/\<rss.+version="(.+)".*\>/iUs' ; preg_match ( $ regex , $ data , $ match ) ; if ( empty ( $ match ) ) return array ( 'Error' => 'No valid feed (no feed version found).' ) ; list ( $ raw , $ version ) = $ match ; if ( empty ( $ version ) ) $ version = '2.0' ; if ( ! preg_match ( '/^[0-9.]+$/iUs' , $ version ) ) { return array ( 'Error' => '"' . $ version . '" is no valid RSS version.' ) ; } $ rssFunction = '__parseRSS_' . str_replace ( '.' , '_' , $ version ) ; if ( method_exists ( $ this , $ rssFunction ) ) { return call_user_func ( array ( & $ this , $ rssFunction ) , $ data ) ; } else { return array ( 'Error' => 'No function for parsing RSS feeds of version "' . $ version . '" available.' ) ; } }
A simple function for parsing RSS data.
A simple function for parsing RSS data .
// Check if we have a valid version number