git-svn-id: http://xe-core.googlecode.com/svn/trunk@750 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-03-29 02:28:36 +00:00
parent 3ffcefd6fb
commit f7a361bd10
12 changed files with 65 additions and 24 deletions

View file

@ -9,5 +9,10 @@
* addOn은 화면을 출력하는 바로 단계에서 요청이 올때 작동하도록 한다. * addOn은 화면을 출력하는 바로 단계에서 요청이 올때 작동하도록 한다.
**/ **/
debugPrint(Context::get('content')); // 출력 되기 바로 직전이 아니라면 모두 무시
if($called_position != "beofre_dispay_content") return;
// 출력문서중에서 <div class="member_번호">content</div>를 찾아서 변경
$oMemberController = &getController('member');
$output = preg_replace_callback('!<div([^\>]*)member_([0-9]*)([^\>]*)>(.*?)\<\/div\>!is', array($oMemberController, 'transImageName'), $output);
?> ?>

View file

@ -10,8 +10,8 @@
* 별도의 interface가 필요한 것이 아니고 모듈의 일부라고 판단하여 코드를 작성하면 된다. * 별도의 interface가 필요한 것이 아니고 모듈의 일부라고 판단하여 코드를 작성하면 된다.
**/ **/
// addon_position이 before일때만 실행 // called_position이 before일때만 실행
if($addon_position != 'after_module_proc') return; if($called_position != 'after_module_proc') return;
// 이 애드온이 동작할 대상 (이 부분은 특별히 정해진 규약이 없다) // 이 애드온이 동작할 대상 (이 부분은 특별히 정해진 규약이 없다)
$effecived_target = array( $effecived_target = array(

View file

@ -10,8 +10,8 @@
* 별도의 interface가 필요한 것이 아니고 모듈의 일부라고 판단하여 코드를 작성하면 된다. * 별도의 interface가 필요한 것이 아니고 모듈의 일부라고 판단하여 코드를 작성하면 된다.
**/ **/
// point가 before일때만 실행 // called_position가 before일때만 실행
if($this->point != 'before_module_proc') return; if($this->called_position != 'before_module_proc') return;
// 이 애드온이 동작할 대상 (이 부분은 특별히 정해진 규약이 없다) // 이 애드온이 동작할 대상 (이 부분은 특별히 정해진 규약이 없다)
$effecived_target = array( $effecived_target = array(

View file

@ -47,6 +47,10 @@
$output = $content; $output = $content;
} }
// 애드온 실행
$called_position = 'beofre_dispay_content';
@include("./files/cache/activated_addons.cache.php");
$this->content_size = strlen($output); $this->content_size = strlen($output);
print trim($output); print trim($output);

View file

@ -51,10 +51,8 @@
if(!$document_srl) $this->document_srl = Context::get('document_srl'); if(!$document_srl) $this->document_srl = Context::get('document_srl');
else $this->document_srl = $document_srl; else $this->document_srl = $document_srl;
/** // 애드온 실행
* @brief 애드온 실행 $called_position = 'beofre_module_init';
**/
$addon_position = 'beofre_module_init';
@include("./files/cache/activated_addons.cache.php"); @include("./files/cache/activated_addons.cache.php");
} }
@ -209,12 +207,6 @@
} }
} }
/**
* @brief 애드온 실행
**/
$addon_position = 'beofre_dispay_content';
@include("./files/cache/activated_addons.cache.php");
// 컨텐츠 출력 // 컨텐츠 출력
$oDisplayHandler = new DisplayHandler(); $oDisplayHandler = new DisplayHandler();
$oDisplayHandler->printContent($oModule); $oDisplayHandler->printContent($oModule);

View file

@ -25,8 +25,6 @@
var $stop_proc = false; ///< action 수행중 stop()를 호출하면 ModuleObject::proc()를 수행하지 않음 var $stop_proc = false; ///< action 수행중 stop()를 호출하면 ModuleObject::proc()를 수행하지 않음
var $point = 'before'; ///< 애드온 호출시 모듈의 실행을 before/after로 나누고 이 시점을 기록하는 변수
/** /**
* @brief 현재 모듈의 이름을 지정 * @brief 현재 모듈의 이름을 지정
**/ **/
@ -225,15 +223,15 @@
// 기본 act조차 없으면 return // 기본 act조차 없으면 return
if(!method_exists($this, $this->act)) return false; if(!method_exists($this, $this->act)) return false;
// addon 실행(addon_position 를 before_module_proc로 하여 호출) // addon 실행(called_position 를 before_module_proc로 하여 호출)
$addon_position = 'before_module_proc'; $called_position = 'before_module_proc';
@include("./files/cache/activated_addons.cache.php"); @include("./files/cache/activated_addons.cache.php");
// this->act값으로 method 실행 // this->act값으로 method 실행
if(!$this->stop_proc) $output = call_user_method($this->act, $this); if(!$this->stop_proc) $output = call_user_method($this->act, $this);
// addon 실행(addon_position 를 after_module_proc로 하여 호출) // addon 실행(called_position 를 after_module_proc로 하여 호출)
$addon_position = 'after_module_proc'; $called_position = 'after_module_proc';
@include("./files/cache/activated_addons.cache.php"); @include("./files/cache/activated_addons.cache.php");
if(is_a($output, 'Object') || is_subclass_of($output, 'Object')) { if(is_a($output, 'Object') || is_subclass_of($output, 'Object')) {

View file

@ -177,4 +177,14 @@
debugPrint($output); debugPrint($output);
} }
/**
* @brief 주어진 숫자를 주어진 크기로 recursive하게 잘라줌
* 디렉토리 생성을 위해서 쓰임...
**/
function getNumberingPath($no, $size=3) {
$mod = pow(10,$size);
$output = sprintf('%0'.$size.'d/', $no%$mod);
if($no >= $mod) $output .= getNumberingPath((int)$no/$mod, $size);
return $output;
}
?> ?>

View file

@ -37,7 +37,7 @@
$addon = trim($addon_list[$i]); $addon = trim($addon_list[$i]);
if(!$addon) continue; if(!$addon) continue;
$buff .= sprintf(' if(file_exists("./addons/%s%s.addon.php")) include("./addons/%s/%s.addon.php"); ', $addon, $addon, $addon, $addon); $buff .= sprintf(' if(file_exists("./addons/%s/%s.addon.php")) include("./addons/%s/%s.addon.php"); ', $addon, $addon, $addon, $addon);
} }
$buff = sprintf('<?if(!__ZBXE__)exit(); %s ?>', $buff); $buff = sprintf('<?if(!__ZBXE__)exit(); %s ?>', $buff);

View file

@ -88,7 +88,7 @@
[{$val->trackback_count}] [{$val->trackback_count}]
<!--@end--> <!--@end-->
</td> </td>
<td><div class="user_{$document->member_srl}">{$val->user_name}</div></td> <td><div class="member_{$val->member_srl}"><a href="#">{$val->user_name}</a></div></td>
<td>{$val->readed_count}</td> <td>{$val->readed_count}</td>
<td>{$val->voted_count}</td> <td>{$val->voted_count}</td>
<td>{zdate($val->regdate,"Y-m-d")}</td> <td>{zdate($val->regdate,"Y-m-d")}</td>

View file

@ -27,7 +27,7 @@
</tr> </tr>
<tr> <tr>
<th>{$lang->user_name}</th> <th>{$lang->user_name}</th>
<td><div class="user_{$document->member_srl}">{$document->user_name}</div></td> <td><div class="member_{$document->member_srl}">{$document->user_name}</div></td>
</tr> </tr>
<tr> <tr>
<th>{$lang->readed_count}</th> <th>{$lang->readed_count}</th>

View file

@ -11,6 +11,10 @@
* @brief 설치시 추가 작업이 필요할시 구현 * @brief 설치시 추가 작업이 필요할시 구현
**/ **/
function moduleInstall() { function moduleInstall() {
// member 에서 사용할 cache디렉토리 생성
FileHandler::makeDir('./files/attach/image_name');
FileHandler::makeDir('./files/attach/image_mark');
// 멤버 컨트롤러 객체 생성 // 멤버 컨트롤러 객체 생성
$oMemberController = &getController('member'); $oMemberController = &getController('member');

View file

@ -648,5 +648,33 @@
return new Object(); return new Object();
} }
/**
* @brief 최종 출력물에서 이미지 이름을 변경
* imgae_name 애드온에서 요청이
**/
function transImageName($matches) {
$member_srl = $matches[2];
$text = $matches[4];
if(!$member_srl) return $matches[0];
// 전역변수에 미리 설정한 데이터가 있다면 그걸 return
if(!$GLOBALS['_transImageNameList'][$member_srl]) {
// 이미지 이름 체크
$image_name_file = sprintf('./files/attach/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl);
if(file_exists($image_name_file)) {
}
// 이미지 마크 체크 (가로 길이 20px 이내의 마크만 고려하고 직접 style로 표시를 해 준다, css를 쓸수가 없으므로)
$image_mark_file = sprintf('./files/attach/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl);
if(file_exists($image_mark_file)) {
$text = sprintf('<span style="background:url(%s) no-repeat left;padding-left:22px;">%s</span>', $image_mark_file, $text);
}
$GLOBALS['_transImageNameList'][$member_srl] = $text;
}
return $GLOBALS['_transImageNameList'][$member_srl];
}
} }
?> ?>