diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php
index 238adcd47..f347e15cf 100644
--- a/classes/context/Context.class.php
+++ b/classes/context/Context.class.php
@@ -739,12 +739,9 @@
$editor_component = $xml_doc->attrs->editor_component;
if(!$editor_component) return $matches[0];
- // editor class 객체 생성하여 component 객체 받음
- $oEditor = &getClass('editor');
- if(!is_object($oEditor)) return $matches[0];
-
// component::transHTML() 을 이용하여 변환된 코드를 받음
- $oComponent = &$oEditor->getComponentObject($editor_component, 0);
+ $oEditorModel = &getModel('editor');
+ $oComponent = &$oEditorModel->getComponentObject($editor_component, 0);
if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $matches[0];
return $oComponent->transHTML($xml_doc);
diff --git a/modules/editor/components/naver_map/info.xml b/modules/editor/components/naver_map/info.xml
index 3363659dd..e04c991a6 100644
--- a/modules/editor/components/naver_map/info.xml
+++ b/modules/editor/components/naver_map/info.xml
@@ -6,8 +6,9 @@
네이버에서 제공하는 네이버 지도 open api를 이용하여 에디터에 원하는 곳의 지도를 추가하거나 수정할 수 있습니다.\n네이버 지도 open api키를 발급 받아서 등록을 해주셔야 정상적인 사용이 가능합니다.
-
+
네이버지도 api key
http://www.naver.com/ 에서 네이버 지도 API key를 발급 받으신 후 입력해주세요.
+
diff --git a/modules/editor/editor.class.php b/modules/editor/editor.class.php
index c68c2518e..43db2119c 100644
--- a/modules/editor/editor.class.php
+++ b/modules/editor/editor.class.php
@@ -11,6 +11,9 @@
* @brief 설치시 추가 작업이 필요할시 구현
**/
function moduleInstall() {
+ // 에디터 모듈에서 사용할 디렉토리 생성
+ FileHandler::makeDir('./files/cache/editor');
+
return new Object();
}
@@ -27,22 +30,5 @@
function moduleUpdate() {
return new Object();
}
-
- /**
- * @brief component의 객체 생성
- **/
- function getComponentObject($component, $upload_target_srl = 0) {
- // 해당 컴포넌트의 객체를 생성해서 실행
- $class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
- $class_file = sprintf('%s%s.class.php', $class_path, $component);
- if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
-
- require_once($class_file);
- $eval_str = sprintf('$oComponent = new %s("%s","%s");', $component, $upload_target_srl, $class_path);
- @eval($eval_str);
- if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
-
- return $oComponent;
- }
}
?>
diff --git a/modules/editor/editor.controller.php b/modules/editor/editor.controller.php
index 1755bd0a1..b5a6bf091 100644
--- a/modules/editor/editor.controller.php
+++ b/modules/editor/editor.controller.php
@@ -22,7 +22,8 @@
$method = Context::get('method');
if(!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
- $oComponent = &$this->getComponentObject($component);
+ $oEditorModel = &getModel('editor');
+ $oComponent = &$oEditorModel->getComponentObject($component);
if(!$oComponent->toBool()) return $oComponent;
if(!method_exists($oComponent, $method)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
diff --git a/modules/editor/editor.model.php b/modules/editor/editor.model.php
new file mode 100644
index 000000000..21dce9d5a
--- /dev/null
+++ b/modules/editor/editor.model.php
@@ -0,0 +1,87 @@
+module_path, $component);
+ $class_file = sprintf('%s%s.class.php', $class_path, $component);
+ if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
+
+ require_once($class_file);
+ $eval_str = sprintf('$oComponent = new %s("%s","%s");', $component, $upload_target_srl, $class_path);
+ @eval($eval_str);
+ if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
+
+ return $oComponent;
+ }
+
+ /**
+ * @brief component의 xml정보를 읽음
+ **/
+ function getComponentXmlInfo($component) {
+ // 요청된 컴포넌트의 xml파일 위치를 구함
+ $component_path = sprintf('%scomponents/%s/', $this->module_path, $component);
+
+ $xml_file = sprintf('%sinfo.xml', $component_path);
+ $cache_file = sprintf('./files/cache/editor/%s.php', $component);
+
+ // 캐시된 xml파일이 있으면 include 후 정보 return
+ if(file_exists($cache_file) && filectime($cache_file) > filectime($xml_file)) {
+ @include $cache_file;
+ return $xml_info;
+ }
+
+ // 캐시된 파일이 없으면 파싱후 캐싱 후 return
+ $oParser = new XmlParser();
+ $xml_doc = $oParser->loadXmlFile($xml_file);
+
+ // 정보 정리
+ $xml_info->component_name = $component;
+ $xml_info->author->name = $xml_doc->component->author->name->body;
+ $xml_info->author->email_address = $xml_doc->component->author->attrs->email_address;
+ $xml_info->author->link = $xml_doc->component->author->attrs->link;
+ $xml_info->author->date = $xml_doc->component->author->attrs->date;
+ $xml_info->description = str_replace('\n', "\n", $xml_doc->component->author->description->body);
+
+ $buff = 'component_name = "%s";', $component);
+ $buff .= sprintf('$xml_info->author->name = "%s";', $xml_info->author->name);
+ $buff .= sprintf('$xml_info->author->email_address = "%s";', $xml_info->author->email_address);
+ $buff .= sprintf('$xml_info->author->link = "%s";', $xml_info->author->link);
+ $buff .= sprintf('$xml_info->author->date = "%s";', $xml_info->author->date);
+ $buff .= sprintf('$xml_info->description = "%s";', $xml_info->description);
+
+ // 추가 변수 정리 (에디터 컴포넌트에서는 text형만 가능)
+ $extra_vars = $xml_doc->component->extra_vars->var;
+ if($extra_vars) {
+ if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
+ foreach($extra_vars as $key => $val) {
+ unset($obj);
+ $key = $val->attrs->name;
+ $title = $val->title->body;
+ $description = $val->description->body;
+ $xml_info->extra_vars->{$key}->title = $title;
+ $xml_info->extra_vars->{$key}->description = $description;
+
+ $buff .= sprintf('$xml_info->extra_vars->%s->%s = "%s";', $key, 'title', $title);
+ $buff .= sprintf('$xml_info->extra_vars->%s->%s = "%s";', $key, 'description', $description);
+ }
+ }
+
+ $buff .= ' ?>';
+
+ FileHandler::writeFile($cache_file, $buff, "w");
+
+ return $xml_doc->component;
+ }
+ }
+?>
diff --git a/modules/editor/editor.view.php b/modules/editor/editor.view.php
index 1e176cf30..1bc686dc9 100644
--- a/modules/editor/editor.view.php
+++ b/modules/editor/editor.view.php
@@ -21,6 +21,11 @@
// 컴포넌트의 종류를 구해옴
$component_list = FileHandler::readDir($this->module_path.'components');
arsort($component_list);
+
+ $oEditorModel = &getModel('editor');
+ foreach($component_list as $component) {
+ $xml_doc = $oEditorModel->getComponentXmlInfo($component);
+ }
Context::set('component_list', $component_list);
}
@@ -60,7 +65,8 @@
$component = Context::get('component');
// component 객체를 받음
- $oComponent = &$this->getComponentObject($component, $upload_target_srl);
+ $oEditorModel = &getModel('editor');
+ $oComponent = &$oEditorModel->getComponentObject($component, $upload_target_srl);
if(!$oComponent->toBool()) {
Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component));
$this->setTemplatePath($this->module_path.'tpl');