* @brief CCL 출력 에디터 컴포넌트 **/ class cc_license extends EditorHandler { // editor_sequence 는 에디터에서 필수로 달고 다녀야 함 var $editor_sequence = 0; var $component_path = ''; /** * @brief editor_sequence과 컴포넌트의 경로를 받음 **/ function cc_license($editor_sequence, $component_path) { $this->editor_sequence = $editor_sequence; $this->component_path = $component_path; } /** * @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다 **/ function getPopupContent() { // 템플릿을 미리 컴파일해서 컴파일된 소스를 return $tpl_path = $this->component_path.'tpl'; $tpl_file = 'popup.html'; Context::set("tpl_path", $tpl_path); $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); } /** * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method * * 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서 * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경 **/ function transHTML($xml_obj) { // 지정된 옵션을 구함 $ccl_title = $xml_obj->attrs->ccl_title; $ccl_use_mark = $xml_obj->attrs->ccl_use_mark; $ccl_allow_commercial = $xml_obj->attrs->ccl_allow_commercial; $ccl_allow_modification = $xml_obj->attrs->ccl_allow_modification; // 가로/ 세로 크기를 구함 preg_match_all('/(width|height)([^[:digit:]]+)([^;^"^\']*)/i',$xml_obj->attrs->style,$matches); $width = trim($matches[3][0]); if(!$width) $width = "90%"; $height = trim($matches[3][1]); if(!$height) $height = "50"; // 언어파일을 읽음 Context::loadLang($this->component_path.'/lang'); $default_title = Context::getLang('ccl_default_title'); if(!$ccl_title) $ccl_title = $default_title; $default_message = Context::getLang('ccl_default_message'); $option = Context::getLang('ccl_options'); // 영리 이용 체크 if($ccl_allow_commercial == 'N') $opt1 = '-nc'; else $opt1 = ''; // 수정 표시 체크 if($ccl_allow_modification == 'N') $opt2 = '-nd'; elseif($ccl_allow_modification == 'SA') $opt2 = '-sa'; else $opt2 = ''; // 버전 $version = '/3.0'; // 언어에 따른 설정 $lang_type = Context::getLangType(); if($lang_type != 'en') $lang_file = 'deed.'.strtolower($lang_file); // 마크 이용시 $ccl_image = ''; if($ccl_use_mark == "Y") { $ccl_image = sprintf(' Creative Commons License
', $opt1, $opt2, $version, $opt1, $opt2, $version ); } // 결과물 생성 $text = $ccl_image . sprintf($default_message, $opt1, $opt2, $version, '', $ccl_title, $option['ccl_allow_commercial'][$ccl_allow_commercial], $option['ccl_allow_modification'][$ccl_allow_modification], $version); $style = sprintf('', $width); $output = sprintf('%s
%s%s
', $style, $ccl_title, $text); return $output; } } ?>