git-svn-id: http://xe-core.googlecode.com/svn/trunk@722 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-03-27 10:16:27 +00:00
parent ef1f759a87
commit 328e37d822
3 changed files with 42 additions and 7 deletions

View file

@ -705,7 +705,7 @@
* @brief 내용의 플러그인이나 기타 기능에 대한 code를 실제 code로 변경
**/
function transContent($content) {
// 플러그인 변경
// 플러그인 코드 변경
$content = preg_replace_callback('!<img([^\>]*)plugin=([^\>]*?)\>!is', array($this,'_transPlugin'), $content);
// 에디터 컴포넌트를 찾아서 결과 코드로 변환
@ -755,8 +755,29 @@
**/
function _transPlugin($matches) {
$oXmlParser = new XmlParser();
$xml_doc = $oXmlParser->parse($matches[0]);
$vars = $xml_doc->attrs;
$xml_doc = $oXmlParser->parse(trim($matches[0]));
if($xml_doc->img) $vars = $xml_doc->img->attrs;
else $vars = $xml_doc->attrs;
if(!$vars->plugin) return "";
// 플러그인의 이름을 구함
$plugin = $vars->plugin;
unset($vars->plugin);
return PluginHandler::execute($plugin, $vars);
}
/**
* @biref 플러그인 코드를 실제 코드로 변경 (레이아웃용)
**/
function transPluginCode($matches) {
$oXmlParser = new XmlParser();
$xml_doc = $oXmlParser->parse(trim($matches[0]));
if($xml_doc->img) $vars = $xml_doc->img->attrs;
else $vars = $xml_doc->attrs;
if(!$vars->plugin) return "";
@ -765,13 +786,18 @@
unset($vars->plugin);
// className, style attribute를 구해 놓음
$className = $vars->class;
$style = $vars->style;
unset($vars->module_srl);
unset($vars->src);
return PluginHandler::execute($plugin, $vars);
}
// 코드 생성
$buff = "";
foreach($vars as $key => $val) {
$buff .= sprintf('$%s->%s = "%s";', $plugin, $key, $val);
}
$code = sprintf('<?php %s print PluginHandler::execute("%s", $%s); ?>', $buff, $plugin, $plugin);
return $code;
}
}
?>