Esempio n. 1
0
function publishATOM($blogid, $data)
{
    global $blog;
    $blogid = getBlogId();
    ob_start();
    echo '<?xml version="1.0" encoding="UTF-8"?>', CRLF;
    echo '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0">', CRLF;
    echo '  <title type="html">', htmlspecialchars($data['channel']['title'], ENT_QUOTES), '</title>', CRLF;
    echo '  <id>', $data['channel']['link'], '</id>', CRLF;
    echo '  <link rel="alternate" type="text/html" hreflang="', $data['channel']['language'], '" href="', $data['channel']['link'], '" />', CRLF;
    echo '  <subtitle type="html">', htmlspecialchars($data['channel']['description'], ENT_QUOTES), '</subtitle>', CRLF;
    echo '  <updated>', Timestamp::getISO8601($data['channel']['pubDate']), '</updated>', CRLF;
    echo '  <generator>', $data['channel']['generator'], '</generator>', CRLF;
    foreach ($data['channel']['items'] as $item) {
        echo '  <entry>', CRLF;
        echo '    <title type="html">', htmlspecialchars($item['title'], ENT_QUOTES), '</title>', CRLF;
        echo '    <link rel="alternate" type="text/html" href="', $item['link'], '" />', CRLF;
        if (isset($item['replies'])) {
            echo '    <link rel="replies" type="application/atom+xml" href="', $data['channel']['link'], 'atom/response/', $item['id'], '" thr:count="', $item['replies']['count'], '"/>', CRLF;
        }
        foreach ($item['categories'] as $category) {
            if ($category = trim($category)) {
                echo '    <category term="', htmlspecialchars($category, ENT_QUOTES), '" />', CRLF;
            }
        }
        if (isset($item['author'])) {
            echo '    <author>', CRLF;
            echo '      <name>', htmlspecialchars($item['author'], ENT_QUOTES), '</name>', CRLF;
            echo '    </author>', CRLF;
        }
        echo '    <id>', $item['link'], '</id>', CRLF;
        if (isset($item['updDate'])) {
            echo '    <updated>', Timestamp::getISO8601($item['updDate']), '</updated>', CRLF;
        }
        echo '    <published>', Timestamp::getISO8601($item['pubDate']), '</published>', CRLF;
        /*		if (!empty($item['enclosure'])) {
        			echo '			<enclosure url="', $item['enclosure']['url'], '" length="', $item['enclosure']['length'], '" type="', $item['enclosure']['type'], '" />', CRLF;
        		}*/
        echo '    <summary type="html">', htmlspecialchars($item['description'], ENT_QUOTES), '</summary>', CRLF;
        echo '  </entry>', CRLF;
    }
    echo '</feed>', CRLF;
    $atom = ob_get_contents();
    ob_end_clean();
    return $atom;
}
Esempio n. 2
0
 dress('article_rep_tb_rssurl', $context->getProperty('uri.default') . '/rss/trackback/' . $entry['id'], $entryView);
 dress('article_rep_response_rssurl', $context->getProperty('uri.default') . '/rss/response/' . $entry['id'], $entryView);
 dress('article_rep_rp_atomurl', $context->getProperty('uri.default') . '/atom/comment/' . $entry['id'], $entryView);
 dress('article_rep_tb_atomurl', $context->getProperty('uri.default') . '/atom/trackback/' . $entry['id'], $entryView);
 dress('article_rep_response_atomurl', $context->getProperty('uri.default') . '/atom/response/' . $entry['id'], $entryView);
 dress('article_rep_category_body_id', getCategoryBodyIdById($blogid, $entry['category']) ? getCategoryBodyIdById($blogid, $entry['category']) : 'tt-body-category', $entryView);
 dress('article_rep_title', htmlspecialchars(fireEvent('ViewPostTitle', $entry['title'], $entry['id'])), $entryView);
 // 사용자가 작성한 본문은 interface/common/blog/end.php의 removeAllTags() 다음에 처리하기 위한 조치.
 $contentContainer["article_{$entry['id']}"] = getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'], getKeywordNames($blogid));
 dress('article_rep_desc', setTempTag("article_{$entry['id']}"), $entryView);
 dress('article_rep_category', htmlspecialchars(empty($entry['category']) ? _text('분류없음') : $entry['categoryLabel'], $entry['id']), $entryView);
 dress('article_rep_category_link', $context->getProperty('uri.blog') . "/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView);
 dress('article_rep_category_rssurl', $context->getProperty('uri.default') . "/rss/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView);
 dress('article_rep_category_atomurl', $context->getProperty('uri.default') . "/atom/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView);
 dress('article_rep_microformat_published', Timestamp::getISO8601($entry['published']), $entryView);
 dress('article_rep_microformat_updated', Timestamp::getISO8601($entry['modified']), $entryView);
 dress('article_rep_date', fireEvent('ViewPostDate', Timestamp::format5($entry['published']), $entry['published']), $entryView);
 dress('article_rep_date_modified', fireEvent('ViewPostDate', Timestamp::format5($entry['modified']), $entry['modified']), $entryView);
 dress('entry_archive_link', $context->getProperty('uri.blog') . "/archive/" . Timestamp::getDate($entry['published']), $entryView);
 if ($entry['acceptcomment'] || $entry['comments'] > 0) {
     dress('article_rep_rp_link', "loadComment({$entry['id']},1,false,false); return false", $entryView);
 } else {
     dress('article_rep_rp_link', "return false", $entryView);
 }
 dress('article_rep_rp_cnt_id', "commentCount{$entry['id']}", $entryView);
 list($tempTag, $commentView) = getCommentCountPart($entry['comments'], $skin);
 dress($tempTag, $commentView, $entryView);
 if ($entry['accepttrackback'] || $entry['trackbacks'] > 0) {
     dress('article_rep_tb_link', "toggleLayer('entry{$entry['id']}Trackback'); return false", $entryView);
 } else {
     dress('article_rep_tb_link', "return false", $entryView);