Content 위젯, RSS리더 기능 강화. (ATOM 1.0 Spec 사용시 작성자 홈페이지 정보가 있으면 링크되게 수정, Feed에 원본 홈페이지 링크 표시 되게 스킨 수정)

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5882 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
misol 2009-03-16 13:12:32 +00:00
parent 6e897213c2
commit 6c25d6f583
3 changed files with 643 additions and 628 deletions

File diff suppressed because it is too large Load diff

View file

@ -483,40 +483,44 @@
$content_items[] = $content_item; $content_items[] = $content_item;
} }
} elseif($xml_doc->{'rdf:RDF'}) { /*
$rss->title = $xml_doc->{'rdf:RDF'}->channel->title->body; } elseif($xml_doc->{'rdf:RDF'}) {
$rss->link = $xml_doc->{'rdf:RDF'}->channel->link->body; // rss1.0 지원 by misol
$rss->title = $xml_doc->{'rdf:RDF'}->channel->title->body;
$items = $xml_doc->{'rdf:RDF'}->item; $rss->link = $xml_doc->{'rdf:RDF'}->channel->link->body;
if(!$items) return; $items = $xml_doc->{'rdf:RDF'}->item;
if($items && !is_array($items)) $items = array($items);
if(!$items) return;
$content_items = array(); if($items && !is_array($items)) $items = array($items);
foreach ($items as $key => $value) { $content_items = array();
if($key >= $args->list_count * $args->page_count) break;
unset($item); foreach ($items as $key => $value) {
if($key >= $args->list_count * $args->page_count) break;
foreach($value as $key2 => $value2) { unset($item);
if(is_array($value2)) $value2 = array_shift($value2);
$item->{$key2} = $this->_getRssBody($value2); foreach($value as $key2 => $value2) {
} if(is_array($value2)) $value2 = array_shift($value2);
$item->{$key2} = $this->_getRssBody($value2);
$content_item = new contentItem($rss->title); }
$content_item->setContentsLink($rss->link);
$content_item->setTitle($item->title); $content_item = new contentItem($rss->title);
$content_item->setNickName(max($item->author,$item->{'dc:creator'})); $content_item->setContentsLink($rss->link);
//$content_item->setCategory($item->category); $content_item->setTitle($item->title);
$item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->description); $content_item->setNickName(max($item->author,$item->{'dc:creator'}));
$content_item->setContent($item->description); //$content_item->setCategory($item->category);
$content_item->setLink($item->link); $item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->description);
$date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'}))); $content_item->setContent($item->description);
$content_item->setRegdate($date); $content_item->setLink($item->link);
$date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'})));
$content_items[] = $content_item; $content_item->setRegdate($date);
}
$content_items[] = $content_item;
}
*/
} elseif($xml_doc->{'rdf:rdf'}) { } elseif($xml_doc->{'rdf:rdf'}) {
// rss1.0 지원 (Xml이 대소문자를 구분해야 하는데 XE의 XML파서가 전부 소문자로 바꾸는 바람에 생긴 case) by misol
$rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body; $rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body;
$rss->link = $xml_doc->{'rdf:rdf'}->channel->link->body; $rss->link = $xml_doc->{'rdf:rdf'}->channel->link->body;
@ -550,6 +554,7 @@
$content_items[] = $content_item; $content_items[] = $content_item;
} }
} elseif($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') { } elseif($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') {
// Atom 1.0 spec 지원 by misol
$rss->title = $xml_doc->feed->title->body; $rss->title = $xml_doc->feed->title->body;
$links = $xml_doc->feed->link; $links = $xml_doc->feed->link;
if(is_array($links)) { if(is_array($links)) {
@ -596,6 +601,7 @@
} }
$content_item->setTitle($item->title); $content_item->setTitle($item->title);
$content_item->setNickName(max($item->author,$item->{'dc:creator'})); $content_item->setNickName(max($item->author,$item->{'dc:creator'}));
$content_item->setAuthorSite($value->author->uri->body);
//$content_item->setCategory($item->category); //$content_item->setCategory($item->category);
$item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->content); $item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->content);
if($item->description) { if($item->description) {
@ -767,6 +773,11 @@
function setNickName($nick_name){ function setNickName($nick_name){
$this->add('nick_name',$nick_name); $this->add('nick_name',$nick_name);
} }
// 글 작성자의 홈페이지 주소를 저장 by misol
function setAuthorSite($site_url){
$this->add('author_site',$site_url);
}
function setCategory($category){ function setCategory($category){
$this->add('category',$category); $this->add('category',$category);
} }
@ -804,6 +815,9 @@
function getNickName(){ function getNickName(){
return $this->get('nick_name'); return $this->get('nick_name');
} }
function getAuthorSite(){
return $this->get('author_site');
}
function getCommentCount(){ function getCommentCount(){
$comment_count = $this->get('comment_count'); $comment_count = $this->get('comment_count');
return $comment_count>0 ? $comment_count : ''; return $comment_count>0 ? $comment_count : '';

View file

@ -8,7 +8,7 @@
<td class="title"> <td class="title">
<!--@if($widget_info->show_browser_title=='Y' && $item->getBrowserTitle())--> <!--@if($widget_info->show_browser_title=='Y' && $item->getBrowserTitle())-->
<a href="{getSiteUrl($item->domain, '', 'mid', $item->get('mid'))}"><strong class="board">{$item->getBrowserTitle()}</strong></a> <a href="<!--@if($item->domain)-->{getSiteUrl($item->domain, '', 'mid', $item->get('mid'))}<!--@elseif($item->getContentsLink())-->{$item->getContentsLink()}<!--@end-->"><strong class="board">{$item->getBrowserTitle()}</strong></a>
<!--@end--> <!--@end-->
<!--@if($widget_info->show_category=='Y' && $item->get('category_srl') )--> <!--@if($widget_info->show_category=='Y' && $item->get('category_srl') )-->
<a href="{getSiteUrl($item->domain,'','mid',$item->get('mid'),'category',$item->get('category_srl'))}"><strong class="category">{$item->getCategory()}</strong></a> <a href="{getSiteUrl($item->domain,'','mid',$item->get('mid'),'category',$item->get('category_srl'))}"><strong class="category">{$item->getCategory()}</strong></a>
@ -29,7 +29,7 @@
<!--@end--> <!--@end-->
</td> </td>
<!--@else if($v=='nickname')--> <!--@else if($v=='nickname')-->
<td><a href="#" onclick="return false;" class="author member_{$item->getMemberSrl()}">{$item->getNickName()}</a></td> <td><a <!--@if($item->getMemberSrl())-->href="#" onclick="return false;" class="author member_{$item->getMemberSrl()}"<!--@elseif($item->getAuthorSite())-->href="{$item->getAuthorSite()}" onclick="window.open(this.href); return false;" class="author member"<!--@else-->href="#" onclick="return false;" class="author member"<!--@end--> >{$item->getNickName()}</a></td>
<!--@else if($v=='regdate')--> <!--@else if($v=='regdate')-->
<td class="time"><span class="date">{$item->getRegdate("Y-m-d")}</span> <span class="hour">{$item->getRegdate("H:i")}</span></td> <td class="time"><span class="date">{$item->getRegdate("Y-m-d")}</span> <span class="hour">{$item->getRegdate("H:i")}</span></td>
<!--@end--> <!--@end-->