Esempio n. 1
0
 /**
  * Create an RSS Feed
  *
  * @param string $title - feed title
  * @param string $link - url feed title should point to
  * @param string $description - feed description
  * @param array $items - $items[0] = array('title'=>TITLE, 'link'=>URL, 'date'=>TIMESTAMP, 'description'=>DESCRIPTION)
  */
 public function rss($h, $title = '', $link = '', $description = '', $items = array())
 {
     require_once EXTENSIONS . 'RSSWriterClass/rsswriter.php';
     $feed = new RSS();
     $feed->title = stripslashes(html_entity_decode(urldecode($title), ENT_QUOTES, 'UTF-8'));
     $feed->link = html_entity_decode($link, ENT_QUOTES, 'UTF-8');
     $feed->description = $description;
     if ($items) {
         foreach ($items as $item) {
             $rssItem = new RSSItem();
             if (isset($item['title'])) {
                 $rssItem->title = stripslashes(html_entity_decode(urldecode($item['title']), ENT_QUOTES, 'UTF-8'));
             }
             if (isset($item['link'])) {
                 $rssItem->link = html_entity_decode($item['link'], ENT_QUOTES, 'UTF-8');
             }
             if (isset($item['date'])) {
                 $rssItem->setPubDate($item['date']);
             }
             if (isset($item['description'])) {
                 $rssItem->description = "<![CDATA[ " . stripslashes(urldecode($item['description'])) . " ]]>";
             }
             if (isset($item['enclosure'])) {
                 $rssItem->enclosure($item['enclosure']['url'], $item['enclosure']['type'], $item['enclosure']['length']);
             }
             if (isset($item['author'])) {
                 $rssItem->addTag('author', $item['author']);
             }
             $feed->addItem($rssItem);
         }
     }
     echo $feed->serve();
 }
Esempio n. 2
0
 /**
  * Publish content as an RSS feed
  * Uses the 3rd party RSS Writer class.
  */
 public function rssFeed($h)
 {
     require_once EXTENSIONS . 'RSSWriterClass/rsswriter.php';
     $select = '*';
     $limit = $h->cage->get->getInt('limit');
     $user = $h->cage->get->testUsername('user');
     if (!$limit) {
         $limit = 10;
     }
     if ($user) {
         $userid = $h->getUserIdFromName($user);
     } else {
         $userid = 0;
     }
     $h->pluginHook('comments_rss_feed');
     $feed = new RSS();
     $feed->title = SITE_NAME;
     $feed->link = BASEURL;
     if ($user) {
         $feed->description = $h->lang["comment_rss_comments_from_user"] . " " . $user;
     } else {
         $feed->description = $h->lang["comment_rss_latest_comments"] . SITE_NAME;
     }
     // fetch comments from the database
     $comments = $h->comment->getAllComments($h, 0, "desc", $limit, $userid);
     if ($comments) {
         foreach ($comments as $comment) {
             $h->readPost($comment->comment_post_id);
             $author = $h->getUserNameFromId($comment->comment_user_id);
             $item = new RSSItem();
             if ($user) {
                 $title = $h->lang["comment_rss_comment_on"] . html_entity_decode(urldecode($h->post->title), ENT_QUOTES, 'UTF-8');
             } else {
                 $title = $author . $h->lang["comment_rss_commented_on"] . html_entity_decode(urldecode($h->post->title), ENT_QUOTES, 'UTF-8');
             }
             $item->title = stripslashes($title);
             $item->link = $h->url(array('page' => $comment->comment_post_id)) . "#c" . $comment->comment_id;
             $item->setPubDate($comment->comment_date);
             $item->description = "<![CDATA[ " . stripslashes(urldecode($comment->comment_content)) . " ]]>";
             $feed->addItem($item);
         }
     }
     echo $feed->serve();
 }
 /**
  * Assign values to $feed object and serve the feed
  *
  * @param object $results - post rows
  */
 public function doPostRssFeed($h, $results = NULL)
 {
     if (!$results) {
         return false;
     }
     require_once EXTENSIONS . 'RSSWriterClass/rsswriter.php';
     $feed = new RSS();
     $feed->title = $h->vars['postRssFeed']['title'];
     $feed->link = $h->vars['postRssFeed']['link'];
     $feed->description = $h->vars['postRssFeed']['description'] = $h->vars['postRssFeed']['description'];
     // get sb base settings
     $sb_base_settings = $h->getSerializedSettings('sb_base');
     foreach ($results as $result) {
         $h->post->url = $result->post_url;
         // used in Hotaru's url function
         $h->post->category = $result->post_category;
         // used in Hotaru's url function
         $item = new RSSItem();
         $title = html_entity_decode(urldecode($result->post_title), ENT_QUOTES, 'UTF-8');
         $item->title = stripslashes($title);
         // if RSS redirecting is enabled, append forward=1 to the url
         if (isset($sb_base_settings['rss_redirect']) && !empty($sb_base_settings['rss_redirect'])) {
             $item->link = html_entity_decode($h->url(array('page' => $result->post_id, 'forward' => $result->post_id)), ENT_QUOTES, 'UTF-8');
         } else {
             $item->link = $h->url(array('page' => $result->post_id));
         }
         $item->setPubDate($result->post_date);
         $item->description = "<![CDATA[ " . stripslashes(urldecode($result->post_content)) . " ]]>";
         $feed->addItem($item);
     }
     // do it!
     echo $feed->serve();
 }
Esempio n. 4
0
        $mode = "advanced";
    } else {
        $mode = "simple";
    }
    $queryField = getQueryField($search_language_code);
    $response = $solr->query($crit, $queryField, $querylang, '', 0, 0, 100, $fqitms, $word_variations, $filter_lang, $filter_country, $filter_mimetype, $filter_source, $filter_collection, $filter_tag, '', '', '', '', '', true, false);
    if ($response->getHttpStatus() == 200) {
        //print_r( $response->getRawResponse() );
        $url = $config->get("application.url");
        $title = $config->get("application.title");
        $feed = new RSS();
        $feed->title = $title;
        $feed->link = $url;
        $feed->description = "Recent articles matching your criteria : " . $crit;
        if ($response->response->numFound > 0) {
            foreach ($response->response->docs as $doc) {
                $item = new RSSItem();
                $item->title = $doc->title_dis;
                $item->link = $doc->id;
                $item->setPubDate($doc->createtime);
                $item->description = "<![CDATA[ {$doc->summary} ]]>";
                $feed->addItem($item);
            }
        }
        echo $feed->serve();
    }
}
function getQueryField($search_language_code)
{
    return "content_" . $search_language_code;
}