그누보드5 이미지맵 오류 질문입니다
본문
전체 게시물을 다 뒤져봤습니다.
http://sir.co.kr/g5_tip/3099에 있는데로 하면 된다고 해서 수정했고,
클릭은 되는데 이동을 안하더군요
common.lib에 있는 html_purifier에
function html_purifier($html)
{
$f = file(G5_PLUGIN_PATH.'/htmlpurifier/safeiframe.txt');
$domains = array();
foreach($f as $domain){
// 첫행이 # 이면 주석 처리
if (!preg_match("/^#/", $domain)) {
$domain = trim($domain);
if ($domain)
array_push($domains, $domain);
}
}
// 내 도메인도 추가
array_push($domains, $_SERVER['HTTP_HOST'].'/');
$safeiframe = implode('|', $domains);
include_once(G5_PLUGIN_PATH.'/htmlpurifier/HTMLPurifier.standalone.php');
$config = HTMLPurifier_Config::createDefault();
// data/cache 디렉토리에 CSS, HTML, URI 디렉토리 등을 만든다.
$config->set('Cache.SerializerPath', G5_DATA_PATH.'/cache');
$config->set('HTML.SafeEmbed', false);
$config->set('HTML.SafeObject', false);
$config->set('Output.FlashCompat', false);
$config->set('HTML.SafeIframe', true);
$config->set('URI.SafeIframeRegexp','%^(https?:)?//('.$safeiframe.')%');
$config->set('Attr.AllowedFrameTargets', array('_blank'));
$purifier = new HTMLPurifier($config);
return $purifier->purify($html);
}
여기에서
$config->set('Attr.AllowedFrameTargets', array('_blank'));
밑에 소스를 추가하여 결과적으로 아래와 같이 수정하였습니다.
// http://htmlpurifier.org/
// Standards-Compliant HTML Filtering
// Safe : HTML Purifier defeats XSS with an audited whitelist
// Clean : HTML Purifier ensures standards-compliant output
// Open : HTML Purifier is open-source and highly customizable
function html_purifier($html)
{
$f = file(G5_PLUGIN_PATH.'/htmlpurifier/safeiframe.txt');
$domains = array();
foreach($f as $domain){
// 첫행이 # 이면 주석 처리
if (!preg_match("/^#/", $domain)) {
$domain = trim($domain);
if ($domain)
array_push($domains, $domain);
}
}
// 내 도메인도 추가
array_push($domains, $_SERVER['HTTP_HOST'].'/');
$safeiframe = implode('|', $domains);
include_once(G5_PLUGIN_PATH.'/htmlpurifier/HTMLPurifier.standalone.php');
$config = HTMLPurifier_Config::createDefault();
// data/cache 디렉토리에 CSS, HTML, URI 디렉토리 등을 만든다.
$config->set('Cache.SerializerPath', G5_DATA_PATH.'/cache');
$config->set('HTML.SafeEmbed', false);
$config->set('HTML.SafeObject', false);
$config->set('Output.FlashCompat', false);
$config->set('HTML.SafeIframe', true);
$config->set('URI.SafeIframeRegexp','%^(https?:)?//('.$safeiframe.')%');
$config->set('Attr.AllowedFrameTargets', array('_blank'));
//소스 추가 시작
$def = $config->getHTMLDefinition(true);
// Add usemap attribute to img tag
$def->addAttribute('img', 'usemap', 'CDATA');
// Add map tag
$map = $def->addElement(
'map', // name
'Block', // content set
'Flow', // allowed children
'Common', // attribute collection
array(// attributes
'name' => 'CDATA',
'id' => 'ID',
'title' => 'CDATA',
)
);
$map->excludes = array('map' => true);
// Add area tag
$area = $def->addElement(
'area', // name
'Block', // content set
'Empty', // don't allow children
'Common', // attribute collection
array(// attributes
'name' => 'CDATA',
'id' => 'ID',
'alt' => 'Text',
'coords' => 'CDATA',
'accesskey' => 'Character',
'nohref' => new HTMLPurifier_AttrDef_Enum(array('nohref')),
'href' => 'URI',
'shape' => new HTMLPurifier_AttrDef_Enum(array('rect', 'circle', 'poly', 'default')),
'tabindex' => 'Number',
'target' => new HTMLPurifier_AttrDef_Enum(array('_blank', '_self', '_target', '_top'))
)
);
$area->excludes = array('area' => true);
//소스 추가 종료
$purifier = new HTMLPurifier($config);
return $purifier->purify($html);
}
클릭은 됩니다.
주소창에 해당 id값이 주소 url 맨 뒤에 #으로 붙더군요.
#hd 와 같이 상단 올라가는 버튼처럼 url에 추가되는건 확인을 했는데 이동을 하지 않습니다.
이럴 경우 어떻게 해결하면 되겠는지요.
*아참... 그누보드가 5.2.2 버전입니다
!-->!-->