From 56cf43fd4bbad2378e63ace8facde2de91b2fbbd Mon Sep 17 00:00:00 2001 From: zero Date: Wed, 14 Mar 2007 10:33:36 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@432 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/plugin/PluginHandler.class.php | 5 ++++ classes/template/TemplateHandler.class.php | 33 ++++++++++++++++++++++ config/config.inc.php | 2 +- layouts/sample_layout/layout.html | 2 ++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/classes/plugin/PluginHandler.class.php b/classes/plugin/PluginHandler.class.php index 96a265f2c..febb668f4 100644 --- a/classes/plugin/PluginHandler.class.php +++ b/classes/plugin/PluginHandler.class.php @@ -8,6 +8,11 @@ class PluginHandler extends Object { + function executePlugin($plugin, $args) { + debugPrint($plugin); + debugPrint($args); + } + } ?> diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index a4e2c31b4..64bd07720 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -93,6 +93,9 @@ // import xml filter/ css/ js $buff = preg_replace_callback('!<\!--%import\(\"([^\"]*?)\"\)-->!is', array($this, '_compileImportCode'), $buff); + // plugin 코드 변경 + $buff = preg_replace_callback('!
!is', array($this, '_compilePluginCode'), $buff); + // 파일에 쓰기 전에 직접 호출되는 것을 방지 $buff = sprintf('%s%s%s','',"\n",$buff); @@ -269,6 +272,36 @@ return $output; } + /** + * @brief 플러그인 코드를 실제 php코드로 변경 + **/ + function _compilePluginCode($matches) { + $oXmlParser = new XmlParser(); + $xml_doc = $oXmlParser->parse($matches[0]); + $vars = $xml_doc->div->attrs; + + if(!$vars->plugin) return ""; + + // 플러그인의 이름을 구함 + $plugin = $vars->plugin; + unset($vars->plugin); + + // 플러그인의 변수들을 세팅 + $vars_count = get_object_vars($vars); + if($vars_count) { + foreach($vars as $key => $val) { + $key = str_replace('"','\"', $key); + $val = str_replace('"','\"', $val); + $args_list[] = sprintf('"%s"=>"%s"', $key, $val); + } + $args = sprintf('array(%s)', implode(',',$args_list)); + } + + // 플러그인 실행코드를 삽입 + $output = sprintf('', $plugin, $args); + return $output; + } + /** * @brief $tpl_file로 compiled_tpl_file이름을 return **/ diff --git a/config/config.inc.php b/config/config.inc.php index 13efb1db0..9954bd563 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -18,7 +18,7 @@ /** * @brief debug mode = true 일때 files/_debug_message.php 에 디버그 내용이 쌓임 **/ - define('__DEBUG__', true); + define('__DEBUG__', false); if(__DEBUG__) { // php5이상이면 error handling을 handleError() 로 set diff --git a/layouts/sample_layout/layout.html b/layouts/sample_layout/layout.html index 9f04c6d7a..085337b0d 100644 --- a/layouts/sample_layout/layout.html +++ b/layouts/sample_layout/layout.html @@ -43,6 +43,8 @@
+ +