Exemplo n.º 1
0
function parse_feed($feedurl, $htmldata)
{
    $result = '';
    $proxy = new SourceProxy();
    $source = $proxy->makeSourceFromAddress($feedurl, $result);
    //simple_fetch($feedurl, $result);
    if ($source) {
        if (isset($source->logo)) {
            $chanimg = "<a href=\"{$source->link}\"><img src=\"{$source->logo}\" title=\"{$source->title}\" style=\"border: 0px;\" /></a>";
        } else {
            $chanimg = '';
        }
        $htmldata = str_replace("{formaction}", $_SERVER['PHP_SELF'] . '?zfaction=addnew', $htmldata);
        $htmldata = str_replace("{feedurl}", htmlentities($feedurl), $htmldata);
        $htmldata = str_replace("{encfeedurl}", urlencode($feedurl), $htmldata);
        $htmldata = str_replace("{htmlurl}", $source->link, $htmldata);
        $htmldata = str_replace("{chanimg}", $chanimg, $htmldata);
        $htmldata = str_replace("{chantitle}", $source->title, $htmldata);
        $htmldata = str_replace("{chandesc}", $source->description, $htmldata);
        $htmldata = str_replace("{chanlink}", $source->link, $htmldata);
        $htmldata = str_replace("{shownitems}", ZF_DEFAULT_NEWS_COUNT, $htmldata);
        return $htmldata;
    } else {
        return "{$result} {$feedurl}.";
    }
}
Exemplo n.º 2
0
 public function updateSingle($source)
 {
     zf_debug('fetching remote file: ' . $source->xmlurl, DBG_FEED);
     $proxy = new SourceProxy();
     $SPfeed = $proxy->fetchFeed($source, $resultString);
     if ($SPfeed) {
         zf_debug("Fetch successful: " . $source->title, DBG_FEED);
         // add object to cache
         $keepers = $this->ingestFeed($source->id, $SPfeed);
         //after update, clean up old items not present in the feed,
         // except the savec ones
         DBProxy::getInstance()->purgeSourceItems($source->id, $keepers);
     } else {
         zf_debug('failed fetching remote file ' . $resultString . ' - ' . $source->xmlurl, DBG_FEED);
     }
 }
Exemplo n.º 3
0
 public static function fromAddress($xmlurl)
 {
     $proxy = new SourceProxy($xmlurl);
     return $proxy->makeSourceFromAddress($xmlurl);
 }