I'm trying to pass some XML tags (ABCDF>) via htmlumifier. Since the tags are not self-supported, I am trying to add an element first and then I am trying to add the elements. Although this is not working, I'm just getting blank pages, what I'm doing wrong with any idea, or if I want to do it is an easy way to get it.
$ config = HTMLPurifier_Config :: createDefault (); $ Config- & gt; Set ('core', 'encoding', 'utf-8'); $ Config- & gt; Set ('html', 'definitionID', 'pinkey-test'); $ Config- & gt; Set ('HTML', 'Definition Reeve', 3); $ Config- & gt; Set ('cache', 'definition impala', tap); // Delete it later! $ Config- & gt; Set ('cache', 'serializerpath', "/ var / cache / htmlpurify"); $ Def = $ config- & gt; Get HTML defined (true); $ Def- & gt; Adelament ("Tag 1", wrong, 'empty', 'normal', array ()); $ Def- & gt; Adelament ("Tag2", wrong, 'empty', 'normal', array ()); $ Config- & gt; Set ('html', 'approved elements', array ("tag1", "tag2")); Find out if anyone needs more details.
Note: The library is working fine without adding elements.
You should turn on error reporting; Makes God very easy!
ini_set ('display_errors' is true); Error_reporting (E_ALL & amp; ~ E_NOTICE); // If you are feeling good, then fix a bunch of errors ("After finalization the configuration can not be edited, it means that your All configurations should happen before you define the HTML; your config set format should be changed, but harmless), then you get an empty string. Then you need to make sure that your new Or in some other permissive elements, an easy way to do this is to mark the inline. I AllowedElements is the attribute you want, because it will exclude all other elements ...
< Code> & lt; php require_once 'library / HTMLPurifier.auto.php'; $ config = HTMLPurifier_Config :: createDefault ($ Config- & gt; set ('core encoding', "UTF-8"); $ config- & Set ('HTML.DefinitionID', 'Pinch-test'); $ config- & gt; set ('$ config- & gt; set (' cache. Define impulse ', blank); // remove it later Give! $ Config- & gt; Set ('cache. Student ', "/ var / cache / htmlpurify" "); $ Config- & gt; Set ('HTML.AllowedElements', array ("tag1", "tag2")); $ Def = $ config- & gt; Get HTML defined (true); $ Def- & gt; Adelament ("tag1", 'inline', 'blank', 'normal', array ()); $ Def- & gt; Adelament ("Tag2", 'inline', 'blank', 'normal', array ()); $ Cleaner = New HTML Template ($ config); Echo $ purifier-> Pure ('& lt; tag1 & gt; asf');
Comments
Post a Comment