Welcome! » Log In » Create A New Profile

ExtractStyleBlocks doesn't work

Posted by hamdip 
ExtractStyleBlocks doesn't work
May 28, 2018 09:44AM

Hello,

First of all thank you for the tool. Really impressive and complete ;)

My concerne is about extracting or allowing style tags. If I use a standard initialisation (from documentaion) it doesn't work as it is depricated. I searched all over the forum and web and didn't find any solutions.

Here is my example code :


  require_once('HTMLPurifier/HTMLPurifier.auto.php');

  $conf = HTMLPurifier_Config::createDefault();
  $conf->set('Filter.ExtractStyleBlocks', true);  
  
  $purifier = new HTMLPurifier($conf);  
  
  $styles = $purifier->context->get('StyleBlocks');
  echo $styles; 

I get teh error Uncaught Error: Call to a member function get() on null The context has no results and is empty therefor a get() method doesn't apply on it.

Do you have any idea why it doesn't work ?

Re: ExtractStyleBlocks doesn't work
June 09, 2018 10:37PM

You've got to purify first before you can access the context parameter. Otherwise there's nothing that you have extracted.

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