Пример #1
0
 function index()
 {
     global $G;
     include_once CLASS_PATH . 'feedcreator.class.php';
     $rss = new UniversalFeedCreator();
     $rss->useCached();
     $rss->title = $G['setting']['site_name'];
     $rss->description = $this->setting->getValue("site_description");
     $rss->link = URL;
     $rss->syndicationURL = URL . "rss.php";
     //announce
     $announce = $this->setting->dbstuff->GetArray("SELECT * FROM {$this->setting->table_prefix}announcements ORDER BY display_order ASC,id DESC LIMIT 0,5");
     if (!empty($announce)) {
         foreach ($announce as $key => $val) {
             $item = new FeedItem();
             $item->title = $val['subject'];
             $item->link = $this->url(array("module" => "announce", "id" => $val['id']));
             $item->description = $val['message'];
             $item->date = $val['created'];
             $item->source = $this->url(array("module" => "announce", "id" => $val['id']));
             $item->author = $G['setting']['company_name'];
             $rss->addItem($item);
         }
     }
     $image = new FeedImage();
     $image->title = $G['setting']['site_banner_word'];
     $image->url = URL . STATICURL . "images/logo.jpg";
     $image->link = URL;
     $image->description = $rss->description;
     $rss->image = $image;
     $rss->saveFeed("RSS1.0", DATA_PATH . "appcache/rss.xml");
 }
 function createXML($title = '', $url = '', $rssurl = '', $description = '', $query = NULL)
 {
     require_once PATH_CORE . '/utilities/feedcreator.class.php';
     $rssFeed = new UniversalFeedCreator();
     $rssFeed->useCached();
     // use cached version if age<1 hour
     $rssFeed->title = $title;
     $rssFeed->link = $url;
     $rssFeed->syndicationURL = $rssFeedurl;
     $rssFeed->description = $description;
     $rssFeed->descriptionTruncSize = 500;
     $rssFeed->descriptionHtmlSyndicated = true;
     $rssFeed->language = "en-us";
     $number = $this->db->countQ($query);
     while ($data = $this->db->readQ($query)) {
         $item = new FeedItem();
         $temptitle = str_replace("\\'", "'", $data->title);
         $temptitle = str_replace('\\"', '"', $temptitle);
         $item->title = $temptitle;
         $item->link = $this->baseUrl . '?p=read&cid=' . $data->siteContentId . '&viaRSS';
         $tempdesc = str_replace("\\'", "'", $data->caption);
         $tempdesc = str_replace('\\"', '"', $tempdesc);
         $tempdesc = $this->utilObj->shorten($tempdesc, 500);
         $item->description = $this->safexml($tempdesc);
         $item->descriptionTruncSize = 500;
         $item->descriptionHtmlSyndicated = true;
         $item->date = $data->mydate;
         $item->source = $this->baseUrl;
         $rssFeed->addItem($item);
     }
     $temp_file = PATH_CACHE . '/rss' . rand(1, 1000) . '.tmp';
     $text = $rssFeed->saveFeed("RSS2.0", $temp_file, false);
     return $text;
 }
Пример #3
0
 public function index()
 {
     $rss = new UniversalFeedCreator();
     $rss->useCached();
     // use cached version if age<1 hour
     $rss->title = app_conf("SHOP_TITLE") . " - " . app_conf("SHOP_SEO_TITLE");
     $rss->description = app_conf("SHOP_SEO_TITLE");
     //optional
     $rss->descriptionTruncSize = 500;
     $rss->descriptionHtmlSyndicated = true;
     $rss->link = get_domain() . APP_ROOT;
     $rss->syndicationURL = get_domain() . APP_ROOT;
     //optional
     $image->descriptionTruncSize = 500;
     $image->descriptionHtmlSyndicated = true;
     $domain = app_conf("PUBLIC_DOMAIN_ROOT") == '' ? get_domain() . $GLOBALS['IMG_APP_ROOT'] : app_conf("PUBLIC_DOMAIN_ROOT");
     $city = get_current_deal_city();
     $city_id = $city['id'];
     $deal_list = get_deal_list(app_conf("DEAL_PAGE_SIZE"), 0, 0, array(DEAL_ONLINE), " buy_type <> 1 or ( is_shop = 1 and is_effect =1 and is_delete = 0 and buy_type <> 1)");
     $deal_list = $deal_list['list'];
     foreach ($deal_list as $data) {
         $item = new FeedItem();
         if ($data['uname'] != '') {
             $gurl = url("shop", "goods", array("id" => $data['uname']));
         } else {
             $gurl = url("shop", "goods", array("id" => $data['id']));
         }
         $data['url'] = $gurl;
         $item->title = msubstr($data['name'], 0, 30);
         $item->link = get_domain() . $data['url'];
         $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']);
         $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']);
         $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']);
         $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>";
         //optional
         $item->descriptionTruncSize = 500;
         $item->descriptionHtmlSyndicated = true;
         if ($data['end_time'] != 0) {
             $item->date = date('r', $data['end_time']);
         }
         $item->source = $data['url'];
         $item->author = app_conf("SHOP_TITLE");
         $rss->addItem($item);
     }
     $rss->saveFeed($format = "RSS0.91", $filename = APP_ROOT_PATH . "public/runtime/app/tpl_caches/rss.xml");
 }
Пример #4
0
 public static function indexAction()
 {
     $rss = new \UniversalFeedCreator();
     $rss->useCached('RSS1.0', ROOT_DIR . '/runtime/rss.xml');
     $rss->title = P_TITLE;
     $rss->link = ENV_PREFERED_PROTOCOL . '://' . CONFIG_HOST . P_PREFIX;
     $rss->syndicationURL = $rss->link . '/feed';
     $posts = \BWBlog\Post::list_all([], 1, 0);
     foreach ($posts as $post) {
         $item = new \FeedItem();
         $item->title = $post['title'];
         $item->link = ENV_PREFERED_PROTOCOL . '://' . CONFIG_HOST . P_PREFIX . $post['rest_url'];
         $item->description = $post['content']['html'];
         $item->date = $post['time']['main'];
         $rss->addItem($item);
     }
     echo $rss->saveFeed('RSS1.0', ROOT_DIR . '/runtime/rss.xml');
 }
Пример #5
0
 function create_xml($fileName, &$list, &$ads, &$columns)
 {
     global $gorumroll;
     include FEED_DIR . "/feedcreator.class.php";
     $ufc = new UniversalFeedCreator();
     $ufc->descriptionHtmlSyndicated = TRUE;
     $ufc->title = $list->listTitle;
     $ufc->description = $list->listDescription;
     $ctrl =& new AppController("customlist/{$list->id}");
     $ufc->link = $ctrl->makeUrl(TRUE);
     $ufc->syndicationURL = $gorumroll->ctrl->makeUrl(TRUE);
     // link to this page
     $owner = new User();
     foreach ($ads as $ad) {
         $item = new FeedItem();
         $item->descriptionHtmlSyndicated = TRUE;
         $item->title = $ad->getTitle(FALSE);
         $ctrl = $ad->getLinkCtrl($item->title);
         $item->link = $ctrl->makeUrl(TRUE);
         $item->description = $ad->getDescription(FALSE);
         // without htmlspecialchars()
         $item->date = (int) $ad->creationtime->getTimestamp();
         $item->additionalElements = array();
         foreach ($columns as $column) {
             if (isset($ad->{$column->columnIndex})) {
                 if ($column->userField) {
                     $owner->{$column->userColumnIndex} = $ad->{$column->columnIndex};
                     $content = $owner->showListVal($column->userColumnIndex, "", TRUE);
                 } else {
                     $content = $ad->showListVal($column->columnIndex, "", TRUE);
                 }
                 $item->additionalElements[$column->showListVal("name")] = array("html" => $column->allowHtml || $column->type == customfield_url || $column->type == customfield_picture || $column->type == customfield_media || $column->columnIndex == "cName" || $column->userColumnIndex == "email", "content" => $content);
             }
         }
         $ufc->addItem($item);
     }
     $ufc->saveFeed($list->xmlType, $fileName, FALSE);
 }
Пример #6
0
function fab_feed($type, $filename, $timeout)
{
    global $sitename, $slogan, $nuke_url, $backend_image, $backend_title, $backend_width, $backend_height, $backend_language, $storyhome;
    include "lib/feedcreator.class.php";
    $rss = new UniversalFeedCreator();
    $rss->useCached($type, $filename, $timeout);
    $rss->title = $sitename;
    $rss->description = $slogan;
    $rss->descriptionTruncSize = 250;
    $rss->descriptionHtmlSyndicated = true;
    $rss->link = $nuke_url;
    $rss->syndicationURL = $nuke_url . "/backend.php?op=" . $type;
    $image = new FeedImage();
    $image->title = $sitename;
    $image->url = $backend_image;
    $image->link = $nuke_url;
    $image->description = $backend_title;
    $image->width = $backend_width;
    $image->height = $backend_height;
    $rss->image = $image;
    $xtab = news_aff("index", "where ihome='0' and archive='0'", $storyhome, "");
    $story_limit = 0;
    while ($story_limit < $storyhome and $story_limit < sizeof($xtab)) {
        list($sid, $catid, $aid, $title, $time, $hometext, $bodytext, $comments, $counter, $topic, $informant, $notes) = $xtab[$story_limit];
        $story_limit++;
        $item = new FeedItem();
        $item->title = preview_local_langue($backend_language, str_replace("&quot;", "\"", $title));
        $item->link = $nuke_url . "/article.php?sid={$sid}";
        $item->description = meta_lang(preview_local_langue($backend_language, $hometext));
        $item->descriptionHtmlSyndicated = true;
        $item->date = convertdateTOtimestamp($time) + $gmt * 3600;
        $item->source = $nuke_url;
        $item->author = $aid;
        $rss->addItem($item);
    }
    echo $rss->saveFeed($type, $filename);
}
Пример #7
0
    $losepoints = $data->losepoints;
    if (strlen($loser2) > 0) {
        $loserdisplay = $loser . "/" . $loser2;
        $losepoints2 = $data->losepoints2;
        $losepointsdisplay = $losepoints . "/" . $losepoints2;
    } else {
        $loserdisplay = $loser;
        $losepointsdisplay = $losepoints;
    }
    $titleRSS = "Game :: " . $winnerdisplay . "  " . $data->winnerresult . " - " . $data->loserresult . "  " . $loserdisplay;
    $winnerteam = getTeamNameForId($data->winnerteam);
    if (empty($winnerteam)) {
        $winnerteam = "Not specified";
    }
    $loserteam = getTeamNameForId($data->loserteam);
    if (empty($loserteam)) {
        $loserteam = "Not specified";
    }
    $ladder = getLadderForVersion($data->version);
    $description = "[" . $ladder . "] [" . $winabb . "] (+" . $data->winpoints . ") " . $winnerdisplay . " " . $data->winnerresult . " - " . $data->loserresult . " " . $loserdisplay . " (-" . $data->losepoints . ") [" . $loseabb . "] - " . $data->comment . "";
    $item = new FeedItem();
    $item->title = $titleRSS;
    $item->link = $directory . "/games.php#" . $data->game_id;
    $item->description = $description;
    $item->date = date('Y-m-d\\TH:m:s\\Z', $data->date);
    $item->source = "http://www.yoursite";
    $item->author = "yoursite";
    $rss->addItem($item);
}
$rss->saveFeed("RSS1.0", "feed_irc_games.xml");
Пример #8
0
    $losepoints = $data->losepoints;
    if (strlen($loser2) > 0) {
        $loserdisplay = $loser . "/" . $loser2;
        $losepoints2 = $data->losepoints2;
        $losepointsdisplay = $losepoints . "/" . $losepoints2;
    } else {
        $loserdisplay = $loser;
        $losepointsdisplay = $losepoints;
    }
    $titleRSS = "Game :: " . $winnerdisplay . "  " . $data->winnerresult . " - " . $data->loserresult . "  " . $loserdisplay;
    $winnerteam = getTeamNameForId($data->winnerteam);
    if (empty($winnerteam)) {
        $winnerteam = "Not specified";
    }
    $loserteam = getTeamNameForId($data->loserteam);
    if (empty($loserteam)) {
        $loserteam = "Not specified";
    }
    $ladder = getLadderForVersion($data->version);
    $description = "(+" . $data->winpoints . ") " . $winnerdisplay . " (" . $winabb . ") " . $data->winnerresult . " - " . $data->loserresult . " (" . $loseabb . ") " . $loserdisplay . " (-" . $data->losepoints . ") - " . $data->comment . "";
    $item = new FeedItem();
    $item->title = $titleRSS;
    $item->link = $directory . "/games.php#" . $data->game_id;
    $item->description = $description;
    $item->date = date('Y-m-d\\TH:m:s\\Z', $data->date);
    $item->source = "http://www.yoursite";
    $item->author = "Ike";
    $rss->addItem($item);
}
$rss->saveFeed("RSS1.0", "feed_test.xml");
    $date_number = mktime($hour, $minute, $second, $month, $day, $year);
    // Add a channel item to the RSS feed.
    $item = new FeedItem();
    $item->title = $heading . " Building Permit Summary";
    $item->link = "http://www.city.charlottetown.pe.ca/" . $url;
    $item->description = "<a href=\"http://www.city.charlottetown.pe.ca/{$url}\">{$heading} Building Permit Summary</a>";
    $item->date = strftime("%Y-%m-%dT%H:%M:%S%z", $date_number);
    $item->source = "http://www.city.charlottetown.pe.ca/residents/application_fees.cfm";
    $item->guid = "http://www.city.charlottetown.pe.ca/" . $url;
    $item->addEnclosure("http://www.city.charlottetown.pe.ca/" . $url, $filesize, "text/pdf");
    $item->author = "peter@rukavina.net (Peter Rukavina)";
    $rss->addItem($item);
    $currentrecord++;
}
// Save the RSS feed.  This should be a web-accessible location.
$rss->saveFeed("RSS2.0", $rssfile, FALSE);
/**
 * Parse apart the part of the filename that contains the date, and make it standard.
 * There is inconsistency in the date format used in URLs.  Examples of formats used:
 * 
 * May 28 05
 * August 27 2005
 * Feb 4 2006
 *
 * The format is always Month - space - day - space - year, but the month can 
 * be abbreviated or spelled out in full, and the year can be two- or four-digit.
 */
function MangleDate($target)
{
    print $target . "\n";
    $target = str_replace("-08", ", 2008", $target);
Пример #10
0
        $item->authorEmail = $row->authorEmail;
    }
    //If needed, trigger content plugins on the row content.
    //TODO - expand this to allow for individual paramters for the plugin instances
    $dispatcher->trigger('onPrepareNinjaRSSFeedRow', array(&$item));
    $rss->addItem($item);
}
//If needed, trigger content plugins on the feed as a whole.
//TODO - expand this to allow for individual paramters for the plugin instances
$dispatcher->trigger('onPrepareNinjaRSSFeed', array(&$rss));
ob_end_clean();
ob_start();
//If we are using the cache and the time out is greater than 0, then generate and use a file.
//Otherwise generate the feed on the fly
if (intval($docache) == 1 && $this->cache > 0) {
    $rss->saveFeed($this->type, $filename, true);
} else {
    $rss->outputFeed($this->type);
}
function noHTML($words)
{
    $words = preg_replace("'<script[^>]*>.*?</script>'si", "", $words);
    $words = preg_replace('/<a\\s+.*?href="([^"]+)"[^>]*>([^<]+)<\\/a>/is', '\\2 (\\1)', $words);
    $words = preg_replace('/<!--.+?-->/', '', $words);
    //$words = preg_replace('/{.+?}/','',$words);
    $words = strip_tags($words);
    $words = preg_replace('/&nbsp;/', ' ', $words);
    //$words = preg_replace('/&amp;/','&',$words);
    //$words = preg_replace('/&quot;/','"',$words);
    return $words;
}
Пример #11
0
 protected function generateRss($key, $items, $title, $nopre = false)
 {
     // This is not a layout page
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
     // Set the timezone to the user timezone
     $timezone = $this->_properties->getProperty('timezone');
     date_default_timezone_set($timezone);
     // Get a few user preferences
     $config = Zend_Registry::get("configuration");
     $root = Zend_Registry::get("root");
     $host = $this->getHostname();
     $preamble = $nopre ? false : $this->_properties->getProperty('preamble', true);
     $username = $this->_user->username;
     // Get the domain right
     $domain = Zend_Registry::get("host");
     // Get the cache path for feeds
     if (isset($config->path->feeds)) {
         $path = $config->path->feeds;
     } else {
         $path = dirname($root) . "/feeds/";
     }
     // Render the RSS feed
     // Go ahead and display the page
     $rss = new UniversalFeedCreator();
     $rss->encoding = "UTF-8";
     // Get the cached object
     $rss_key = "RSS_" . $username . "_" . md5($key);
     $rss->useCached("RSS2.0", $path . "/{$rss_key}.xml", 300);
     // use cached version if age<10 minutes
     // Get all the items and build rss
     $rss->title = $title;
     $rss->descriptionTruncSize = 0;
     $rss->descriptionHtmlSyndicated = true;
     $rss->link = "http://{$domain}";
     if (isset($items) && is_array($items)) {
         for ($i = 0; $i < count($items); $i++) {
             $item = $items[$i];
             $source_id = $item->getSource();
             $item_id = $item->getID();
             $type = $item->getType();
             $slug = $item->getSlug();
             $title = $item->getTitle();
             $pream = $preamble ? $item->getPreamble() : "";
             $entry = new FeedItem();
             $entry->guid = "/entry/{$source_id}/{$item_id}";
             $entry->title = $pream . ($title ? $title : "Untitled");
             $entry->link = "http://{$domain}/entry/{$slug}";
             $entry->description = $item->getRssBody();
             $entry->descriptionHtmlSyndicated = true;
             $entry->source = $item->getLink();
             $entry->descriptionTruncSize = 0;
             $entry->date = (int) $item->getTimestamp();
             $entry->author = $username;
             if ($type == SourceItem::AUDIO_TYPE) {
                 $enclosure = array();
                 $enclosure['url'] = $item->getAudioUrl();
                 $enclosure['type'] = "audio/mpeg";
                 $entry->enclosure = $enclosure;
             }
             $rss->addItem($entry);
         }
     }
     $rss->saveFeed("RSS2.0", $path . "/{$rss_key}.xml");
 }
Пример #12
0
/**
 * Genera el RSS.XML con una clase bajada de internet,
 * ya voy a mejorar eso, pero por ahora NO.
 *
 * @return string
 */
function make_rss()
{
    global $db, $preferences;
    $rss = new UniversalFeedCreator();
    $rss->useCached();
    // use cached version if age < 1 hour
    $rss->title = preg_replace("/(\\<)(.*?)(\\>)/mi", "", $preferences['site_name']);
    $rss->description = $preferences['site_description'];
    $rss->link = $preferences['site_url'];
    $rss->syndicationURL = $preferences['site_url'] . '/rss.xml';
    list($data) = get_posts();
    foreach ($data as $key => $value) {
        $item = new FeedItem();
        $item->title = preg_replace("/(\\<)(.*?)(\\>)/mi", "", $value['title']);
        $item->link = $preferences['site_url'] . '/?id_posts=' . $value['id_posts'];
        $item->description = $value['content'];
        $item->date = $value['date'];
        $item->source = $preferences['site_url'];
        $item->author = $value['user'];
        $rss->addItem($item);
    }
    return $rss->saveFeed("RSS1.0", "../rss.xml", false);
}
Пример #13
0
Файл: rss.php Проект: cwcw/cms
            // limits description text to x words
            $item_description_array = split(' ', $item_description);
            $count = count($item_description_array);
            if ($count > $info['text_length']) {
                $item_description = '';
                for ($a = 0; $a < $info['text_length']; $a++) {
                    $item_description .= $item_description_array[$a] . ' ';
                }
                $item_description = trim($item_description);
                $item_description .= '...';
            }
        } else {
            // do not include description when text_length = 0
            $item_description = NULL;
        }
    }
    // load individual item creator class
    $item = new FeedItem();
    // item info
    $item->title = $item_title;
    $item->link = $item_link;
    $item->description = $item_description;
    //$item->date 		=
    $item->source = $info['link'];
    $item->author = $row->author;
    // loads item info into rss array
    $rss->addItem($item);
}
// save feed file
$rss->saveFeed($info['feed '], $info['file '], true);
Пример #14
0
uses("setting");
$setting = new Settings();
include_once PHPB2B_ROOT . 'libraries/feedcreator.class.php';
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = $_PB_CACHE['setting']['site_name'];
$rss->description = $setting->getValue("site_description");
$rss->link = URL;
$rss->syndicationURL = URL . "rss.php";
//announce
$announce = $pdb->GetArray("SELECT * FROM {$tb_prefix}announcements ORDER BY display_order ASC,id DESC LIMIT 0,5");
if (!empty($announce)) {
    foreach ($announce as $key => $val) {
        $item = new FeedItem();
        $item->title = $val['subject'];
        $item->link = URL . "announce.php?id=" . $val['id'];
        $item->description = $val['message'];
        $item->date = $val['created'];
        $item->source = URL . "announce.php?id=" . $val['id'];
        $item->author = $_PB_CACHE['setting']['company_name'];
        $rss->addItem($item);
    }
}
$image = new FeedImage();
$image->title = $_PB_CACHE['setting']['site_banner_word'];
$image->url = URL . "images/logo.gif";
$image->link = URL;
$image->description = $rss->description;
$rss->image = $image;
$rss->saveFeed("RSS1.0", "data/appcache/rss.xml");
Пример #15
0
    $losepoints = $data->losepoints;
    if (strlen($loser2) > 0) {
        $loserdisplay = $loser . "/" . $loser2;
        $losepoints2 = $data->losepoints2;
        $losepointsdisplay = $losepoints . "/" . $losepoints2;
    } else {
        $loserdisplay = $loser;
        $losepointsdisplay = $losepoints;
    }
    $titleRSS = "Game :: " . $winnerdisplay . "  " . $data->winnerresult . " - " . $data->loserresult . "  " . $loserdisplay;
    $winnerteam = getTeamNameForId($data->winnerteam);
    if (empty($winnerteam)) {
        $winnerteam = "Not specified";
    }
    $loserteam = getTeamNameForId($data->loserteam);
    if (empty($loserteam)) {
        $loserteam = "Not specified";
    }
    $ladder = getLadderForVersion($data->version);
    $description = "<p>Game played: " . date("m/d/Y h:i a", $data->date) . $br . "Ladder: " . $ladder . "</p>" . "<p>" . $winnerdisplay . " team: " . $winnerteam . " (won " . $data->winpoints . " points)" . $br . $loserdisplay . " team: " . $loserteam . " (lost " . $losepointsdisplay . " points)</p>" . "<p>" . $data->winner . "'s comment: " . $br . $data->comment . "</p>";
    $item = new FeedItem();
    $item->title = $titleRSS;
    $item->link = $directory . "/games.php#" . $data->game_id;
    $item->description = $description;
    $item->date = date('Y-m-d\\TH:m:s\\Z', $data->date);
    $item->source = "http://www.yoursite";
    $item->author = "yoursite";
    $rss->addItem($item);
}
$rss->saveFeed("RSS1.0", "feed.xml");
Пример #16
0
function feedFrontpage($showFeed)
{
    global $database, $mainframe;
    global $mosConfig_live_site, $mosConfig_cachepath;
    $nullDate = $database->getNullDate();
    // pull id of syndication component
    $query = "SELECT a.id" . "\n FROM #__components AS a" . "\n WHERE ( a.admin_menu_link = 'option=com_syndicate' OR a.admin_menu_link = 'option=com_syndicate&hidemainmenu=1' )" . "\n AND a.option = 'com_syndicate'";
    $database->setQuery($query);
    $id = $database->loadResult();
    // load syndication parameters
    $component = new mosComponent($database);
    $component->load((int) $id);
    $params = new mosParameters($component->params);
    // test if security check is enbled
    $check = $params->def('check', 1);
    if ($check) {
        // test if rssfeed module is published
        // if not disable access
        $query = "SELECT m.id" . "\n FROM #__modules AS m" . "\n WHERE m.module = 'mod_rssfeed'" . "\n AND m.published = 1";
        $database->setQuery($query);
        $check = $database->loadResultArray();
        if (empty($check)) {
            mosNotAuth();
            return;
        }
    }
    $now = _CURRENT_SERVER_TIME;
    $iso = split('=', _ISO);
    // parameter intilization
    $info['date'] = date('r');
    $info['year'] = date('Y');
    $info['encoding'] = $iso[1];
    $info['link'] = htmlspecialchars($mosConfig_live_site);
    $info['cache'] = $params->def('cache', 1);
    $info['cache_time'] = $params->def('cache_time', 3600);
    $info['count'] = $params->def('count', 5);
    $info['orderby'] = $params->def('orderby', '');
    $info['title'] = $params->def('title', 'Joomla! powered Site');
    $info['description'] = $params->def('description', 'Joomla! site syndication');
    $info['image_file'] = $params->def('image_file', 'joomla_rss.png');
    if ($info['image_file'] == -1) {
        $info['image'] = NULL;
    } else {
        $info['image'] = $mosConfig_live_site . '/images/M_images/' . $info['image_file'];
    }
    $info['image_alt'] = $params->def('image_alt', 'Powered by Joomla!');
    $info['limit_text'] = $params->def('limit_text', 0);
    $info['text_length'] = $params->def('text_length', 20);
    // get feed type from url
    $info['feed'] = strval(mosGetParam($_GET, 'feed', 'RSS2.0'));
    // live bookmarks
    $info['live_bookmark'] = $params->def('live_bookmark', '');
    $info['bookmark_file'] = $params->def('bookmark_file', '');
    // set filename for live bookmarks feed
    if (!$showFeed & $info['live_bookmark']) {
        if ($info['bookmark_file']) {
            // custom bookmark filename
            $filename = $info['bookmark_file'];
        } else {
            // standard bookmark filename
            $filename = $info['live_bookmark'];
        }
    } else {
        // set filename for rss feeds
        $info['file'] = strtolower(str_replace('.', '', $info['feed']));
        // security check to limit arbitrary file creation.
        // and to allow disabling/enabling of selected feed types
        switch ($info['file']) {
            case 'rss091':
                if (!$params->get('rss091', 1)) {
                    echo _NOT_AUTH;
                    return;
                }
                break;
            case 'rss10':
                if (!$params->get('rss10', 1)) {
                    echo _NOT_AUTH;
                    return;
                }
                break;
            case 'rss20':
                if (!$params->get('rss20', 1)) {
                    echo _NOT_AUTH;
                    return;
                }
                break;
            case 'atom03':
                if (!$params->get('atom03', 1)) {
                    echo _NOT_AUTH;
                    return;
                }
                break;
            case 'opml':
                if (!$params->get('opml', 1)) {
                    echo _NOT_AUTH;
                    return;
                }
                break;
            default:
                echo _NOT_AUTH;
                return;
                break;
        }
    }
    $filename = $info['file'] . '.xml';
    // security check to stop server path disclosure
    if (strstr($filename, '/')) {
        echo _NOT_AUTH;
        return;
    }
    $info['file'] = $mosConfig_cachepath . '/' . $filename;
    // load feed creator class
    $rss = new UniversalFeedCreator();
    // load image creator class
    $image = new FeedImage();
    // loads cache file
    if ($showFeed && $info['cache']) {
        $rss->useCached($info['feed'], $info['file'], $info['cache_time']);
    }
    $rss->title = $info['title'];
    $rss->description = $info['description'];
    $rss->link = $info['link'];
    $rss->syndicationURL = $info['link'];
    $rss->cssStyleSheet = NULL;
    $rss->encoding = $info['encoding'];
    if ($info['image']) {
        $image->url = $info['image'];
        $image->link = $info['link'];
        $image->title = $info['image_alt'];
        $image->description = $info['description'];
        // loads image info into rss array
        $rss->image = $image;
    }
    // Determine ordering for sql
    switch (strtolower($info['orderby'])) {
        case 'date':
            $orderby = 'a.created';
            break;
        case 'rdate':
            $orderby = 'a.created DESC';
            break;
        case 'alpha':
            $orderby = 'a.title';
            break;
        case 'ralpha':
            $orderby = 'a.title DESC';
            break;
        case 'hits':
            $orderby = 'a.hits DESC';
            break;
        case 'rhits':
            $orderby = 'a.hits ASC';
            break;
        case 'front':
            $orderby = 'f.ordering';
            break;
        default:
            $orderby = 'f.ordering';
            break;
    }
    // query of frontpage content items
    $query = "SELECT a.*, u.name AS author, u.usertype, UNIX_TIMESTAMP( a.created ) AS created_ts, cat.title AS cat_title, sec.title AS section_title" . "\n FROM #__content AS a" . "\n INNER JOIN #__content_frontpage AS f ON f.content_id = a.id" . "\n LEFT JOIN #__users AS u ON u.id = a.created_by" . "\n LEFT JOIN #__categories AS cat ON cat.id = a.catid" . "\n LEFT JOIN #__sections AS sec ON sec.id = a.sectionid" . "\n WHERE a.state = 1" . "\n AND cat.published = 1" . "\n AND sec.published = 1" . "\n AND a.access = 0" . "\n AND cat.access = 0" . "\n AND sec.access = 0" . "\n AND ( a.publish_up = " . $database->Quote($nullDate) . " OR a.publish_up <= " . $database->Quote($now) . " )" . "\n AND ( a.publish_down = " . $database->Quote($nullDate) . " OR a.publish_down >= " . $database->Quote($now) . " )" . "\n ORDER BY {$orderby}";
    $database->setQuery($query, 0, $info['count']);
    $rows = $database->loadObjectList();
    foreach ($rows as $row) {
        // title for particular item
        $item_title = htmlspecialchars($row->title);
        $item_title = html_entity_decode($item_title);
        // url link to article
        // & used instead of &amp; as this is converted by feed creator
        $_Itemid = '';
        $itemid = $mainframe->getItemid($row->id);
        if ($itemid) {
            $_Itemid = '&Itemid=' . $itemid;
        }
        $item_link = 'index.php?option=com_content&task=view&id=' . $row->id . $_Itemid;
        $item_link = sefRelToAbs($item_link);
        // removes all formating from the intro text for the description text
        $item_description = $row->introtext;
        $item_description = mosHTML::cleanText($item_description);
        $item_description = html_entity_decode($item_description);
        if ($info['limit_text']) {
            if ($info['text_length']) {
                // limits description text to x words
                $item_description_array = split(' ', $item_description);
                $count = count($item_description_array);
                if ($count > $info['text_length']) {
                    $item_description = '';
                    for ($a = 0; $a < $info['text_length']; $a++) {
                        $item_description .= $item_description_array[$a] . ' ';
                    }
                    $item_description = trim($item_description);
                    $item_description .= '...';
                }
            } else {
                // do not include description when text_length = 0
                $item_description = NULL;
            }
        }
        // load individual item creator class
        $item = new FeedItem();
        // item info
        $item->title = $item_title;
        $item->link = $item_link;
        $item->description = $item_description;
        $item->source = $info['link'];
        $item->date = date('r', $row->created_ts);
        $item->category = $row->section_title . ' - ' . $row->cat_title;
        // loads item info into rss array
        $rss->addItem($item);
    }
    // save feed file
    $rss->saveFeed($info['feed'], $info['file'], $showFeed);
}
Пример #17
0
 public function index()
 {
     $rss = new UniversalFeedCreator();
     $rss->useCached();
     // use cached version if age<1 hour
     $rss->title = app_conf("SHOP_TITLE") . " - " . app_conf("SHOP_SEO_TITLE");
     $rss->description = app_conf("SHOP_SEO_TITLE");
     //optional
     $rss->descriptionTruncSize = 500;
     $rss->descriptionHtmlSyndicated = true;
     $rss->link = get_domain() . APP_ROOT;
     $rss->syndicationURL = get_domain() . APP_ROOT;
     //optional
     $image->descriptionTruncSize = 500;
     $image->descriptionHtmlSyndicated = true;
     //对图片路径的修复
     if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") {
         $domain = $GLOBALS['distribution_cfg']['OSS_DOMAIN'];
     } else {
         $domain = SITE_DOMAIN . APP_ROOT;
     }
     $city = City::locate_city();
     $city_id = $city['id'];
     $tuan_list = get_deal_list(10, array(DEAL_ONLINE), array("cid" => 0, "city_id" => 0), '', "  is_shop = 0 and is_effect =1 and is_delete = 0 and buy_type <> 1", " create_time desc ");
     $tuan_list = $tuan_list['list'];
     foreach ($tuan_list as $data) {
         $item = new FeedItem();
         $gurl = url("index", "deal#" . $data['id']);
         $data['url'] = $gurl;
         $item->title = msubstr($data['name'], 0, 30);
         $item->link = get_domain() . $data['url'];
         $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']);
         $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']);
         $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']);
         $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>";
         //optional
         $item->descriptionTruncSize = 500;
         $item->descriptionHtmlSyndicated = true;
         if ($data['end_time'] != 0) {
             $item->date = date('r', $data['end_time']);
         }
         $item->source = $data['url'];
         $item->author = app_conf("SHOP_TITLE");
         $rss->addItem($item);
     }
     $deal_list = get_deal_list(10, array(DEAL_ONLINE), array("cid" => 0, "city_id" => 0), '', "  is_shop = 1 and is_effect =1 and is_delete = 0 and buy_type <> 1", " create_time desc ");
     $deal_list = $deal_list['list'];
     foreach ($deal_list as $data) {
         $item = new FeedItem();
         $gurl = url("index", "deal#" . $data['id']);
         $data['url'] = $gurl;
         $item->title = msubstr($data['name'], 0, 30);
         $item->link = get_domain() . $data['url'];
         $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']);
         $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']);
         $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']);
         $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>";
         //optional
         $item->descriptionTruncSize = 500;
         $item->descriptionHtmlSyndicated = true;
         if ($data['end_time'] != 0) {
             $item->date = date('r', $data['end_time']);
         }
         $item->source = $data['url'];
         $item->author = app_conf("SHOP_TITLE");
         $rss->addItem($item);
     }
     $youhui_list = get_youhui_list(10, array(YOUHUI_ONLINE), array("cid" => 0, "city_id" => 0), '', "  is_effect =1 ", " create_time desc ");
     $youhui_list = $youhui_list['list'];
     foreach ($youhui_list as $data) {
         $item = new FeedItem();
         $gurl = url("index", "youhui#" . $data['id']);
         $data['url'] = $gurl;
         $item->title = msubstr($data['name'], 0, 30);
         $item->link = get_domain() . $data['url'];
         $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']);
         $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']);
         $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']);
         $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>";
         //optional
         $item->descriptionTruncSize = 500;
         $item->descriptionHtmlSyndicated = true;
         if ($data['end_time'] != 0) {
             $item->date = date('r', $data['end_time']);
         }
         $item->source = $data['url'];
         $item->author = app_conf("SHOP_TITLE");
         $rss->addItem($item);
     }
     $event_list = get_event_list(10, array(EVENT_ONLINE), array("cid" => 0, "city_id" => 0), '', "  is_effect =1 ", " sort asc ");
     $event_list = $event_list['list'];
     foreach ($event_list as $data) {
         $item = new FeedItem();
         $gurl = url("index", "event#" . $data['id']);
         $data['url'] = $gurl;
         $item->title = msubstr($data['name'], 0, 30);
         $item->link = get_domain() . $data['url'];
         $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']);
         $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']);
         $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']);
         $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>";
         //optional
         $item->descriptionTruncSize = 500;
         $item->descriptionHtmlSyndicated = true;
         if ($data['end_time'] != 0) {
             $item->date = date('r', $data['end_time']);
         }
         $item->source = $data['url'];
         $item->author = app_conf("SHOP_TITLE");
         $rss->addItem($item);
     }
     $rss->saveFeed($format = "RSS0.91", $filename = APP_ROOT_PATH . "public/runtime/app/tpl_caches/rss.xml");
 }
Пример #18
0
 /**
  * Show given array as RSS page
  */
 function show_rss_page($data = [], $params = [])
 {
     require_php_lib('yf_feedcreator');
     $rss = new UniversalFeedCreator();
     if (!isset($params['use_cached']) || !empty($params['use_cached'])) {
         $rss->useCached();
     }
     $rss->title = _prepare_html(!empty($params['feed_title']) ? $params['feed_title'] : 'Site feed title');
     $rss->description = _prepare_html(!empty($params['feed_desc']) ? $params['feed_desc'] : 'Site feed description');
     // optional feed params
     $rss->descriptionTruncSize = !empty($params['feed_trunc_size']) ? intval($params['item_trunc_size']) : 500;
     $rss->descriptionHtmlSyndicated = isset($params['feed_insert_html']) ? (bool) $params['feed_insert_html'] : true;
     $rss->link = _prepare_html(process_url($params['feed_url'] ?: './?object=' . $_GET['object']));
     $this->self_link = $rss->link;
     $rss->syndicationURL = _prepare_html(process_url($params['feed_source'] ?: './?object=' . $_GET['object'] . '&action=' . $_GET['action'] . (!empty($_GET['id']) ? '&id=' . $_GET['id'] : '')));
     if (!empty($this->SHOW_RSS_ENCODING)) {
         $rss->encoding = $this->SHOW_RSS_ENCODING;
     }
     foreach ((array) $data as $A) {
         $item = new FeedItem();
         if (isset($A['date'])) {
             $A['date'] = intval($A['date']);
         }
         if (isset($A['link'])) {
             $A['link'] = process_url($A['link']);
         }
         // Process known fields
         foreach ((array) $this->avail_item_fields as $field_name) {
             if (isset($A[$field_name])) {
                 $item->{$field_name} = $A[$field_name];
             }
         }
         if (!isset($item->guid)) {
             $item->guid = $A['link'] . '#' . md5($params['feed_source'] . '&' . $A['date'] . '&' . $A['title'] . '&' . $A['author']);
         }
         // optional params
         $item->descriptionTruncSize = !empty($params['item_trunc_size']) ? intval($params['item_trunc_size']) : $this->DESC_TRUNC_SIZE;
         $item->descriptionHtmlSyndicated = isset($params['item_insert_html']) ? (bool) $params['item_insert_html'] : true;
         // optional (enclosure)
         // Sample: $A['enclosure'] = array('url'=>'http://lh3.ggpht.com/smoliarov/Rwygj8ucrbE/AAAAAAAABIA/UkNlwQ7eniw/_200708.jpg','length'=>'65036','type'=>'image/jpeg');
         if (!empty($A['enclosure']) && is_array($A['enclosure'])) {
             $E = $A['enclosure'];
             $item->enclosure = new EnclosureItem();
             $item->enclosure->url = _prepare_html($E['url']);
             $item->enclosure->length = intval($E['length']);
             $item->enclosure->type = _prepare_html($E['type']);
         }
         $rss->addItem($item);
     }
     // Set format of the resulting feed
     $feed_format = isset($params['feed_format']) && in_array($params['feed_format'], $this->avail_formats) ? $params['feed_format'] : 'RSS2.0';
     $feed_file_name = $params['feed_file_name'];
     if (!strlen($feed_file_name)) {
         $feed_file_name = md5($_SERVER['HTTP_HOST'] . '_' . $rss->title . $rss->description . $this->self_link);
     }
     $feed_file_name = common()->_propose_url_from_name($feed_file_name);
     $feed_cache_path = $this->FEEDS_CACHE_PATH . $feed_file_name . '.xml';
     $feed_cache_dir = dirname($feed_cache_path);
     if (!file_exists($feed_cache_dir)) {
         _mkdir_m($feed_cache_dir);
     }
     $feed_redirect = $params['return_feed_text'] ? false : true;
     $body = $rss->saveFeed($feed_format, $feed_cache_path, $feed_redirect);
     if (!empty($params['return_feed_text'])) {
         if ($body) {
             return $body;
         } elseif (file_exists($feed_cache_path)) {
             return file_get_contents($feed_cache_path);
         }
     } else {
         main()->NO_GRAPHICS = true;
         echo $body;
     }
 }
Пример #19
0
$objRss->title = $arrGMeta[$strModuleID]['meta']['Title'] . 'RSS订阅 -' . $arrGWeb['name'];
$objRss->description = $arrGMeta[$strModuleID]['meta']['Description'] . 'RSS订阅 -' . $arrGWeb['name'];
$objRss->descriptionTruncSize = 500;
$objRss->descriptionHtmlSyndicated = true;
$objRss->link = $strDomain . "/" . $strModuleID . '/';
$objRss->syndicationURL = $strDomain . '/' . $_SERVER["PHP_SELF"];
foreach ($arrInfoList as $key => $val) {
    $objItem = new FeedItem();
    $objItem->title = $val['title'];
    $strDir = ceil($val['id'] / $arrGCache['cache_filenum']);
    if ($arrGWeb['URL_static']) {
        if ($arrGWeb['file_static']) {
            $strUrl = $strDomain . '/' . $arrGWeb['cache_url'] . '/' . $strModuleID . '-' . $strDir . '/' . $val['id'] . $arrGWeb['file_suffix'];
        } else {
            $strUrl = $strDomain . '/' . $strModuleID . '/detail/id-' . $val['id'] . $arrGWeb['file_suffix'];
        }
    } else {
        $strUrl = $strDomain . '/' . $strModuleID . '/detail.php?id=' . $val['id'];
    }
    $objItem->link = $strUrl;
    $objItem->description = $val['summary'];
    //optional
    $objItem->descriptionTruncSize = 500;
    $objItem->descriptionHtmlSyndicated = true;
    $objItem->date = strtotime($val['submit_date']);
    $objItem->source = $strDomain;
    $objItem->author = $_SERVER['HTTP_HOST'];
    $objRss->addItem($objItem);
}
echo $objRss->saveFeed("RSS2.0", $arrGSmarty['cache_dir'] . $objRss->_generateFilename());
Пример #20
0
    $rss = new UniversalFeedCreator();
    $rss->useCached();
    $rss->title = $system_courses[$course]['title'];
    $rss->description = $system_courses[$course]['description'];
    $rss->link = AT_BASE_HREF;
    $rss->syndicationURL = AT_BASE_HREF;
    $image = new FeedImage();
    $image->title = 'ATutor Logo';
    $image->url = AT_BASE_HREF . 'images/at-logo.v.3.gif';
    $image->link = AT_BASE_HREF;
    $rss->image = $image;
    $sql = "SELECT A.*, M.login from %snews A, %smembers M WHERE A.course_id = %d AND A.member_id=M.member_id ORDER BY A.date DESC LIMIT 5";
    $res = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $course));
    foreach ($res as $data) {
        $item = new FeedItem();
        $item->title = $data['title'];
        $item->link = AT_BASE_HREF . 'index.php';
        $item->description = $data['body'];
        $item->date = strtotime($data['date']);
        $item->source = AT_BASE_HREF;
        $item->author = $data['login'];
        $rss->addItem($item);
    }
    header('Content-Type: text/xml');
    $rss->saveFeed('RSS' . $version . '.0', AT_CONTENT_DIR . 'feeds/' . $course . '/RSS' . $version . '.0.xml', false);
    echo file_get_contents(AT_CONTENT_DIR . 'feeds/' . $course . '/RSS' . $version . '.0.xml');
    exit;
}
// else: this course didn't enable rss
header('HTTP/1.1 404 Not Found');
exit;
Пример #21
0
    $item->guid = $item->link;
    $description = $recordSet->fields['description'];
    if (strlen($description) > 160) {
        $description = substr($description, 0, 157) . "...";
    }
    $description .= "<br/><br/><a href=\"{$item->link}\">More details of this event</a>";
    $item->description = $description;
    $item->date = strtotime($recordSet->fields['created']);
    $item->author = $recordSet->fields['realname'];
    if (($format == 'KML' || $format == 'GeoRSS' || $format == 'GPX') && $recordSet->fields['gridsquare_id']) {
        $gridsquare = new GridSquare();
        $grid_ok = $gridsquare->loadFromId($recordSet->fields['gridsquare_id']);
        if ($grid_ok) {
            list($item->lat, $item->long) = $conv->internal_to_wgs84($recordSet->fields['x'], $recordSet->fields['y']);
        }
        $rss->addItem($item);
    } elseif ($format != 'KML') {
        $rss->addItem($item);
    }
    $recordSet->MoveNext();
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header("Cache-Control: no-store, no-cache, must-revalidate");
// HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$rss->saveFeed($format, $rssfile);
Пример #22
0
function cached_feed($feed_info)
{
    global $sess, $mosConfig_cachepath;
    // load feed creator class
    require_once $GLOBALS['mosConfig_absolute_path'] . '/includes/feedcreator.class.php';
    $products = getProducts($feed_info);
    if (empty($products)) {
        return;
    }
    $mosConfig_cachepath = empty($mosConfig_cachepath) ? $GLOBALS['mosConfig_absolute_path'] . '/cache' : $mosConfig_cachepath;
    $filename = $mosConfig_cachepath . "/productfeed_" . $feed_info['feed'] . "_catid{$feed_info['category_id']}.xml";
    // load feed creator class
    $rss = new UniversalFeedCreator();
    // load image creator class
    $image = new FeedImage();
    // loads cache file
    if ($feed_info['cache']) {
        $rss->useCached($feed_info['feed'], $filename, $feed_info['cache_time']);
    }
    $rss->title = $feed_info['title'];
    $rss->description = $feed_info['feed_description'];
    $rss->link = htmlspecialchars($feed_info['link']);
    $rss->cssStyleSheet = NULL;
    $rss->encoding = $feed_info['encoding'];
    $feed_image = $feed_info['image_file'];
    if ($feed_image) {
        $image->url = $feed_image;
        $image->link = $rss->link;
        $image->title = $feed_info['image_alt'];
        $image->description = $rss->description;
        // loads image info into rss array
        $rss->image = $image;
    }
    // parameter intilization
    $feed_date = date('r');
    $feed_year = date('Y');
    $limit = min($feed_info['product_number'], 200);
    $limit_text = $feed_info['limit_desc'];
    $text_length = $feed_info['text_length'];
    foreach ($products as $product) {
        // load individual item creator class
        $item = new FeedItem();
        // item info
        $product_link = $sess->url($GLOBALS['mosConfig_live_site'] . '/index.php?product_id=' . $product['id'] . '&page=shop.product_details&category_id=' . $product['category_id'] . '&flypage=' . $product['category_flypage'], true);
        $item->title = htmlspecialchars($product['name']);
        $item->link = vmHtmlEntityDecode($product_link);
        $item->source = $product_link;
        $item->description = getProductDescription($product, $feed_info);
        $item->date = date('r', $product['cdate']);
        $item->category = htmlspecialchars($product['category_name']);
        // loads item info into rss array
        $rss->addItem($item);
    }
    while (@ob_end_clean()) {
    }
    // save feed file
    $rss->saveFeed($feed_info['feed'], $filename);
}
Пример #23
0
 /**
  * records history events in rss/rss_$project->id.xml
  *
  * must be called from a project-related page!
  *
  *
  * @param project - current project object used in: proj.inc.php <- function call
  */
 static function updateRSS($project)
 {
     global $PH;
     global $auth;
     if (!$project) {
         return NULL;
     }
     /**
      * only show changes by others
      */
     if (Auth::isAnonymousUser()) {
         $not_modified_by = NULL;
     } else {
         $not_modified_by = $auth->cur_user->id;
     }
     ### get all the changes (array of history items) ##
     $changes = ChangeLine::getChangeLines(array('project' => $project->id, 'unviewed_only' => false, 'limit_rowcount' => 20, 'type' => array(ITEM_TASK, ITEM_FILE), 'limit_offset' => 0));
     /*
     $changes= DbProjectItem::getAll(array(
         'project'           => $project->id,        # query only this project history
         'alive_only'        => false,               # get deleted entries
         'visible_only'      => false,               # ignore user viewing rights
         'limit_rowcount'    => 20,                  # show only last 20 entries in rss feed
         #'show_assignments'  => false,              # ignore simple assignment events
     ));
     */
     $url = confGet('SELF_PROTOCOL') . '://' . confGet('SELF_URL');
     # url part of the link to the task
     $from_domain = confGet('SELF_DOMAIN');
     # domain url
     if (confGet('USE_MOD_REWRITE')) {
         $url = str_replace('index.php', '', $url);
     }
     ### define general rss file settings ###
     $rss = new UniversalFeedCreator();
     $rss->title = "StreberPM: " . $project->name;
     $rss->description = "Latest Project News";
     $rss->link = "{$url}?go=projView&prj={$project->id}";
     $rss->syndicationURL = $url;
     # go through all retrieved changes and create rss feed
     foreach ($changes as $ch) {
         $item = $ch->item;
         $name_author = __('???');
         if ($person = Person::getVisibleById($item->modified_by)) {
             $name_author = $person->name;
         }
         $str_updated = '';
         if ($new = $ch->item->isChangedForUser()) {
             if ($new == 1) {
                 $str_updated = __('New');
             } else {
                 $str_updated = __('Updated');
             }
         }
         $feeditem = new FeedItem();
         $feeditem->title = $item->name . " (" . $ch->txt_what . ' ' . __("by") . ' ' . $name_author . ")";
         $feeditem->link = $url . "?go=itemView&item={$item->id}";
         $feeditem->date = gmdate("r", strToGMTime($item->modified));
         $feeditem->source = $url;
         $feeditem->author = $name_author;
         switch ($ch->type) {
             case ChangeLine::COMMENTED:
                 $feeditem->description = $ch->html_details;
                 break;
             case ChangeLine::NEW_TASK:
                 $feeditem->description = str_replace("\n", "<br>", $item->description);
                 break;
             default:
                 $feeditem->description = $ch->type . " " . str_replace("\n", "<br>", $item->description);
                 break;
         }
         $rss->addItem($feeditem);
     }
     /**
      * all history items processed ...
      * save the rss 2.0 feed to rss/rss_$project->id.xml ...
      * false stands for not showing the resulting feed file -> create in background
      */
     $rss->saveFeed("RSS2.0", "_rss/proj_{$project->id}.xml", false);
 }
Пример #24
0
 function feed($id, $showFeed)
 {
     global $database, $mainframe;
     global $mosConfig_live_site, $mosConfig_offset, $mosConfig_absolute_path;
     $params = rdRss::getParameters($id);
     //print_r($params);
     // set filename for live bookmarks feed
     if (!$showFeed & $params->live_bookmark) {
         // standard bookmark filename
         $params->file = $mosConfig_absolute_path . '/cache/' . $params->live_bookmark . "_" . $id;
     } else {
         // set filename for rss feeds
         $params->file = strtolower(str_replace('.', '', $params->feed));
         $params->file = $mosConfig_absolute_path . '/cache/' . $params->file . "_" . $id . '.xml';
     }
     // load feed creator class
     $rss = new UniversalFeedCreator();
     // load image creator class
     $image = new FeedImage();
     // loads cache file
     if ($showFeed && $params->cache) {
         $rss->useCached($params->feed, $params->file, $params->cache_time);
     }
     $rss->title = $params->title;
     $rss->description = $params->description;
     $rss->link = $params->link;
     $rss->syndicationURL = $params->link;
     $rss->cssStyleSheet = NULL;
     $rss->encoding = $params->encoding;
     if ($params->image) {
         $image->url = $params->image;
         $image->link = $params->link;
         $image->title = $params->image_alt;
         $image->description = $params->description;
         // loads image info into rss array
         $rss->image = $image;
     }
     if ($id == '1') {
         $fp = 1;
     } else {
         $fp = 0;
     }
     $rows = rdRss::getData($params, $fp);
     if (count($rows) && $params->published) {
         foreach ($rows as $row) {
             // title for particular item
             $item_title = htmlspecialchars($row->title);
             $item_title = html_entity_decode($item_title);
             // url link to article
             // & used instead of &amp; as this is converted by feed creator
             $item_link = $mosConfig_live_site . '/index.php?option=com_content&task=view&id=' . $row->id . '&Itemid=' . $mainframe->getItemid($row->id);
             $item_link = sefRelToAbs($item_link);
             // removes all formating from the intro text for the description text
             $item_description = $row->introtext;
             $item_description = mosHTML::cleanText($item_description);
             $item_description = html_entity_decode($item_description);
             if ($params->limit_text) {
                 if ($params->text_length) {
                     // limits description text to x words
                     $item_description_array = split(' ', $item_description);
                     $count = count($item_description_array);
                     if ($count > $params->text_length) {
                         $item_description = '';
                         for ($a = 0; $a < $params->text_length; $a++) {
                             $item_description .= $item_description_array[$a] . ' ';
                         }
                         $item_description = trim($item_description);
                         $item_description .= '...';
                     }
                 } else {
                     // do not include description when text_length = 0
                     $item_description = NULL;
                 }
             }
             // load individual item creator class
             $item = new FeedItem();
             // item info
             $item->title = $item_title;
             $item->link = $item_link;
             $item->description = $item_description;
             $item->source = $params->link;
             $item->date = date('r', $row->created_ts);
             // loads item info into rss array
             $rss->addItem($item);
         }
     }
     //save feed file
     $rss->saveFeed($params->feed, $params->file, $showFeed);
 }
Пример #25
0
# ***** BEGIN LICENSE BLOCK *****
# This file is part of Kermert.
# Copyright (c) 2005 Pierre-Yves Gillier and contributors. All rights
# reserved.
#
# Kermert is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Kermert is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Kermert; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# ***** END LICENSE BLOCK *****
include_once dirname(__FILE__) . '/includes/prepend.php';
include_once dirname(__FILE__) . '/includes/extend/class.xkermert.php';
include_once dirname(__FILE__) . '/includes/stuff/class.FeedGenerator.php';
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = km_appname;
$rss->description = "Kermert RSS Syndication";
$rss->link = km_appurl;
$rss->syndicationURL = km_appurl . $PHP_SELF;
$rss->saveFeed("RSS2.0", dirname(__FILE__) . '/cache/feed-rss10.rss');
Пример #26
0
$repository = "http://svn.svnkit.com/repos/svnkit/tags/";
$contents = read_contents($repository);
if (!$contents) {
   echo $rss->createFeed();
   exit;
}

$items = publish_rss20($repository, $contents, "http://www.svnkit.com/");
for($i = 0; $i < count($items); $i++) {

     $item = $items[$i];

     $rssitem = new FeedItem();

     $rssitem->title  = $item["title"];
     $rssitem->source = $item["source"];
     $rssitem->link   = $item["link"];
     $rssitem->author = $item["author"];
     $rssitem->date   = $item["date"];
     $rssitem->authorEmail = "*****@*****.**"; 
     $rssitem->editorEmail = "*****@*****.**"; 

     $rssitem->description = $item["rss_description"];
     $rss->addItem($rssitem);
}

$rss->saveFeed("RSS2.0", $cacheFile);
readfile($cacheFile);

exit;
?>
Пример #27
0
        $item->title = $row->topic;
        $item->link = $config['furl'] . "/showtopic.php?id=" . $row->id;
        $item->source = $config['furl'] . "/showforum.php?id=" . $row->board;
        $item->description = $row->comment;
        $item->date = $row->date;
        $item->author = $row->name;
        if ($config['syndication_insert_email'] == 1) {
            $item->authorEmail = $row->email;
        } else {
            $item->authorEmail = '';
        }
        $item->pubDate = $row->date;
        $item->category = $row->forum;
        ($code = $plugins->load('external_item_prepared')) ? eval($code) : null;
        $rss->addItem($item);
    }
} else {
    $item = new FeedItem();
    $item->title = $lang->phrase('offline_head_ext');
    $item->link = $config['furl'];
    $item->description = $lang->phrase('offline_body_ext');
    $item->date = time();
    $item->author = $config['fname'];
    ($code = $plugins->load('external_offline')) ? eval($code) : null;
    $rss->addItem($item);
}
($code = $plugins->load('external_prepared')) ? eval($code) : null;
$rss->saveFeed($format['class'], '', $h);
($code = $plugins->load('external_end')) ? eval($code) : null;
$phpdoc->Out();
$db->close();
Пример #28
0
        $item = new FeedItem();
        $item->title = $mytask["title"];
        $loc = $url . "managetask.php?action=showtask&tid={$mytask['ID']}&id={$mytask['project']}";
        $item->link = $loc;
        $item->source = $loc;
        $item->description = $mytask["text"];
        // optional
        $item->descriptionTruncSize = 500;
        $item->descriptionHtmlSyndicated = true;
        $item->pubDate = $mytask["start"];
        $item->author = "";
        $rss->addItem($item);
    }
    // valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
    // MBOX, OPML, ATOM, ATOM0.3, HTML, JS
    echo $rss->saveFeed("RSS2.0", CL_ROOT . "/files/" . CL_CONFIG . "/ics/feedtask-{$user}.xml");
} elseif ($action == "mymsgs-rss") {
    $tproject = new project();
    $myprojects = $tproject->getMyProjects($user);
    $msg = new message();
    $messages = array();
    foreach ($myprojects as $proj) {
        $message = $msg->getProjectMessages($proj["ID"]);
        if (!empty($message)) {
            array_push($messages, $message);
        }
    }
    if (!empty($messages)) {
        $messages = reduceArray($messages);
    }
    $strpro = $langfile["project"];
Пример #29
0
 function _showrss()
 {
     $app = JFactory::getApplication();
     // Load feed creator class
     require_once JPATH_SITE . DS . 'includes' . DS . 'feedcreator.class.php';
     $rssfile = $app->getCfg('tmp_path') . '/rss.xml';
     $rss = new UniversalFeedCreator();
     $rss->title = $app->getCfg('sitename');
     $rss->description = $app->getCfg('MetaDesc');
     $rss->link = JURI::base();
     $rss->syndicationURL = JURI::base();
     $rss->cssStyleSheet = NULL;
     $rss->descriptionHtmlSyndicated = true;
     $rows = $this->rows;
     if ($rows) {
         foreach ($rows as $row) {
             $item = new FeedItem();
             $sluggy = $row->slug;
             if ($row->catslug && $sluggy != '') {
                 $sluggy .= "&catid=" . $row->catslug;
             }
             $sluggy .= "&directory=" . $this->menuid;
             $item->title = JHTML::_('date', $row->created, JText::_('DATE_FORMAT_LC2')) . "  -  " . stripslashes($row->title);
             $item->link = JURI::base() . "/" . $row->href . $sluggy;
             $item->description = $row->text != '' ? $row->text : $row->fulltext;
             $item->descriptionTruncSize = 250;
             $item->descriptionHtmlSyndicated = true;
             @($date = $row->created ? date('r', strtotime($row->created)) : '');
             $item->date = $date;
             $item->source = JURI::base();
             $rss->addItem($item);
         }
     }
     // save feed file
     $rss->saveFeed('RSS2.0', $rssfile);
 }
Пример #30
0
<?php

include "include/feedcreator.class.php";
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = "PHP news";
$rss->description = "daily news from the PHP scripting world";
$rss->link = "http://www.dailyphp.net/news";
$rss->syndicationURL = "http://www.dailyphp.net/" . $PHP_SELF;
$image = new FeedImage();
$image->title = "dailyphp.net logo";
$image->url = "http://www.dailyphp.net/images/logo.gif";
$image->link = "http://www.dailyphp.net";
$image->description = "Feed provided by dailyphp.net. Click to visit.";
$rss->image = $image;
// get your news items from somewhere, e.g. your database:
mysql_select_db($dbHost, $dbUser, $dbPass);
$res = mysql_query("SELECT * FROM news ORDER BY newsdate DESC");
while ($data = mysql_fetch_object($res)) {
    $item = new FeedItem();
    $item->title = $data->title;
    $item->link = $data->url;
    $item->description = $data->short;
    $item->date = $data->newsdate;
    $item->source = "http://www.dailyphp.net";
    $item->author = "John Doe";
    $rss->addItem($item);
}
$rss->saveFeed("RSS1.0", "news/feed.xml");
?>