mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
planet, cafeXE 메인 사이트들에 대해서도 RSS를 통합 출력할 수 있게 기능 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6441 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
125d8f829c
commit
83b406492e
12 changed files with 204 additions and 87 deletions
|
|
@ -18,92 +18,94 @@
|
|||
|
||||
/**
|
||||
* @brief 피드 출력
|
||||
* 직접 RSS를 출력하려고 할때에는 $oRssView->rss($document_list)를 통해서 결과값을 직접 지정 가능
|
||||
**/
|
||||
function rss() {
|
||||
/**
|
||||
* 피드 출력을 위한 변수 설정
|
||||
**/
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$site_srl = $site_module_info->site_srl;
|
||||
$mid = Context::get('mid'); ///< 대상 모듈 id, 없으면 전체로
|
||||
$start_date = (int)Context::get('start_date');
|
||||
$end_date = (int)Context::get('end_date');
|
||||
|
||||
function rss($document_list = null, $rss_title = null) {
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
$module_srls = array();
|
||||
$rss_config = array();
|
||||
$total_config = '';
|
||||
$total_config = $oModuleModel->getModuleConfig('rss');
|
||||
// 다른 모듈에서 method로 호출되는 것이 아니라면 현재 요청된 모듈을 대상으로 글과 정보를 구함
|
||||
if(!$document_list) {
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$site_srl = $site_module_info->site_srl;
|
||||
$mid = Context::get('mid'); ///< 대상 모듈 id, 없으면 전체로
|
||||
$start_date = (int)Context::get('start_date');
|
||||
$end_date = (int)Context::get('end_date');
|
||||
|
||||
// 하나의 mid가 지정되어 있으면 그 mid에 대한 것만 추출
|
||||
if($mid) {
|
||||
$module_srl = $this->module_info->module_srl;
|
||||
$config = $oModuleModel->getModulePartConfig('rss', $module_srl);
|
||||
if($config->open_rss && $config->open_rss != 'N') {
|
||||
$module_srls[] = $module_srl;
|
||||
$open_rss_config[$module_srl] = $config->open_rss;
|
||||
}
|
||||
$module_srls = array();
|
||||
$rss_config = array();
|
||||
$total_config = '';
|
||||
$total_config = $oModuleModel->getModuleConfig('rss');
|
||||
|
||||
// mid 가 선택되어 있지 않으면 전체
|
||||
} else {
|
||||
if($total_config->use_total_feed != 'N') {
|
||||
$rss_config = $oModuleModel->getModulePartConfigs('rss', $site_srl);
|
||||
if($rss_config) {
|
||||
foreach($rss_config as $module_srl => $config) {
|
||||
if($config && $config->open_rss != 'N' && $config->open_total_feed != 'T_N') {
|
||||
$module_srls[] = $module_srl;
|
||||
$open_rss_config[$module_srl] = $config->open_rss;
|
||||
// 하나의 mid가 지정되어 있으면 그 mid에 대한 것만 추출
|
||||
if($mid) {
|
||||
$module_srl = $this->module_info->module_srl;
|
||||
$config = $oModuleModel->getModulePartConfig('rss', $module_srl);
|
||||
if($config->open_rss && $config->open_rss != 'N') {
|
||||
$module_srls[] = $module_srl;
|
||||
$open_rss_config[$module_srl] = $config->open_rss;
|
||||
}
|
||||
|
||||
// mid 가 선택되어 있지 않으면 전체
|
||||
} else {
|
||||
if($total_config->use_total_feed != 'N') {
|
||||
$rss_config = $oModuleModel->getModulePartConfigs('rss', $site_srl);
|
||||
if($rss_config) {
|
||||
foreach($rss_config as $module_srl => $config) {
|
||||
if($config && $config->open_rss != 'N' && $config->open_total_feed != 'T_N') {
|
||||
$module_srls[] = $module_srl;
|
||||
$open_rss_config[$module_srl] = $config->open_rss;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!count($module_srls)) return $this->dispError();
|
||||
|
||||
$args->module_srl = implode(',',$module_srls);
|
||||
$module_list = $oModuleModel->getMidList($args);
|
||||
|
||||
$args->search_target = 'is_secret';
|
||||
$args->search_keyword = 'N';
|
||||
$args->page = (int)Context::get('page');
|
||||
$args->list_count = 15;
|
||||
if($total_config->feed_document_count) $args->list_count = $total_config->feed_document_count;
|
||||
if(!$args->page || $args->page < 1) $args->page = 1;
|
||||
if($start_date || $start_date != 0) $args->start_date = $start_date;
|
||||
if($end_date || $end_date != 0) $args->end_date = $end_date;
|
||||
if($start_date == 0) unset($start_date);
|
||||
if($end_date == 0) unset($end_date);
|
||||
|
||||
$args->sort_index = 'list_order';
|
||||
$args->order_type = 'asc';
|
||||
$output = $oDocumentModel->getDocumentList($args);
|
||||
$document_list = $output->data;
|
||||
|
||||
// 피드 제목 및 정보등을 추출 Context::getBrowserTitle
|
||||
if($mid) {
|
||||
$info->title = Context::getBrowserTitle();
|
||||
$oModuleController->replaceDefinedLangCode($info->title);
|
||||
|
||||
$info->title = str_replace('\'', ''',$info->title);
|
||||
if($config->feed_description) {
|
||||
$info->description = str_replace('\'', ''', htmlspecialchars($config->feed_description));
|
||||
}
|
||||
else {
|
||||
$info->description = str_replace('\'', ''', htmlspecialchars($this->module_info->description));
|
||||
}
|
||||
$info->link = getUrl('','mid',$mid);
|
||||
$info->feed_copyright = str_replace('\'', ''', htmlspecialchars($feed_config->feed_copyright));
|
||||
if(!$info->feed_copyright) {
|
||||
$info->feed_copyright = str_replace('\'', ''', htmlspecialchars($total_config->feed_copyright));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!count($module_srls)) return $this->dispError();
|
||||
|
||||
$args->module_srl = implode(',',$module_srls);
|
||||
$module_list = $oModuleModel->getMidList($args);
|
||||
|
||||
$args->search_target = 'is_secret';
|
||||
$args->search_keyword = 'N';
|
||||
$args->page = (int)Context::get('page');
|
||||
$args->list_count = 15;
|
||||
if($total_config->feed_document_count) $args->list_count = $total_config->feed_document_count;
|
||||
if(!$args->page || $args->page < 1) $args->page = 1;
|
||||
if($start_date || $start_date != 0) $args->start_date = $start_date;
|
||||
if($end_date || $end_date != 0) $args->end_date = $end_date;
|
||||
if($start_date == 0) unset($start_date);
|
||||
if($end_date == 0) unset($end_date);
|
||||
|
||||
$args->sort_index = 'list_order';
|
||||
$args->order_type = 'asc';
|
||||
|
||||
// 대상 문서들을 가져옴
|
||||
$oDocumentModel = &getModel('document');
|
||||
$output = $oDocumentModel->getDocumentList($args);
|
||||
$document_list = $output->data;
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
// 피드 제목 및 정보등을 추출 Context::getBrowserTitle
|
||||
if($mid) {
|
||||
$info->title = Context::getBrowserTitle();
|
||||
$oModuleController->replaceDefinedLangCode($info->title);
|
||||
|
||||
$info->title = str_replace('\'', ''',$info->title);
|
||||
if($config->feed_description) {
|
||||
$info->description = str_replace('\'', ''', htmlspecialchars($config->feed_description));
|
||||
}
|
||||
else {
|
||||
$info->description = str_replace('\'', ''', htmlspecialchars($this->module_info->description));
|
||||
}
|
||||
$info->link = getUrl('','mid',$mid);
|
||||
$info->feed_copyright = str_replace('\'', ''', htmlspecialchars($feed_config->feed_copyright));
|
||||
if(!$info->feed_copyright) {
|
||||
$info->feed_copyright = str_replace('\'', ''', htmlspecialchars($total_config->feed_copyright));
|
||||
}
|
||||
} else {
|
||||
if($total_config->feed_title) $info->title = $total_config->feed_title;
|
||||
if(!$info->title) {
|
||||
if($rss_title) $info->title = $rss_title;
|
||||
else if($total_config->feed_title) $info->title = $total_config->feed_title;
|
||||
else {
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$info->title = $site_module_info->browser_title;
|
||||
|
|
@ -117,8 +119,6 @@
|
|||
}
|
||||
|
||||
if($total_config->image) $info->image = Context::getRequestUri().str_replace('\'', ''', htmlspecialchars($total_config->image));
|
||||
$info->total_count = $output->total_count;
|
||||
$info->total_page = $output->total_page;
|
||||
switch (Context::get('format')) {
|
||||
case 'atom':
|
||||
$info->date = date('Y-m-d\TH:i:sP');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue