Using PHP/Codeigniter/HTMLPurifier/CSStidy like so:
require_once 'extra/htmlpurifier-4_4_0/library/HTMLPurifier.auto.php';
require_once 'extra/csstidy-1_3/class.csstidy.php';
$input_css = $this->input->post('input_css');
$config = HTMLPurifier_Config::createDefault();
$config->set('Filter.ExtractStyleBlocks', TRUE);
// Create a new purifier instance
$purifier = new HTMLPurifier($config);
// Wrap our CSS in style tags and pass to purifier.
// we're not actually interested in the html response though
$html = $purifier->purify('<style>'.$input_css.'</style>');
// The "style" blocks are stored seperately
$output_css = $purifier->context->get('StyleBlocks');
// Get the first style block
$unClean_css = $input_css;
$clean_css = $output_css[0];
...is there a way to turn OFF whatever it is inside HTMLPurifier or CSStidy that is causing $clean_css
to be forced into lowercase? I need the output to be left alone, in terms of case. I would just not use CSStidy but it is working great for security and compression, etc.. just is also hosing some (e.g. background-image) file paths on account of case-sensitivity. I am not able to fix the issue from the ground up (i.e. I cannot just force all lowercase)... so I ask the question the way I did. A config setting perhaps? (I hope) ...I have been looking but do not see one to do the trick yet.
Update: as nickb points out, there is a config option in CSStidy that might control this, so then the question becomes: How to set that option to FALSE in the context of HTMLpurifier?
Or is that lowercase_s
CSSTidy configuration option even the culprit? I don't know because I am so far unable to stop the lowercasing one way or another. I want for example that input like so:
.zzzzzz {
background:transparent url("images/tmpl_Btn1_CSSdemo.jpg") no-repeat right top;
}
...would NOT become (as it is doing now) :
.zzzzzz {
background:transparent url("images/tmpl_btn1_cssdemo.jpg") no-repeat right top;
}