!is', array($this,'transWidgetBox'), $content);
return $content;
}
/**
* @brief 위젯 코드를 실제 php코드로 변경
**/
function transWidget($matches) {
$buff = trim($matches[0]);
$oXmlParser = new XmlParser();
$xml_doc = $oXmlParser->parse(trim($buff));
if($xml_doc->img) $vars = $xml_doc->img->attrs;
else $vars = $xml_doc->attrs;
if(!$vars->widget) return "";
// 위젯의 이름을 구함
$widget = $vars->widget;
unset($vars->widget);
return WidgetHandler::execute($widget, $vars, $this->include_info);
}
/**
* @brief 위젯 박스를 실제 php코드로 변경
**/
function transWidgetBox($matches) {
$buff = preg_replace('/
$/i','
',$matches[0]);
$oXmlParser = new XmlParser();
$xml_doc = $oXmlParser->parse($buff);
$vars = $xml_doc->div->attrs;
$widget = $vars->widget;
unset($vars->widget);
// 위젯의 이름을 구함
if(!$widget) return $matches[0];
return WidgetHandler::execute($widget, $vars, $this->include_info);
}
/**
* @brief 특정 content내의 위젯을 다시 생성
**/
function recompileWidget($content) {
// 언어 종류 가져옴
$lang_list = Context::get('lang_supported');
// 위젯 캐시 sequence 를 가져옴
preg_match_all('!
![]()
]*)widget=([^\>]*?)\>!is', $content, $matches);
$cache_path = './files/cache/widget_cache/';
$oWidget = new WidgetHandler();
$oXmlParser = new XmlParser();
$cnt = count($matches[1]);
for($i=0;$i<$cnt;$i++) {
$buff = $matches[0][$i];
$xml_doc = $oXmlParser->parse(trim($buff));
$args = $xml_doc->img->attrs;
if(!$args) continue;
// 캐싱하지 않을 경우 패스
$widget = $args->widget;
$sequence = $args->widget_sequence;
$cache = $args->widget_cache;
if(!$sequence || !$cache) continue;
if(count($args)) {
foreach($args as $k => $v) $args->{$k} = urldecode($v);
}
// 언어별로 위젯 캐시 파일이 있을 경우 재생성
foreach($lang_list as $lang_type => $val) {
$cache_file = sprintf('%s%d.%s.cache', $cache_path, $sequence, $lang_type);
if(!file_exists($cache_file)) continue;
$oWidget->getCache($widget, $args, $lang_type, true);
}
}
}
}
?>