#17625594 Atom 1.0 지원, rss포맷 다양화

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5312 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
misol 2009-01-11 05:50:21 +00:00
parent c434373e5c
commit c9edb15e8d
5 changed files with 73 additions and 23 deletions

View file

@ -25,6 +25,9 @@ RewriteRule ^([a-zA-Z0-9_]+)/([[:digit:]]+)page$ ./index.php?mid=$1&page=$2 [L]
RewriteRule ^rss/([[:digit:]]+){0,14}/([[:digit:]]+){0,14}/([[:digit:]]+)$ ./index.php?module=rss&act=rss&start_date=$1&end_date=$2&page=$3 [L] RewriteRule ^rss/([[:digit:]]+){0,14}/([[:digit:]]+){0,14}/([[:digit:]]+)$ ./index.php?module=rss&act=rss&start_date=$1&end_date=$2&page=$3 [L]
RewriteRule ^rss/([[:digit:]]+)$ ./index.php?module=rss&act=rss&page=$1 [L] RewriteRule ^rss/([[:digit:]]+)$ ./index.php?module=rss&act=rss&page=$1 [L]
RewriteRule ^rss$ ./index.php?module=rss&act=rss [L] RewriteRule ^rss$ ./index.php?module=rss&act=rss [L]
RewriteRule ^atom/([[:digit:]]+){0,14}/([[:digit:]]+){0,14}/([[:digit:]]+)$ ./index.php?module=rss&act=rss&format=atom&start_date=$1&end_date=$2&page=$3 [L]
RewriteRule ^atom/([[:digit:]]+)$ ./index.php?module=rss&act=rss&format=atom&page=$1 [L]
RewriteRule ^atom$ ./index.php?module=rss&act=rss&format=atom [L]
# administrator page # administrator page
RewriteRule ^admin$ ./index.php?module=admin [L] RewriteRule ^admin$ ./index.php?module=admin [L]

View file

@ -104,7 +104,21 @@
$path = $this->module_path.'tpl/'; $path = $this->module_path.'tpl/';
//if($args->start_date || $args->end_date) $file = 'xe_rss'; //if($args->start_date || $args->end_date) $file = 'xe_rss';
//else $file = 'rss20'; //else $file = 'rss20';
$file = 'rss20'; switch (Context::get('format')) {
case 'xe':
$file = 'xe_rss';
break;
case 'atom':
$file = 'atom10';
break;
case 'rss1.0':
$file = 'rss10';
break;
default:
$file = 'rss20';
break;
}
$oTemplate = new TemplateHandler(); $oTemplate = new TemplateHandler();
$oContext = &Context::getInstance(); $oContext = &Context::getInstance();

View file

@ -0,0 +1,33 @@
{'<?xml version="1.0" encoding="UTF-8" ?>'}
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">{$info->title}</title>
<subtitle type="html">{str_replace('\'', '&apos;', htmlspecialchars($info->description))}</subtitle>
<updated>{$info->date}</updated>
<id>{getUrl('','mid',$mid,'module','rss','act','rss','format','atom1.0','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date'))}</id>
<link rel="alternate" type="text/html" hreflang="{$info->language}" href="{$info->link}"/>
<link rel="self" type="application/atom+xml" href="{getUrl('','mid',$mid,'module','rss','act','rss','format','atom1.0','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date'))}"/>
<generator uri="http://www.zeroboard.com/" version="{__ZBXE_VERSION__}">XpressEngine</generator>
<!--@foreach($document_list as $oDocument)--> <entry>
<title>{str_replace('\'', '&apos;',$oDocument->getTitle())}</title>
<id>{$oDocument->getPermanentUrl()}</id>
<published>{$oDocument->getRegdate('Y-m-d\TH:i:sP')}</published>
<updated>{zdate($oDocument->get('last_update'),'Y-m-d\TH:i:sP')}</updated>
<link href="{$oDocument->getPermanentUrl()}"/>
<author>
<name>{str_replace('\'', '&apos;',$oDocument->getNickName())}</name>
<!--@if($oDocument->isExistsHomepage())-->
<uri>{$oDocument->getHomepageUrl()}</uri>
<!--@end-->
</author>
<!--@if($rss_config[$oDocument->get('module_srl')]=='Y')-->
<content type="html">{str_replace('\'', '&apos;', htmlspecialchars($oDocument->getContent(false,false,true)))}</content>
<!--@else-->
<summary type="text">{str_replace('\'', '&apos;', htmlspecialchars($oDocument->getContentText(100)))}</summary>
<!--@end-->
<!--@foreach($oDocument->get('tag_list') as $tag)-->
<category term="{str_replace('\'', '&apos;', htmlspecialchars($tag))}"/>
<!--@end-->
</entry>
<!--@end-->
</feed>

View file

@ -1,27 +1,27 @@
{'<?xml version="1.0" encoding="UTF-8" ?>'} {'<?xml version="1.0" encoding="UTF-8" ?>'}
<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" > <rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" >
<channel rdf:about="http://blog.rss.naver.com/blogRss.nhn?blogId=myyami78&amp;rss=1.0"> <channel rdf:about="{getUrl('','mid',$mid,'module','rss','act','rss','format','rss1.0','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date'))}">
<title><![CDATA[{$info->title}]]></title> <title>{$info->title}</title>
<link><![CDATA[{$info->link}]]></link> <link>{$info->link}</link>
<description><![CDATA[{$info->description}]]></description> <description>{str_replace('\'', '&apos;', htmlspecialchars($info->description))}</description>
<items> <items>
<rdf:Seq> <rdf:Seq>
<!--@foreach($content as $key => $item)--> <!--@foreach($document_list as $oDocument)-->
<rdf:li resource="{$key}" /> <rdf:li resource="{$oDocument->getPermanentUrl()}" />
<!--@end--> <!--@end-->
</rdf:Seq> </rdf:Seq>
</items> </items>
<dc:date>{$info->date}</dc:date> <dc:date>{$info->date}</dc:date>
<dc:language>{$info->language}</dc:language> <dc:language>{$info->language}</dc:language>
<totalCount>{$info->total_count}</totalCount> <totalCount>{$info->total_count}</totalCount>
</channel> </channel>
<!--@foreach($content as $key => $item)--> <!--@foreach($document_list as $oDocument)-->
<item rdf:about="{$key}"> <item rdf:about="{$oDocument->getPermanentUrl()}">
<title><![CDATA[{$item->title}]]></title> <title>{str_replace('\'', '&apos;',$oDocument->getTitle())}</title>
<link><![CDATA[{$item->link}]]></link> <link>{$oDocument->getPermanentUrl()}</link>
<description><![CDATA[{$item->description}]]></description> <description>{str_replace('\'', '&apos;', htmlspecialchars($oDocument->getContentText(200)))}</description>
<dc:date>{$item->date}</dc:date> <dc:date>{$oDocument->getRegdateGM()}</dc:date>
</item> </item>
<!--@end--> <!--@end-->
</rdf:RDF> </rdf:RDF>

View file

@ -2,24 +2,24 @@
<rss version="1.0"> <rss version="1.0">
<channel> <channel>
<title><![CDATA[{$info->title}]]></title> <title>{$info->title}</title>
<link><![CDATA[{$info->link}]]></link> <link>{$info->link}</link>
<description><![CDATA[{$info->description}]]></description> <description>{str_replace('\'', '&apos;', htmlspecialchars($info->description))}</description>
<language>{$info->language}</language> <language>{$info->language}</language>
<pubDate>{$info->date}</pubDate> <pubDate>{$info->date}</pubDate>
<totalCount>{$info->total_count}</totalCount> <totalCount>{$info->total_count}</totalCount>
<totalPage>{$info->total_page}</totalPage> <totalPage>{$info->total_page}</totalPage>
<!--@foreach($document_list as $oDocument)--> <!--@foreach($document_list as $oDocument)-->
<item> <item>
<title><![CDATA[{$oDocument->getTitleText()}]]></title> <title>{str_replace('\'', '&apos;',$oDocument->getTitle())}</title>
<author><![CDATA[{$oDocument->getNickName()}]]></author> <author>{str_replace('\'', '&apos;',$oDocument->getNickName())}</author>
<link><![CDATA[{$oDocument->getPermanentUrl()}]]></link> <link>{$oDocument->getPermanentUrl()}</link>
<!--@if($rss_config[$oDocument->get('module_srl')]->open_rss=='Y')--> <!--@if($rss_config[$oDocument->get('module_srl')]->open_rss=='Y')-->
<description><![CDATA[{$oDocument->getContent(false)}]]></description> <description>{str_replace('\'', '&apos;', htmlspecialchars($oDocument->getContent(false)))}</description>
<!--@else--> <!--@else-->
<description><![CDATA[{$oDocument->getContentText(100)}]]></description> <description>{str_replace('\'', '&apos;', htmlspecialchars($oDocument->getContentText(100)))}</description>
<!--@end--> <!--@end-->
<tags><![CDATA[{$oDocument->get('tags')}]]></tags> <tags>{str_replace('\'', '&apos;', htmlspecialchars($oDocument->get('tags')))}</tags>
<comment_count>{$oDocument->getCommentCount()}</comment_count> <comment_count>{$oDocument->getCommentCount()}</comment_count>
<trackback_count>{$oDocument->getTrackbackCount()}</trackback_count> <trackback_count>{$oDocument->getTrackbackCount()}</trackback_count>
<pubDate>{$oDocument->getRegdateGM()}</pubDate> <pubDate>{$oDocument->getRegdateGM()}</pubDate>