Html Purifier | CSS Tidy | Browser specific properties and hacks are trimmed. How do I allow those? - htmlpurifier

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e7e7e7');
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#e7e7e7));
These kinds of css properties are removed when filtering input. I'm not sure if this is due to CSSTidy or HTML Purifier. I've tried to look in both of the manuals without finding any clues.

HTML Purifier will strip out these properties, definitely. CSS Tidy probably will too (though I'm not sure.) You'll need to create custom validation AttrDefs for each of them.

I just went through this. In case it is confusing, Edward is referring to this:
http://htmlpurifier.org/phorum/read.php?2,6154,6154#msg-6154

Related

Correct way to get access to Dnn Stuff while using Modern 2sxc Hybrid Views

Now that my new views start with
#inherits Custom.Hybrid.Razor12
What do I need to do to continue to get access to Dnn Stuff when needed? I've been bouncing around the docs, but haven't spotted anything yet.
Are there compile codes that will let us do things like <### IF DNN ###>?
My specific need right now, and I am hoping someone can offer an example, is we always wrapped our module/View output like this
<div id="viewtype-#(Dnn.Module.ModuleID)">
</div>
And this allowed us to include some very module-targeted (non-leaky) CSS.
<style>
#viewtype-#(Dnn.Module.ModuleID) .navbar{
...
}
</style>
So then this sort of becomes two questions:
How do you do DNN specific things in a View properly?
What is the new-correct way to do the thing in the example above so that it would ALSO work on Oqtane? Do they have a Helper that would provide a unique ID at the same level as the View?
When you are editing a template, there is a menu at the left of the edit window. If you expand the <> you will see all sorts of helpers, DNN and otherwise.
And, the top icon expands to a list of all of the files/views/css that you might want to edit.
Or am I misunderstanding?
Oh, you don't have to do any of the <## xxxx ##> stuff any more. You can just refer to the DNN variables and methode (perhaps preceded by #) and just use them. After all, the template is a mixture of HTML and Razor stuff. The Razor stuff is darned close to c#.
So, you could drop something in like:
[p]
This is an example of using the portal id: #Dnn.Module.PortalID
[/p]
Note: < and > replaced by [ and ] so that they aren't interpreted as tags.

Can we put underline in single line text field of contentful?

I added one field which is of type text as single line. Now I need to make some
of the text as underline.for example:-
He is a good employee.
I want underline in employee text. How can I add that in contentful?
👋🏻
When you're using the Markdown editor the problem the problem is not with Contentful but rather the markdown specs themselves. They do not provide the "underline" functionality.
The question about underline is a common question. The idea of markdown is to only care about content and not really the representation (e.g. "bold" translates to the html strong element which stands syntactically for important parts) though.
IMO underlined text can also be confused with links too easily.
If you have to make this work you can either bring in inline HTML (has the downside that you'll loose cross-platform compatibility because not every system can deal with HTML) or you handle the underline functionality in your application consuming Contentful with some CSS for example.
E.g. assuming that you want to highlight something in your application/website I could see that the "bold"/"strong" meaning could work for you.
Overall rule of thumb with markdown is thinking of the document structure and content rather then it's appearance. "These are important words in this paragraph" (👍) vs. "These are words that should be underlined" (👎).
In Contentful write the text under Markdown as:-
He is a good <u>employee</u>
Now in our reactjs application we can write:-
dangerouslySetInnerHTML={{
__html: employee.childMarkdownRemark.html,
}}
Hence if we render the output in the childMardownRemark.html under dangerouslySetInnerHTML then employee will come as underline in our UI.

Remove links using HTML purifirer

we have different type of users on our site. For a particular type of users, we do not want to show URLs(links) posted by them. We want to remove them altogether.
How can I achieve this through HTML purifier config?
The most robust way to do this is to set %URI.Disable to true.

How to theme a menu block in Drupal?

This should really be a basic question but I simply don't get it after hours of searching. The question is, how do I theme menu blocks in Drupal 7?
I've created three different blocks all based on the main menu. Now I want to:
create unique HTML for all three blocks, that means modifing the surrounding wrapper and the <ul> and <li> that builds the menu. I wanna set special classes and remove all of the Drupal-added stuff
attach different classes to the different levels within each block. One of blocks will show two levels of the menu, i.e. it will display a submenu. I want to set a special class on the for the submenu...
This seems impossible... :(
Thank you in advance for the help!!!!
Theming is a tricky beast that often varies a lot depending what you need to do. Even with your very detailed description I can still say "it depends", but here are a couple steps that may help you get pointed in the right direction.
Step 1: Use a block tpl.php as suggested by Caffeine Addict. If you're not sure what to name the .tpl.php, I recommend the Theme Developer module. It's buggy, but you can use it to select an particular element and have it tell you suggestions for naming of .tpl.php files.
Step 2: Use a theme / preprocess function in template.php to modify the pre-defined variables and markup. Be sure to check on the theme_menu_tree & template_preprocess_menu_tree functions on api.drupal.org for starting points. If you're using the devel module, use dpm($variables); in each of those to see what you have to work with from the start.
I hope that helps! I agree with Caffeine Addict when he says that superfish might be an alternative. You should also probably check out the menu block module for breaking out conditional sub-sections into their own blocks.
In addition to what davidneedham said, to change what Drupal added to your menu HTML tags, you can override them. Here it is added classes:
<ul class="expanded">
<li class="firstleaf">...<li>
...
</ul>
i did not find a way to remove this classes, but you can override them in your block--system--main_menu.tpl.php file, like this:
li.expanded,
li.collapsed,
li.leaf {
padding: 0 0 0 0;
margin: 0;
}
ul.menu li {
margin: 0 0 0 0;
}
and then print your menu content:
<?php echo $content; ?>
I'm new in Drupal, wish my post can help you! :)
I would suggest to start with installing the Zen theme and follow the instructions inside the theme to setup a starter sub theme. This has all the information needed to learn theming in drupal and even how to add your own stylesheets etc.
This will allow you to start editing the templates for menu blocks and set your own html wrappers and classes.
For setting extra classes on blocks i would use this module:
http://drupal.org/project/block_class
Then just edit the block and you will see an extra section for adding additional classes to the block.

HTMLPurifier: how to escape broken tags instead of removing?

I am using HTMLPurifier for cleaning the post input but I'd like it to escape (html encode) all broken tags or suspicious symbols instead of removing them completely. I have searched through it's docs and this site but without any luck. Still hope that I have missed something.
Opening tag is the most irritating. If someone tries to post a formula or comparison, writes "param1<param2" and does not put space in between, the purifier gets it as a wrong tag opening and completely discards everything on the right side.
I am using htmlspecialchars inside [code] tags, but I want to allow some html outside and cannot encode everything.. That is why I'm filtering it with HTMLPurifier.
Your advice would be appreciated.
Try %Core.AggressivelyFixLt or using %Core.LexerImpl set to DirectLex. I don't know offhand if this will work, it may not.
A partial solution is to set %Core.EscapeInvalidTags; but it's a pretty imperfect fix, and it may mangle some text.

Resources