https://xetown.com/alley/23782

 

전에 xetown에 figure 태그가 왜 사용이 안되는건지 의아했는데 이제보니 XE에서 사용중인 HTMLPurifier가 HTML5 태그를 기본값으로 지원하지 않고 있더군요. 브라우저 대부분이 HTML5 태그를 허용하고 있는 지금에는 사용자도 글 작성시 HTML5 태그를 사용할 필요가 있겠습니다.

 

현재로써는 아래의 위치에 값을 추가해줌으로써 HTML5 태그를 사용할 수 있게 됩니다.

 

./classes/security/Purifier.class.php

    private function _setDefinition(&$content)
    {
        // add attribute for edit component
        $editComponentAttrs = $this->_searchEditComponent($content);
        if(is_array($editComponentAttrs))
        {
            foreach($editComponentAttrs AS $k => $v)
            {
                $this->_def->addAttribute('img', $v, 'CDATA');
                $this->_def->addAttribute('div', $v, 'CDATA');
            }
        }

        // add attribute for widget component
        $widgetAttrs = $this->_searchWidget($content);
        if(is_array($widgetAttrs))
        {
            foreach($widgetAttrs AS $k => $v)
            {
                $this->_def->addAttribute('img', $v, 'CDATA');
            }
        }

        // http://developers.whatwg.org/sections.html
        $this->_def->addElement('section', 'Block', 'Flow', 'Common');
        $this->_def->addElement('nav',     'Block', 'Flow', 'Common');
        $this->_def->addElement('article', 'Block', 'Flow', 'Common');
        $this->_def->addElement('aside',   'Block', 'Flow', 'Common');
        $this->_def->addElement('header',  'Block', 'Flow', 'Common');
        $this->_def->addElement('footer',  'Block', 'Flow', 'Common');
    
        // Content model actually excludes several tags, not modelled here
        $this->_def->addElement('address', 'Block', 'Flow', 'Common');
        $this->_def->addElement('hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common');
    
        // http://developers.whatwg.org/grouping-content.html
        $this->_def->addElement('figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common');
        $this->_def->addElement('figcaption', 'Inline', 'Flow', 'Common');
    
        // http://developers.whatwg.org/the-video-element.html#the-video-element
        $this->_def->addElement('video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', array(
          'src' => 'URI',
          'type' => 'Text',
          'width' => 'Length',
          'height' => 'Length',
          'poster' => 'URI',
          'preload' => 'Enum#auto,metadata,none',
          'controls' => 'Bool',
        ));
        $this->_def->addElement('source', 'Block', 'Flow', 'Common', array(
          'src' => 'URI',
          'type' => 'Text',
        ));
    
        // http://developers.whatwg.org/text-level-semantics.html
        $this->_def->addElement('s',    'Inline', 'Inline', 'Common');
        $this->_def->addElement('var',  'Inline', 'Inline', 'Common');
        $this->_def->addElement('sub',  'Inline', 'Inline', 'Common');
        $this->_def->addElement('sup',  'Inline', 'Inline', 'Common');
        $this->_def->addElement('mark', 'Inline', 'Inline', 'Common');
        $this->_def->addElement('wbr',  'Inline', 'Empty', 'Core');
    
        // http://developers.whatwg.org/edits.html
        $this->_def->addElement('ins', 'Block', 'Flow', 'Common', array('cite' => 'URI', 'datetime' => 'CDATA'));
        $this->_def->addElement('del', 'Block', 'Flow', 'Common', array('cite' => 'URI', 'datetime' => 'CDATA'));
    
        // TinyMCE
        $this->_def->addAttribute('img', 'data-mce-src', 'Text');
        $this->_def->addAttribute('img', 'data-mce-json', 'Text');
    
        // Others
        $this->_def->addAttribute('iframe', 'allowfullscreen', 'Bool'); //<-이건 없는게 낫겠네요.
        $this->_def->addAttribute('table', 'height', 'Text');
        $this->_def->addAttribute('td', 'border', 'Text');
        $this->_def->addAttribute('th', 'border', 'Text');
        $this->_def->addAttribute('tr', 'width', 'Text');
        $this->_def->addAttribute('tr', 'height', 'Text');
        $this->_def->addAttribute('tr', 'border', 'Text');
    }

http://htmlpurifier.org/phorum/read.php?2,7417,7417

 

이 문제는 개선사항으로써 깃허브에 잇슈를 등록해뒀습니다.

https://github.com/xpressengine/xe-core/issues/1804

 

TAG •
  • profile
    html5도 제대로 지원하지 않다니...ㅠㅠ