parseTinyMCEAllowedList() public method

..
public parseTinyMCEAllowedList ( array $list ) : array
$list array String list to parse
return array
Ejemplo n.º 1
0
 /**
  * Get info message about allowed html tags
  * 
  * @return string
  **/
 public function allowed_html()
 {
     require_once APPPATH . 'libraries/htmlpurifier/HTMLPurifier.auto.php';
     $def = new HTMLPurifier_HTMLDefinition();
     list($el, $attr) = $def->parseTinyMCEAllowedList(Kohana::config('config.allowed_html', FALSE, TRUE));
     $iframes = explode('|', str_replace(array('%^http://(', ')%'), '', Kohana::config('config.safe_iframe_regexp', FALSE, TRUE)));
     $output = "";
     $output .= Kohana::lang('ui_main.allowed_tags', implode(', ', array_keys($el)));
     $output .= "<br/> ";
     $output .= Kohana::lang('ui_main.allowed_iframes', implode(', ', $iframes));
     return $output;
 }
    function test_parseTinyMCEAllowedList()
    {
        $def = new HTMLPurifier_HTMLDefinition();
        // note: this is case-sensitive, but its config schema
        // counterpart is not. This is generally a good thing for users,
        // but it's a slight internal inconsistency
        $this->assertEqual($def->parseTinyMCEAllowedList(''), array(array(), array()));
        $this->assertEqual($def->parseTinyMCEAllowedList('a,b,c'), array(array('a' => true, 'b' => true, 'c' => true), array()));
        $this->assertEqual($def->parseTinyMCEAllowedList('a[x|y|z]'), array(array('a' => true), array('a.x' => true, 'a.y' => true, 'a.z' => true)));
        $this->assertEqual($def->parseTinyMCEAllowedList('*[id]'), array(array(), array('*.id' => true)));
        $this->assertEqual($def->parseTinyMCEAllowedList('a[*]'), array(array('a' => true), array('a.*' => true)));
        $this->assertEqual($def->parseTinyMCEAllowedList('span[style],strong,a[href|title]'), array(array('span' => true, 'strong' => true, 'a' => true), array('span.style' => true, 'a.href' => true, 'a.title' => true)));
        $this->assertEqual($def->parseTinyMCEAllowedList('span[style]
strong
a[href|title]
'), $val = array(array('span' => true, 'strong' => true, 'a' => true), array('span.style' => true, 'a.href' => true, 'a.title' => true)));
        $this->assertEqual($def->parseTinyMCEAllowedList(' span [ style ], strong' . "\n\t" . 'a[href | title]'), $val);
    }