使用PHP /笨/ HTMLPurifier/CSStidy像这样:有没有办法阻止HTMLPurifier/CSStidy强制输入CSS全部小写?
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];
...有没有办法把OFF不管它是内部HTMLPurifier或CSStidy是导致$clean_css
被迫进入小写?就案例而言,我需要将输出放在一边。我只是不会使用CSStidy,但它在安全和压缩等方面效果很好。只是因为区分大小写而搁置一些(例如背景图像)文件路径。我无法从根本上解决问题(即,我不能仅仅强制所有小写字母)......所以我按照自己的方式提出问题。配置设置也许? (我希望)...我一直在寻找,但没有看到一个人去做伎俩呢。
更新:如nickb指出的,CSStidy中有一个配置选项可能控制这个,所以问题就变成了:如何在HTMLpurifier的上下文中将该选项设置为FALSE?
或者是lowercase_s
CSSTidy配置选项连罪魁祸首?我不知道,因为我到目前为止无法以这种或那种方式阻止降级。我想要的例子,输入如下所示:
.zzzzzz {
background:transparent url("images/tmpl_Btn1_CSSdemo.jpg") no-repeat right top;
}
...将NOT成为(像现在这样):
.zzzzzz {
background:transparent url("images/tmpl_btn1_cssdemo.jpg") no-repeat right top;
}
嗯,这是愚蠢的CSS整洁的。也许我们应该改变这种默认。 –
那是哪里?正如我看,我不断收到的文档显示如何从命令行运行CSStidy ...我只需要一个在PHP运行时设置CSSTidy配置选项的例子。 – govinda
我发现这个:http://csstidy.sourceforge.net/usage.php,但它没有显示如何设置CSStidy配置。当*在HTML净化器* – govinda