HTMLPurifier 4.4.0
/home/ezyang/Dev/htmlpurifier/test2.php
Go to the documentation of this file.
00001 <?php
00002 require_once 'library/HTMLPurifier.auto.php';
00003 $config = HTMLPurifier_Config::createDefault();
00004 $config->set('Core.Encoding', "UTF-8");
00005 $config->set('HTML.DefinitionID', 'pinaki-test');
00006 $config->set('HTML.DefinitionRev', 3);
00007 $config->set('Cache.DefinitionImpl', null); // remove this later!
00008 $config->set('Cache.SerializerPath', "/var/cache/htmlpurify");
00009 $config->set('HTML.AllowedElements', array("tag1", "tag2"));
00010 $def = $config->getHTMLDefinition(true);
00011 $def->addElement("tag1", 'Inline', 'Empty', 'Common', array());
00012 $def->addElement("tag2", 'Inline', 'Empty', 'Common', array());
00013 $purifier = new HTMLPurifier($config);
00014 echo $purifier->purify('<tag1>asf');