Is there any way to turn htmlpurifier off?

Zoltan

Member
I would like to send out the code what I write (exactly), but htmlpurifier just makes the newsletter sending sometimes a pain.
I know why is there, but I would like to turn it off.

Please help me with this.

Thank you
 
Html purifier doesn't only do cleaning, it also makes sure the template is properly formatted so that when parsed by the dom document library it can actually be parsed, so disabling it is really not an option. Browers can output whatever you throw at them, but parsers can choke if not proper formatting.
Try
PHP:
<?php if ( ! defined('YII_PATH')) exit('No direct script access allowed');

return array(

    // core related
    'Core.Encoding'             => Yii::app()->charset,
    'Core.EscapeInvalidTags'    => false,

    // uri related
    'URI.Base'              => null,
    'URI.AllowedSchemes'    => array(
        'http'      => true,
        'https'     => true,
        'mailto'    => true,
        'ftp'       => true,
        'ftps'      => true,
        'nntp'      => true,
        'news'      => true,
        'tel'       => true,
        'callto'    => true,
        'data'      => true,
        '['         => true, // pretty weird this works...
    ),
    'URI.SafeIframeRegexp' => '%^(http:|https:)?//(www.youtube(?:-nocookie)?.com/embed/|player.vimeo.com/video/)%',

    // html related
    'HTML.Trusted'         => true, // keep en eye on this
    'HTML.SafeIframe'      => true,
    'HTML.MaxImgLength'    => null,
    'HTML.DefinitionID'    => 'html-definitions',
    'HTML.DefinitionRev'   => 8, // increment this when the init class is changed

    // attributes
    'Attr.EnableID'             => true,
    'Attr.AllowedRel'           => array('noindex', 'nofollow'),
    'Attr.AllowedFrameTargets'  => array('_blank', '_self', '_parent', '_top'),

    // css
    'CSS.AllowTricky'      => true,
    'CSS.AllowImportant'   => true,
    'CSS.Proprietary'      => true,
    'CSS.Trusted'          => true, // keep en eye on this
    'CSS.MaxImgLength'     => null,
);
in apps/common/config/htmlpurifier.php
 
HI!
Is there any other steps I need to do? I changed the settings, even cleared the cache in runtime (I am not sure it was necessary), but it does not seems to be working. When I write the code, test it in Litmus and everything looks good, I want to use this code in MailWizz but it changes the code so I can not use it anymore.
 
Hello
I'm working with mjml (http://mjml.io) to produce my newletters also it provides responsive and compliant templates for all clients.
I prepared the template and sent it through MW and next through a basic bash script. In the case of MW I have some issues as example the template have this kind of sfuff :
<style type="text/css">
@media only screen and (min-width:480px) {
.mj-column-per-100, * [aria-labelledby="mj-column-per-100"] { width:100%!important; }
.mj-column-per-30, * [aria-labelledby="mj-column-per-30"] { width:30%!important; }
.mj-column-per-33, * [aria-labelledby="mj-column-per-33"] { width:33%!important; }
.mj-column-per-70, * [aria-labelledby="mj-column-per-70"] { width:70%!important; }
.mj-column-per-45, * [aria-labelledby="mj-column-per-45"] { width:45%!important; }
.mj-column-per-55, * [aria-labelledby="mj-column-per-55"] { width:55%!important; }
.mj-column-px-240, * [aria-labelledby="mj-column-px-240"] { width:240px!important; }
.mj-column-px-360, * [aria-labelledby="mj-column-px-360"] { width:360px!important; }
}
</style>
and next this :
<div aria-labelledby="mj-column-per-100" class="mj-column-per-100".....

As the code was cleaned by htmlpufifier before be sent , these lines were broken.
I made a basic change :
in apps/common/components/utils/EmailTemplateParser.php
public function getContent()
{
return $this->_content;
....
}

Also could you add a simple checkbox or something to do the same ?
Thanks
 
Hello
I'm working with mjml (http://mjml.io) to produce my newletters also it provides responsive and compliant templates for all clients.
I prepared the template and sent it through MW and next through a basic bash script. In the case of MW I have some issues as example the template have this kind of sfuff :
<style type="text/css">
@media only screen and (min-width:480px) {
.mj-column-per-100, * [aria-labelledby="mj-column-per-100"] { width:100%!important; }
.mj-column-per-30, * [aria-labelledby="mj-column-per-30"] { width:30%!important; }
.mj-column-per-33, * [aria-labelledby="mj-column-per-33"] { width:33%!important; }
.mj-column-per-70, * [aria-labelledby="mj-column-per-70"] { width:70%!important; }
.mj-column-per-45, * [aria-labelledby="mj-column-per-45"] { width:45%!important; }
.mj-column-per-55, * [aria-labelledby="mj-column-per-55"] { width:55%!important; }
.mj-column-px-240, * [aria-labelledby="mj-column-px-240"] { width:240px!important; }
.mj-column-px-360, * [aria-labelledby="mj-column-px-360"] { width:360px!important; }
}
</style>
and next this :
<div aria-labelledby="mj-column-per-100" class="mj-column-per-100".....

As the code was cleaned by htmlpufifier before be sent , these lines were broken.
I made a basic change :
in apps/common/components/utils/EmailTemplateParser.php
public function getContent()
{
return $this->_content;
....
}

Also could you add a simple checkbox or something to do the same ?
Thanks

As far as mjml goes, you can use that for dev, but then switch to html, so that you get standards' compliant output to save and use.
Otherwise most renderers do not 'know' what to do with mjml statements (e.g. 'mj-column-px').
 
Hello,
Actually I done this for gmail because it knows how to deal with
.mj-column-px-360, * [aria-labelledby="mj-column-px-360"] { width:360px!important; }
With mjml I can pass all the litmus renderers.
 
Hello,
Actually I done this for gmail because it knows how to deal with
.mj-column-px-360, * [aria-labelledby="mj-column-px-360"] { width:360px!important; }
With mjml I can pass all the litmus renderers.

maybe because some renderers are smart enough to ignore the mj (MailJet) stuff and render by using (what is above at the end of the line)
"{ width:360px!important; }"
;)
 
With gmail :
this works
<div aria-labelledby="mj-column-per-45" class="mj-column-per-45".....
this does not
<div class="mj-column-per-45"......
It displays the mobile version instead of the desktop version (please note the @media only screen and (min-width:480px) on front)
 
When there are style elements with quotes, HTMLPurifier converts them to &quot;

This code:
Code:
<div class="box-header" style="background:url('http://htmlpurifier.org/art/bglogo.png');">
<h3 class="box-title">[LIST_NAME]</h3>
</div>

is converted to:
Code:
<div class="box-header" style="background:url(&quot;http://htmlpurifier.org/art/bglogo.png&quot;);">
<h3 class="box-title">[LIST_NAME]</h3>
</div>

It's considered to be Ok.

But then when I click on "Preview it now!"
&quot; is converted to " breaking the attribute.
<div class="box-header" style="background:url("http://htmlpurifier.org/art/bglogo.png");">

Here is the demo page with the code:
http://htmlpurifier.org/demo.php?fi....org/art/bglogo.png)">Foo</div>&submit=Submit
 
Back
Top