Welcome! » Log In » Create A New Profile

how to turn off cache ?

Posted by changtraingheo 
how to turn off cache ?
December 01, 2011 10:32AM

in the document about htmlpurifier had write follow:

$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.DefinitionID', 'enduser-customize.html tutorial');
$config->set('HTML.DefinitionRev', 1);
$config->set('Cache.DefinitionImpl', null); // TODO: remove this later!
$def = $config->getHTMLDefinition(true);

But when i tried it still cache, not turn off .. pls help me turn of cache in htmlpurifer

Re: how to turn off cache ?
December 05, 2011 01:36AM

Did you pass the config object to HTML Purifier to use?

Re: how to turn off cache ?
March 06, 2012 09:42AM

this is my code

<?php
if (isset($_POST[&#039;submit&#039;])) {
	require_once &#039;library/HTMLPurifier.auto.php&#039;;
	$purifier = new HTMLPurifier();
	
	$config = HTMLPurifier_Config::createDefault();
	$config->set(&#039;HTML.DefinitionID&#039;, &#039;enduser-customize.html tutorial&#039;);
	$config->set(&#039;HTML.DefinitionRev&#039;, 1);
	$config->set(&#039;Cache.DefinitionImpl&#039;, null); // TODO: remove this later!
	
	$config->set(&#039;Filter.YouTube&#039;, true);
	//$def = $config->getHTMLDefinition(true);
	
	$dirty_html = $_POST[&#039;content&#039;];
	
	$clean_html = $purifier->purify($dirty_html);
	echo $clean_html;
}
?>
<form method="post">
	<textarea rows="12" cols="20" name="content"></textarea>
	<input type="submit" name="submit" value="ok">
</form>

When i try set config $config->set('Core.DefinitionCache', null); i get Notice Notice: Core.DefinitionCache is an alias, preferred directive name is Cache.DefinitionImpl in D:\UniServer\www\vidu\purifier\library\HTMLPurifier\Config.php on line 693 .. pls help me how to disable cache

Re: how to turn off cache ?
April 10, 2012 12:36AM

You need to pass the $config object to new HTMLPurifier(); e.g. new HTMLPurifier($config);

Re: how to turn off cache ?
October 16, 2012 01:42AM

i was searching this, it does work. Thanks.

Sorry, you do not have permission to post/reply in this forum.