mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-17 09:24:17 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@438 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
b740409012
commit
87471eb693
5 changed files with 35 additions and 5 deletions
|
|
@ -6,11 +6,35 @@
|
|||
* @todo 미구현
|
||||
**/
|
||||
|
||||
class PluginHandler extends Object {
|
||||
class PluginHandler {
|
||||
|
||||
/**
|
||||
* @brief 플러그인을 찾아서 실행하고 결과를 출력
|
||||
* <div plugin='플러그인'...></div> 태그 사용 templateHandler에서 PluginHandler::execute()를 실행하는 코드로 대체하게 된다
|
||||
**/
|
||||
function execute($plugin, $args) {
|
||||
debugPrint($plugin);
|
||||
debugPrint($args);
|
||||
|
||||
// 일단 플러그인의 위치를 찾음
|
||||
$oPluginModel = &getModel('plugin');
|
||||
$path = $oPluginModel->getPluginPath($plugin);
|
||||
|
||||
// 플러그인 클래스 파일을 찾고 없으면 에러 출력 (html output)
|
||||
$class_file = sprintf('%s%s.class.php', $path, $plugin);
|
||||
if(!file_exists($class_file)) return sprintf(Context::getLang('msg_plugin_is_not_exists'), $plugin);
|
||||
|
||||
// 플러그인 클래스를 include
|
||||
require_once($class_file);
|
||||
|
||||
// 객체 생성
|
||||
$eval_str = sprintf('$oPlugin = new %s();', $plugin);
|
||||
@eval($eval_str);
|
||||
if(!is_object($oPlugin)) return sprintf(Context::getLang('msg_plugin_object_is_null'), $plugin);
|
||||
|
||||
if(!method_exists($oPlugin, 'proc')) return sprintf(Context::getLang('msg_plugin_proc_is_null'), $plugin);
|
||||
|
||||
// 플러그인 실행
|
||||
$output = $oPlugin->proc($args);
|
||||
print $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue