Beispiel #1
0
function getCategoryFeedByCategoryId($blogid, $categoryIds, $mode = 'rss', $categoryTitle = null)
{
    global $database, $serviceURL, $defaultURL, $blog, $service;
    $channel = array();
    $channel = initializeRSSchannel($blogid);
    $entries = POD::queryAll("SELECT \n\t\t\te.*, \n\t\t\tc.name AS categoryName, \n\t\t\tu.name AS author,\n\t\t\tu.loginid AS email\n\t\tFROM {$database['prefix']}Entries e \n\t\tLEFT JOIN {$database['prefix']}Categories c\n\t\t\tON e.blogid = c.blogid AND e.category = c.id\n\t\tLEFT JOIN {$database['prefix']}Users u\n\t\t\tON e.userid = u.userid\n\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 AND e.visibility >= " . ($blog['publishEolinSyncOnRSS'] ? '2' : '3') . " AND e.category IN (" . implode(',', $categoryIds) . ")\n\t\tORDER BY e.published \n\t\tDESC LIMIT {$blog['entriesOnRSS']}");
    if (!$entries) {
        $entries = array();
    }
    $channel['items'] = getFeedItemByEntries($entries);
    if (!is_null($categoryTitle)) {
        $channel['title'] = RSSMessage($blog['title'] . ': ' . _textf('%1 카테고리 글 목록', htmlspecialchars($categoryTitle)));
    }
    $rss = array('channel' => $channel);
    if ($mode == 'rss') {
        return publishRSS($blogid, $rss);
    } else {
        if ($mode == 'atom') {
            return publishATOM($blogid, $rss);
        }
    }
    return false;
}
Beispiel #2
0
function getFeedWithEntries($blogid, $entries, $title = null, $mode = 'rss')
{
    $context = Model_Context::getInstance();
    $channel = array();
    $channel = initializeRSSchannel($blogid);
    if (!$entries) {
        $entries = array();
    }
    $channel['items'] = getFeedItemByEntries($entries);
    if (!is_null($title)) {
        // TODO : change blog.title to support other blogs
        $channel['title'] = RSSMessage($context->getProperty('blog.title') . ': ' . htmlspecialchars($title));
    }
    $rss = array('channel' => $channel);
    if ($mode == 'rss') {
        return publishRSS($blogid, $rss);
    } else {
        if ($mode == 'atom') {
            return publishATOM($blogid, $rss);
        }
    }
    return false;
}