diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index cc4cc4e9e..d40f85c47 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -32,8 +32,7 @@ // 레이아웃을 컴파일 if(__DEBUG__==3) $start = getMicroTime(); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); $layout_path = $oModule->getLayoutPath(); $layout_file = $oModule->getLayoutFile(); @@ -122,8 +121,7 @@ **/ function _toHTMLDoc(&$oModule) { // template handler 객체 생성 - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); // module tpl 변환 $template_path = $oModule->getTemplatePath(); diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 407c31932..b9d25b64c 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -15,6 +15,14 @@ var $tpl_path = ''; ///< 컴파일 대상 경로 var $tpl_file = ''; ///< 컴파일 대상 파일 + /** + * @brief TemplateHandler의 기생성된 객체를 return + **/ + function &getInstance() { + if(!$GLOBALS['__TemplateHandler__']) $GLOBALS['__TemplateHandler__'] = new TemplateHandler(); + return $GLOBALS['__TemplateHandler__']; + } + /** * @brief 주어진 tpl파일의 컴파일 **/ @@ -200,7 +208,7 @@ // include 시도 $output = sprintf( 'compile(\'%s\',\'%s\');%s'. '?>%s', "\n", diff --git a/config/config.inc.php b/config/config.inc.php index 96f5ae768..20d799079 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -50,6 +50,7 @@ require_once("./classes/module/ModuleObject.class.php"); require_once("./classes/module/ModuleHandler.class.php"); require_once("./classes/display/DisplayHandler.class.php"); + require_once("./classes/template/TemplateHandler.class.php"); if(__DEBUG__) $GLOBALS['__elapsed_class_load__'] = getMicroTime() - __ClassLosdStartTime__; /** diff --git a/modules/blog/blog.model.php b/modules/blog/blog.model.php index 415df237a..a2981e8dd 100644 --- a/modules/blog/blog.model.php +++ b/modules/blog/blog.model.php @@ -33,8 +33,9 @@ Context::set('comment_srl', $upload_target_srl); // template 가져옴 - $oTemplate = new TemplateHandler(); $template_path = sprintf("%sskins/%s/",$this->module_path, $this->skin); + + $oTemplate = &TemplateHandler::getInstance(); $tpl = $oTemplate->compile($template_path, 'comment_form'); // 결과 설정 @@ -115,8 +116,7 @@ Context::set('category_info', $category_info); // template 파일을 직접 컴파일한후 tpl변수에 담아서 return한다. - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); $tpl = $oTemplate->compile($this->module_path.'tpl', 'category_info'); // return 할 변수 설정 diff --git a/modules/editor/components/colorpicker_bg/colorpicker_bg.class.php b/modules/editor/components/colorpicker_bg/colorpicker_bg.class.php index fd7396d6a..6ebbdbbee 100644 --- a/modules/editor/components/colorpicker_bg/colorpicker_bg.class.php +++ b/modules/editor/components/colorpicker_bg/colorpicker_bg.class.php @@ -29,8 +29,7 @@ Context::set("tpl_path", $tpl_path); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/components/colorpicker_text/colorpicker_text.class.php b/modules/editor/components/colorpicker_text/colorpicker_text.class.php index bead2adcb..7ded73448 100644 --- a/modules/editor/components/colorpicker_text/colorpicker_text.class.php +++ b/modules/editor/components/colorpicker_text/colorpicker_text.class.php @@ -29,8 +29,7 @@ Context::set("tpl_path", $tpl_path); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/components/emoticon/emoticon.class.php b/modules/editor/components/emoticon/emoticon.class.php index 6414ed992..f808ac97d 100644 --- a/modules/editor/components/emoticon/emoticon.class.php +++ b/modules/editor/components/emoticon/emoticon.class.php @@ -33,8 +33,7 @@ $emoticon_list = FileHandler::readDir($tpl_path.'/images'); Context::set('emoticon_list', $emoticon_list); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/components/html_editor/html_editor.class.php b/modules/editor/components/html_editor/html_editor.class.php index 5492a719f..09b8fc9f0 100644 --- a/modules/editor/components/html_editor/html_editor.class.php +++ b/modules/editor/components/html_editor/html_editor.class.php @@ -29,8 +29,7 @@ Context::set("tpl_path", $tpl_path); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/components/image_gallery/image_gallery.class.php b/modules/editor/components/image_gallery/image_gallery.class.php index 2b72d1f29..b12e8f8b1 100644 --- a/modules/editor/components/image_gallery/image_gallery.class.php +++ b/modules/editor/components/image_gallery/image_gallery.class.php @@ -29,8 +29,7 @@ Context::set("tpl_path", $tpl_path); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } @@ -64,8 +63,7 @@ if($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html'; else $tpl_file = 'slide_gallery.html'; - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/components/image_link/image_link.class.php b/modules/editor/components/image_link/image_link.class.php index 211444b22..5b410dfeb 100644 --- a/modules/editor/components/image_link/image_link.class.php +++ b/modules/editor/components/image_link/image_link.class.php @@ -29,8 +29,7 @@ Context::set("tpl_path", $tpl_path); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/components/multimedia_link/multimedia_link.class.php b/modules/editor/components/multimedia_link/multimedia_link.class.php index 5c38b561a..7a35065f3 100644 --- a/modules/editor/components/multimedia_link/multimedia_link.class.php +++ b/modules/editor/components/multimedia_link/multimedia_link.class.php @@ -29,8 +29,7 @@ Context::set("tpl_path", $tpl_path); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/components/naver_map/naver_map.class.php b/modules/editor/components/naver_map/naver_map.class.php index a0d61bc68..5c1150839 100644 --- a/modules/editor/components/naver_map/naver_map.class.php +++ b/modules/editor/components/naver_map/naver_map.class.php @@ -34,8 +34,7 @@ Context::set("tpl_path", $tpl_path); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/components/poll_maker/poll_maker.class.php b/modules/editor/components/poll_maker/poll_maker.class.php index f6585a715..7b559fd56 100644 --- a/modules/editor/components/poll_maker/poll_maker.class.php +++ b/modules/editor/components/poll_maker/poll_maker.class.php @@ -27,8 +27,7 @@ $tpl_path = $this->component_path.'tpl'; $tpl_file = 'popup.html'; - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/components/quotation/quotation.class.php b/modules/editor/components/quotation/quotation.class.php index 5860cbd04..c93b53d76 100644 --- a/modules/editor/components/quotation/quotation.class.php +++ b/modules/editor/components/quotation/quotation.class.php @@ -29,8 +29,7 @@ Context::set("tpl_path", $tpl_path); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/components/table_maker/table_maker.class.php b/modules/editor/components/table_maker/table_maker.class.php index c8b4e9565..6b87d2758 100644 --- a/modules/editor/components/table_maker/table_maker.class.php +++ b/modules/editor/components/table_maker/table_maker.class.php @@ -29,8 +29,7 @@ Context::set("tpl_path", $tpl_path); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/components/url_link/url_link.class.php b/modules/editor/components/url_link/url_link.class.php index a41856e3f..2f8fc7211 100644 --- a/modules/editor/components/url_link/url_link.class.php +++ b/modules/editor/components/url_link/url_link.class.php @@ -27,8 +27,7 @@ $tpl_path = $this->component_path.'tpl'; $tpl_file = 'popup.html'; - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/editor/editor.model.php b/modules/editor/editor.model.php index 23782b3ae..1cf9f57bc 100644 --- a/modules/editor/editor.model.php +++ b/modules/editor/editor.model.php @@ -54,8 +54,7 @@ $oFileController = &getController('file'); $oFileController->setUploadEnable($upload_target_srl); } - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/modules/menu/menu.model.php b/modules/menu/menu.model.php index 2319a8a5f..f469745e1 100644 --- a/modules/menu/menu.model.php +++ b/modules/menu/menu.model.php @@ -114,8 +114,7 @@ Context::set('item_info', $item_info); // template 파일을 직접 컴파일한후 tpl변수에 담아서 return한다. - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); $tpl = $oTemplate->compile($this->module_path.'tpl', 'menu_item_info'); // return 할 변수 설정 diff --git a/modules/poll/poll.model.php b/modules/poll/poll.model.php index 4f985bc10..1e0f18c07 100644 --- a/modules/poll/poll.model.php +++ b/modules/poll/poll.model.php @@ -90,8 +90,7 @@ Context::set('poll_config', $poll_config); $tpl_path = sprintf("%sskins/%s/", $this->module_path, $poll_config->skin); - require_once("./classes/template/TemplateHandler.class.php"); - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/plugins/counter_status/counter_status.class.php b/plugins/counter_status/counter_status.class.php index b1148cd60..6364968cb 100644 --- a/plugins/counter_status/counter_status.class.php +++ b/plugins/counter_status/counter_status.class.php @@ -35,7 +35,7 @@ $tpl_file = 'counter_status'; // 템플릿 컴파일 - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } } diff --git a/plugins/login_info/login_info.class.php b/plugins/login_info/login_info.class.php index aa7ff612e..e0c32eab9 100644 --- a/plugins/login_info/login_info.class.php +++ b/plugins/login_info/login_info.class.php @@ -28,7 +28,7 @@ else $tpl_file = 'login_form'; // 템플릿 컴파일 - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } diff --git a/plugins/newest_document/newest_document.class.php b/plugins/newest_document/newest_document.class.php index a34bf63fc..5bcc2dba7 100644 --- a/plugins/newest_document/newest_document.class.php +++ b/plugins/newest_document/newest_document.class.php @@ -50,7 +50,7 @@ $tpl_file = 'list'; // 템플릿 컴파일 - $oTemplate = new TemplateHandler(); + $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } }