Changeset 5376

Show
Ignore:
Timestamp:
02/23/08 19:12:02 (11 months ago)
Author:
inureyes
Message:

#774

  • 댓글-트랙백 통합 RSS 지원
    • suggested by coolengineer / creorix (at Tattercamp)
Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/model/blog.rss.php

    r5367 r5376  
    123123} 
    124124 
    125 function getCommentRSSTotal($blogid) { 
    126     global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service; 
     125function initializeRSSchannel($blogid = null) { 
     126    global $serviceURL, $defaultURL, $blogURL, $blog; 
    127127 
    128128    if(empty($blogid)) $blogid = getBlogId(); 
    129129 
    130130    $channel = array(); 
    131     $channel['title'] = RSSMessage($blog['title']. ': '._text('최근 댓글 목록')); 
    132131    $channel['link'] = "$defaultURL/"; 
    133132    $channel['description'] = RSSMessage($blog['description']); 
     
    142141        $channel['height'] = $logoInfo[1]; 
    143142    } 
     143    return $channel; 
     144} 
     145function getResponseRSSTotal($blogid) { 
     146    global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service; 
     147    if(empty($blogid)) $blogid = getBlogId(); 
     148    $channel = initializeRSSchannel($blogid); 
     149    $channel['title'] = $blog['title']. ': '._text('최근 댓글/트랙백 목록'); 
     150 
     151    $recentComment = getCommentRSSTotal($blogid,true); 
     152    $recentTrackback = getTrackbackRSSTotal($blogid,true); 
     153    $merged = array_merge($recentComment, $recentTrackback); 
     154    $channel['items'] = $merged; 
     155    $rss = array('channel' => $channel); 
     156    return publishRSS($blogid, $rss); 
     157} 
     158 
     159function getResponseRSSByEntryId($blogid, $entryId) { 
     160    global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service; 
     161    if(empty($blogid)) $blogid = getBlogId(); 
     162    $channel = initializeRSSchannel($blogid); 
     163    $channel['title'] = $blog['title']. ': '._text('최근 댓글/트랙백 목록'); 
     164 
     165    $recentComment = getCommentRSSByEntryId($blogid,$entryId,true); 
     166    $recentTrackback = getTrackbackRSSByEntryId($blogid,$entryId,true); 
     167    $merged = array_merge($recentComment, $recentTrackback); 
     168    $channel['items'] = $merged; 
     169    $rss = array('channel' => $channel); 
     170    return publishRSS($blogid, $rss); 
     171} 
     172 
     173function getCommentRSSTotal($blogid, $rawMode = false) { 
     174    global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service; 
     175    $channel = initializeRSSchannel($blogid); 
     176    $channel['title'] = $blog['title']. ': '._text('최근 댓글 목록'); 
     177     
    144178    $result = getRecentComments($blogid, 20, false, true); 
    145179    if (!$result) 
     
    163197        array_push($channel['items'], $item); 
    164198    } 
    165     $rss = array('channel' => $channel); 
    166     return publishRSS($blogid, $rss); 
    167 } 
    168  
    169 function getCommentRSSByEntryId($blogid, $entryId) { 
    170     global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service; 
    171  
     199    if($rawMode == true) return $channel['items']; 
     200    $rss = array('channel' => $channel); 
     201    return publishRSS($blogid, $rss); 
     202} 
     203 
     204function getCommentRSSByEntryId($blogid = null, $entryId, $rawMode = false) { 
     205    global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service; 
     206     
    172207    if(empty($blogid)) $blogid = getBlogId(); 
    173208 
     
    176211    if($entry['visibility'] < 2) return false; 
    177212    if(in_array($entry['category'], getCategoryVisibilityList($blogid, 'private'))) return false; 
    178     $channel = array(); 
     213 
     214    $channel = initializeRSSchannel($blogid); 
    179215    $channel['title'] = RSSMessage($blog['title']. ': '._textf('%1 에 달린 댓글',$entry['title'])); 
    180216    if($blog['useSlogan']) { 
     
    182218    } else { 
    183219        $channel['link'] = $defaultURL."/".$entryId; 
    184     } 
    185     $channel['description'] = RSSMessage($blog['description']); 
    186     $channel['language'] = $blog['language']; 
    187     $channel['pubDate'] = Timestamp::getRFC1123(); 
    188     $channel['generator'] = TEXTCUBE_NAME . ' ' . TEXTCUBE_VERSION; 
    189  
    190     if ((getBlogSetting('visibility',2) == 2) && !empty($blog['logo']) && file_exists(ROOT."/attach/$blogid/{$blog['logo']}")) { 
    191         $logoInfo = getimagesize(ROOT."/attach/$blogid/{$blog['logo']}"); 
    192         $channel['url'] = $serviceURL."/attach/".$blogid."/".$blog['logo']; 
    193         $channel['width'] = $logoInfo[0]; 
    194         $channel['height'] = $logoInfo[1]; 
    195220    } 
    196221    $result = POD::queryAll("SELECT * 
     
    219244        array_push($channel['items'], $item); 
    220245    } 
    221     $rss = array('channel' => $channel); 
    222     return publishRSS($blogid, $rss); 
    223 } 
    224  
    225  
    226 function getTrackbackRSSTotal($blogid) { 
    227     global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service; 
    228  
    229     if(empty($blogid)) $blogid = getBlogId(); 
    230     $isPublic = (getBlogSetting('visibility',2) == 2 ? true : false); 
    231  
    232     $channel = array(); 
     246    if($rawMode == true) return $channel['items']; 
     247    $rss = array('channel' => $channel); 
     248    return publishRSS($blogid, $rss); 
     249} 
     250 
     251 
     252function getTrackbackRSSTotal($blogid, $rawMode = false) { 
     253    global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service; 
     254 
     255    if(empty($blogid)) $blogid = getBlogId(); 
     256    $channel = initializeRSSchannel($blogid); 
    233257    $channel['title'] = RSSMessage($blog['title']. ': '._text('최근 트랙백 목록')); 
    234     $channel['link'] = "$defaultURL/"; 
    235     $channel['description'] = RSSMessage($blog['description']); 
    236     $channel['language'] = $blog['language']; 
    237     $channel['pubDate'] = Timestamp::getRFC1123(); 
    238     $channel['generator'] = TEXTCUBE_NAME . ' ' . TEXTCUBE_VERSION; 
    239  
    240     if ((getBlogSetting('visibility',2) == 2) && !empty($blog['logo']) && file_exists(ROOT."/attach/$blogid/{$blog['logo']}")) { 
    241         $logoInfo = getimagesize(ROOT."/attach/$blogid/{$blog['logo']}"); 
    242         $channel['url'] = $serviceURL."/attach/".$blogid."/".$blog['logo']; 
    243         $channel['width'] = $logoInfo[0]; 
    244         $channel['height'] = $logoInfo[1]; 
    245     } 
    246258    $result = getRecentTrackbacks($blogid, 20, true); 
    247259    if (!$result) 
     
    264276        array_push($channel['items'], $item); 
    265277    } 
    266     $rss = array('channel' => $channel); 
    267     return publishRSS($blogid, $rss); 
    268 } 
    269  
    270 function getTrackbackRSSByEntryId($blogid, $entryId) { 
     278    if($rawMode == true) return $channel['items']; 
     279    $rss = array('channel' => $channel); 
     280    return publishRSS($blogid, $rss); 
     281} 
     282 
     283function getTrackbackRSSByEntryId($blogid = null, $entryId, $rawMode = false) { 
    271284    global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service; 
    272285 
     
    278291    if(in_array($entry['category'], getCategoryVisibilityList($blogid, 'private'))) return false; 
    279292    $channel = array(); 
     293 
     294    $channel = initializeRSSchannel($blogid); 
    280295    $channel['title'] = RSSMessage($blog['title']. ': '._textf('%1 에 달린 트랙백',$entry['slogan'])); 
    281296    if($blog['useSlogan']) { 
     
    283298    } else { 
    284299        $channel['link'] = $defaultURL."/".$entryId; 
    285     } 
    286     $channel['description'] = RSSMessage($blog['description']); 
    287     $channel['language'] = $blog['language']; 
    288     $channel['pubDate'] = Timestamp::getRFC1123(); 
    289     $channel['generator'] = TEXTCUBE_NAME . ' ' . TEXTCUBE_VERSION; 
    290  
    291     if ((getBlogSetting('visibility',2) == 2) && !empty($blog['logo']) && file_exists(ROOT."/attach/$blogid/{$blog['logo']}")) { 
    292         $logoInfo = getimagesize(ROOT."/attach/$blogid/{$blog['logo']}"); 
    293         $channel['url'] = $serviceURL."/attach/".$blogid."/".$blog['logo']; 
    294         $channel['width'] = $logoInfo[0]; 
    295         $channel['height'] = $logoInfo[1]; 
    296300    } 
    297301    $result = POD::queryAll("SELECT *  
     
    320324        array_push($channel['items'], $item); 
    321325    } 
     326    if($rawMode == true) return $channel['items']; 
    322327    $rss = array('channel' => $channel); 
    323328    return publishRSS($blogid, $rss); 
     
    328333 
    329334    if(empty($blogid)) $blogid = getBlogId(); 
    330     $isPublic = (getBlogSetting('visibility',2) == 2 ? true : false); 
    331  
    332     $channel = array(); 
     335    $channel = initializeRSSchannel($blogid); 
    333336    $channel['title'] = RSSMessage($blog['title']. ': '._text('최근 댓글 알리미 목록')); 
    334     $channel['link'] = "$defaultURL/"; 
    335     $channel['description'] = RSSMessage($blog['description']); 
    336     $channel['language'] = $blog['language']; 
    337     $channel['pubDate'] = Timestamp::getRFC1123(); 
    338     $channel['generator'] = TEXTCUBE_NAME . ' ' . TEXTCUBE_VERSION; 
    339  
    340     if ((getBlogSetting('visibility',2) == 2) && !empty($blog['logo']) && file_exists(ROOT."/attach/$blogid/{$blog['logo']}")) { 
    341         $logoInfo = getimagesize(ROOT."/attach/$blogid/{$blog['logo']}"); 
    342         $channel['url'] = $serviceURL."/attach/".$blogid."/".$blog['logo']; 
    343         $channel['width'] = $logoInfo[0]; 
    344         $channel['height'] = $logoInfo[1]; 
    345     } 
    346337    $mergedComments = array(); 
    347338    list($comments, $paging) = getCommentsNotifiedWithPagingForOwner($blogid, '', '', '', '', 1, 20); 
  • trunk/lib/piece/blog/end.php

    r5233 r5376  
    7575dress('link_rep', getLinksView(getLinks( $blogid ), $skin->s_link_rep), $view); 
    7676dress('rss_url', "$defaultURL/rss", $view); 
     77dress('response_rss_url', "$defaultURL/rss/response", $view); 
    7778dress('comment_rss_url', "$defaultURL/rss/comment", $view); 
    7879dress('trackback_rss_url', "$defaultURL/rss/trackback", $view); 
  • trunk/lib/piece/blog/entries.php

    r5285 r5376  
    1313    $entryRsses = ''; 
    1414    foreach ($entries as $entry) { 
     15//      $entryRsses .= '<link rel="alternate" type="application/rss+xml" '. 
     16//          'title="Trackback: '.htmlspecialchars($entry['title']).' - '.htmlspecialchars($blog['title']).'" '. 
     17//          'href="'.$defaultURL.'/rss/trackback/'.$entry['id'].'" />'.CRLF; 
     18//      $entryRsses .= '<link rel="alternate" type="application/rss+xml" '. 
     19//          'title="Comment: '.htmlspecialchars($entry['title']).' - '.htmlspecialchars($blog['title']).'" '. 
     20//          'href="'.$defaultURL.'/rss/comment/'.$entry['id'].'" />'.CRLF; 
    1521        $entryRsses .= '<link rel="alternate" type="application/rss+xml" '. 
    16             'title="Trackback: '.htmlspecialchars($entry['title']).' - '.htmlspecialchars($blog['title']).'" '. 
    17             'href="'.$defaultURL.'/rss/trackback/'.$entry['id'].'" />'.CRLF; 
    18         $entryRsses .= '<link rel="alternate" type="application/rss+xml" '. 
    19             'title="Comment: '.htmlspecialchars($entry['title']).' - '.htmlspecialchars($blog['title']).'" '. 
    20             'href="'.$defaultURL.'/rss/comment/'.$entry['id'].'" />'.CRLF; 
     22            'title="Responses : '.htmlspecialchars($entry['title']).' - '.htmlspecialchars($blog['title']).'" '. 
     23            'href="'.$defaultURL.'/rss/response/'.$entry['id'].'" />'.CRLF; 
    2124    } 
    2225    if( getBlogSetting('useFOAF',1) && rtrim( $suri['url'], '/' ) == $pathURL ) { 
     
    114117            dress('article_rep_rp_rssurl', $defaultURL.'/rss/comment/'.$entry['id'], $entryView); 
    115118            dress('article_rep_tb_rssurl', $defaultURL.'/rss/trackback/'.$entry['id'], $entryView); 
     119            dress('article_rep_response_rssurl', $defaultURL.'/rss/response/'.$entry['id'], $entryView); 
    116120            dress('article_rep_title', htmlspecialchars(fireEvent('ViewPostTitle', $entry['title'], $entry['id'])), $entryView); 
    117121            // 사용자가 작성한 본문은 lib/piece/blog/end.php의 removeAllTags() 다음에 처리하기 위한 조치. 
  • trunk/skin/coolant/skin.html

    r5256 r5376  
    66<meta http-equiv="Keywords" content="[##_meta_http_equiv_keywords_##]" /> 
    77<link rel="alternate" type="application/rss+xml" title="[##_title_##]" href="[##_rss_url_##]" /> 
    8 <link rel="alternate" type="application/rss+xml" title="[##_title_##] : comment" href="[##_comment_rss_url_##]" /> 
    9 <link rel="alternate" type="application/rss+xml" title="[##_title_##] : trackback" href="[##_trackback_rss_url_##]" /> 
     8<link rel="alternate" type="application/rss+xml" title="[##_title_##] : responses" href="[##_response_rss_url_##]" /> 
    109<link rel="stylesheet" media="screen" type="text/css" href="./style.css" /> 
    1110<link rel="stylesheet" media="print" type="text/css" href="./styles/print.css" /> 
     
    302301                                </a> 
    303302                            </dd> 
     303                            <dt class="response"><abbr title="Really Simple Syndication">RSS</dbbr> : </dt> 
     304                            <dd> 
     305                                [##_article_rep_response_rssurl_##] 
     306                            </dd> 
    304307                        </dl> 
    305308                    </div> 
     
    310313                <div class="trackback"> 
    311314                    <p class="url"><dfn>Trackback <abbr title="Uniform Resource Locator">URL</abbr></dfn> : [##_tb_address_##]</p> 
    312                     <p class="url"><dfn>Trackback <abbr title="Really Simple Syndication">RSS</abbr></dfn> : [##_article_rep_tb_rssurl_##]</p> 
     315<!--                    <p class="url"><dfn>Trackback <abbr title="Really Simple Syndication">RSS</abbr></dfn> : [##_article_rep_tb_rssurl_##]</p>--> 
    313316                    <s_tb_container> 
    314317                     
     
    336339                    <h3>Comments List</h3> 
    337340                    <ol> 
    338                         <li><span class="rssurl">Comment RSS : [##_article_rep_rp_rssurl_##]</span></li> 
     341                        <!--<li><span class="rssurl">Comment RSS : [##_article_rep_rp_rssurl_##]</span></li>--> 
    339342                        <s_rp_rep> 
    340343                        <li id="[##_rp_rep_id_##]" class="[##_rp_rep_class_##]"> 
     
    602605                <a href="[##_rss_url_##]" class="rss" rel="alternate" type="application/rss+xml"> 
    603606                    Subscribe to <abbr title="Really Simple Syndication">RSS</abbr> articles</a><br /> 
    604                 <a href="[##_comment_rss_url_##]" class="rss" rel="alternate" type="application/rss+xml">Subscribe to RSS comments</a> 
    605                 <a href="[##_trackback_rss_url_##]" class="rss" rel="alternate" type="application/rss+xml">Subscribe to RSS trackbacks</a> 
    606                     </div> 
     607                <a href="[##_response_rss_url_##]" class="rss" rel="alternate" type="application/rss+xml">Subscribe to RSS responses</a> 
     608            </div> 
    607609            </s_sidebar_element> 
    608610        </s_sidebar> 
  • trunk/skin/standard/skin.html

    r5154 r5376  
    66<meta http-equiv="Keywords" content="[##_meta_http_equiv_keywords_##]" /> 
    77<link rel="alternate" type="application/rss+xml" title="[##_title_##]" href="[##_rss_url_##]" /> 
    8 <link rel="alternate" type="application/rss+xml" title="[##_title_##]" href="[##_comment_rss_url_##]" /> 
     8<link rel="alternate" type="application/rss+xml" title="[##_title_##] : comments" href="[##_comment_rss_url_##]" /> 
     9<link rel="alternate" type="application/rss+xml" title="[##_title_##] : trackbacks" href="[##_trackback_rss_url_##]" /> 
     10<link rel="alternate" type="application/rss+xml" title="[##_title_##] :  comments + trackbacks" href="[##_response_rss_url_##]" /> 
    911<link rel="stylesheet" media="screen" type="text/css" href="./style.css" /> 
    1012<link rel="stylesheet" media="print" type="text/css" href="./images/print.css" /> 
     
    275277                        <a id="[##_article_rep_tb_cnt_id_##]" href="#tb" onclick="[##_article_rep_tb_link_##]"><s_tb_count> 트랙백 <span class="cnt">[##_article_rep_tb_cnt_##]</span>개</s_tb_count></a>,  
    276278                        <a id="[##_article_rep_rp_cnt_id_##]" href="#rp" onclick="[##_article_rep_rp_link_##]"><s_rp_count> 댓글 <span class="cnt">[##_article_rep_rp_cnt_##]</span>개가 달렸습니다.</s_rp_count></a> 
     279                        <h3>댓글+트랙백 RSS :: [##_article_rep_response_rssurl_##]</h3> 
    277280                    </div> 
    278281 
     
    598601                        <img src="./images/rss.gif" alt="rss"/>트랙백</a> 
    599602                    </div> 
     603                    <div class="botton"> 
     604                        <a href="[##_response_rss_url_##]" onclick="window.open(this.href); return false"> 
     605                        <img src="./images/rss.gif" alt="rss"/>댓글+트랙백</a> 
     606                    </div> 
    600607                </s_sidebar_element> 
    601608            </s_sidebar>