게시글/댓글의 getContent()에 1. 팝업메뉴(이 게시글을.. 등), 2. 추가정보 (zone, 주석감싸기)에 대한 옵션을 두어서 스킨 제작시 보다 자유스러운 기능 구현할 수 있도록 하고 이를 바탕으로 게시글의 인쇄시에 제목/글쓴이/날자/본문만 나오도록 기능 추가

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3499 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-01-08 06:15:13 +00:00
parent 7d99958ff4
commit 120b53b109
4 changed files with 35 additions and 34 deletions

View file

@ -154,7 +154,7 @@
return htmlspecialchars($content);
}
function getContent($add_comment_info = true) {
function getContent($add_popup_menu = true, $add_content_info = true) {
if($this->isSecret() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
$content = $this->get('content');
@ -162,25 +162,22 @@
// url에 대해서 정규표현식으로 치환
$content = preg_replace('!([^>^"^\'^=])(http|https|ftp|mms):\/\/([^ ^<^"^\']*)!is','$1<a href="$2://$3" onclick="window.open(this.href);return false;">$2://$3</a>',' '.$content);
// 추가 정보 출력을 하지 않는 경우
if(!$add_comment_info) {
// 이 댓글을... 팝업메뉴를 출력할 경우
if($add_popup_menu) {
$content = sprintf(
'%s<div class="comment_popup_menu"><span class="comment_popup_menu comment_%d">%s</span></div>',
$content,
$this->comment_srl, Context::getLang('cmd_comment_do')
);
}
// 컨텐츠에 대한 조작이 가능한 추가 정보를 설정하였을 경우
if($add_content_info) {
$content = sprintf(
'<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->',
$this->comment_srl, $this->get('member_srl'),
$this->comment_srl, $this->get('member_srl'),
$content,
$this->comment_srl, $this->get('member_srl'),
$this->comment_srl, $this->get('member_srl')
);
// 추가 정보 출력을 하지 않는 경우 "이 댓글을.." 메뉴 추가
} else {
$content = sprintf(
'<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><div class="comment_popup_menu"><span class="comment_popup_menu comment_%d">%s</span></div><!--AfterComment(%d,%d)-->',
$this->comment_srl, $this->get('member_srl'),
$this->comment_srl, $this->get('member_srl'),
$content,
$this->comment_srl, Context::getLang('cmd_comment_do'),
$this->comment_srl, $this->get('member_srl'),
$this->comment_srl, $this->get('member_srl')
);
}