Welcome! » Log In » Create A New Profile

inline styles

Posted by Zrg 
Zrg
inline styles
June 27, 2009 10:13AM

Hello,

i'm using tinyMCE and users are copiing texts from Word, but this results in style definitions inside the text (i'm not talking about css attributes, but about inline style definitions: <style>).

so my question: how can i set up htmlpurifier to allow these inline styles? the default config gets rid of these ones, but this isn't my intention!

thanks in advance, Zrg

Re: inline styles
June 27, 2009 03:21PM
Zrg
Re: inline styles
June 28, 2009 12:18PM

is this the only way? i don't have csstidy.

i did something like this for the moment, but i'm not sure, how good is:

  $config = HTMLPurifier_Config::createDefault();
  $config->set(&#039;Core&#039;, &#039;Encoding&#039;, &#039;UTF-8&#039;);
  $config->set(&#039;HTML&#039;, &#039;Doctype&#039;, &#039;XHTML 1.0 Transitional&#039;);

  $config->set(&#039;HTML&#039;, &#039;DefinitionID&#039;, &#039;enduser-customize.html tutorial&#039;);
  
  $config->set(&#039;Core&#039;, &#039;HiddenElements&#039;, array(&#039;style&#039; => true, &#039;script&#039; => true));
  
  $def = $config->getHTMLDefinition(true);
  $style = $def->addElement(
    &#039;style&#039;,    // name
    &#039;Block&#039;,    // content set
    &#039;Flow&#039;,     // allowed children
    &#039;Common&#039;,    // attribute collection
    array()
  );

  $purifier = new HTMLPurifier($config);
  
  $clean_html = $purifier->purify($dirty_html);
  echo $clean_html;
Re: inline styles
June 28, 2009 01:25PM

That, um, opens the sky and seas to XSS attacks. Please please please don't do it. CSSTidy is open source. Go download it!

Re: inline styles
April 06, 2011 09:20AM

Using border in inline style sheets in css? "Use an inline style to add a 2-pixel solid yellow border to the bottom of the second paragraph. Change the bottom padding of the paragraph to 10 pixels."

I know how to use borders, but i don't understand how to use them in an inline style. It's supposed to be just a straight yellow line, any help?

Re: inline styles
April 06, 2011 09:27AM

&lt;![CDATA[&lt;span style=&quot;border-bottom: 2px solid yellow;&quot;&gt;]]&gt;

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