rss 출력시 이미지의 경로를 절대 경로로 바꿀 수 있도록 $oDocument->getContent()의 3번째 인자로 이미지 경로를 절대경로로 변경하는 기능 추가

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3979 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-03-19 07:19:19 +00:00
parent d79eb1c8e7
commit 852bfec728
2 changed files with 14 additions and 2 deletions

View file

@ -238,7 +238,7 @@
return htmlspecialchars($content);
}
function getContent($add_popup_menu = true, $add_content_info = true) {
function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false) {
if(!$this->document_srl) return;
if($this->isSecret() && !$this->isGranted()) return Context::getLang('msg_is_secret');
@ -274,6 +274,11 @@
$content = sprintf('<div class="xe_content">%s</div>', $content);
}
// resource_realpath가 true이면 내용내 이미지의 경로를 절대 경로로 변경
if($resource_realpath) {
$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
}
return $content;
}
@ -650,5 +655,12 @@
return $signature;
}
/**
* @brief 내용내의 이미지 경로를 절대 경로로 변경
**/
function replaceResourceRealPath($matches) {
return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
}
}
?>

View file

@ -14,7 +14,7 @@
<author><![CDATA[{$oDocument->getNickName()}]]></author>
<link><![CDATA[{$oDocument->getPermanentUrl()}]]></link>
<!--@if($mid_list[$oDocument->get('module_srl')]->open_rss=='Y')-->
<description><![CDATA[{$oDocument->getContent(false,false)}]]></description>
<description><![CDATA[{$oDocument->getContent(false,false,true)}]]></description>
<!--@else-->
<description><![CDATA[{$oDocument->getContentText(100)}]]></description>
<!--@end-->