테스트 사이트 - 개발 중인 베타 버전입니다

게시글 내 usemap 사용하려면... commlib 수정이 필요하네요 채택완료

더블피디 6년 전 조회 1,800

https://sir.kr/g5_tip/3099">https://sir.kr/g5_tip/3099 참고해서 수정을 했습니다. 

 

img  태그에 usemap 저장이 됩니다.

 

이상하게 

map 태그 설정 시  name값은 저장되는데, id값 저장이 안되네요

</map>이 자꾸 생기네요

 

왜그럴까요??

 

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트

자동으로 </map>으로 닫히는거고 소스코드 한번 올려보세요!

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

더블피디
6년 전
/lib/common.lib.php

html_purifier 함수에 추가

$config->set('Attr.AllowedFrameTargets', array('_blank'));
//유튜브, 비메오 전체화면 가능하게 하기
$config->set('Filter.Custom', array(new HTMLPurifier_Filter_Iframevideo()));


==> 여기부터 추가

$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);

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인