Questions tagged [htmlpurifier]

HTML filtering library for PHP

htmlpurifier
Filter by
Sorted by
Tagged with
1 vote
1 answer
138 views

htmlpurifier nofollow only working for generated links

I'm using the HTML purifier library for my website's comment formatting. However, I noticed something. In my settings, I have HTML.nofollow set to true. 'HTML.Nofollow' => true, But when I write ...
Felix's user avatar
  • 2,641
2 votes
1 answer
209 views

Filter URL of img tags with HTMLpurifier

I'm using htmlPurifier to filter user generated html. I want to filter all image URLs using a specific rule set while allowing more general hyperlinks. How can I set up an URL filter that is only ...
kaymes's user avatar
  • 175
1 vote
1 answer
807 views

HtmlPurifier - keeps removing my tables - what is the right config?

I have a table that keeps beeing removed by html purifier the content is an email that needs to be populated <table> <thead> <th>fieldA</th> <th>fieldB</th>...
user7082181's user avatar
1 vote
1 answer
1k views

html purifier specific version in a composer

I want to put html purifier into the composer with a specific version 4.11.0 I have tried all methods in the link below (except the last one) How to install a specific version of package using ...
K evin's user avatar
  • 31
1 vote
1 answer
119 views

Making internal redirect on submitted links with HTMLPurifier (Munge.php)

I'm trying to setup internal redirect with the help of HTMLPurifier library. Most of documentation is pretty straight forward and the class for this purpose URI.Munge already exists, but there is no ...
Alepri's user avatar
  • 35
1 vote
1 answer
819 views

HTMLPurifier Adding <p> around images

Hello for some reason HTMLPurifier (v4.10) is adding a Paragraph Tag around img tags and removing the style attribute on them. This is my config. $config->set("AutoFormat.AutoParagraph", ...
Pyromanci's user avatar
  • 537
0 votes
1 answer
272 views

HTMLPurifier strips select tags

I am using HTMLPurifier to prevent xss. The html contains all sort of tags for example SELECT, OPTION. But HTMLPurifier removes SELECT, OPTION tags and keeps plain text. How can I allow SELECT, OPTION ...
Sanky's user avatar
  • 397
2 votes
1 answer
520 views

HTMLPurifier label tag support

I can't make <label> tag recognizable by HTMLPurifier. Running $config = HTMLPurifier_Config::createDefault(); $config->set('HTML.Allowed', 'label'); $purifier = new HTMLPurifier($config); ...
vl.lapikov's user avatar
0 votes
1 answer
469 views

I cannot add custom tag to HTML Purifier

According to http://htmlpurifier.org/docs/enduser-customize.html I tried to add custom tag to htmlpurifier. But it works only for known tags like <form> or <name> require_once __DIR__ ...
Eugene's user avatar
  • 27
1 vote
1 answer
132 views

Quotes change after using HTMLPurifier and CKEditor

I am susing a script which uses CKEditor and HtmlPurifier. It changes <p dir="rtl"> to <p dir="&quot;rtl&quot;"> after save. How to prevent this? Actually, i don't know if it is a ...
Amir's user avatar
  • 4,101
-4 votes
2 answers
54 views

How can I make all html tags close in the same line with php [closed]

For example, if I have <b>Line 1 Line 2</b> I want to make it become <b>Line 1</b> <b>Line 2</b> thanks.
user2335065's user avatar
  • 2,437
1 vote
1 answer
882 views

How to add elements figureand figcaption in htmlpurifier?

When i add image with params i have had ERROR ErrorException: Element 'figcaption' is not supported (for information on implementing this, see the support forums) my code 'HTML....
Ksym's user avatar
  • 101
0 votes
0 answers
435 views

HTML Purifier - how keep css "margin-left: calc(25%)"

I'm using HTML purifier in a wysiwyg editor and inline css rule like "margin-left: calc(25%);" is being removed. If the rule is "margin-left: 25%;" it is not removed, however this rule is set ...
Johny's user avatar
  • 531
1 vote
1 answer
436 views

Return an error if HTMLPurifier could not parse a string?

I can't seem to figure out the most basic part of a PHP library. How do you check if it returned an error or not? I'm using a library called HTMLPurifier to sanitize user html input for the database, ...
ArabianMaiden's user avatar
2 votes
0 answers
280 views

How to add HTML 5 tags like (video & source) with mews/Purifier?

Im using mews/purifier Added video[style|controls|width|height],source[src] on HTML.Allowed in the config/Purifier but still it removes the video and source tag everytime I use clean() method. ...
EE-SHI-RO's user avatar
1 vote
2 answers
2k views

HTML Purifier - iframe and scripts

I'm using HTML Purifier in my project. My html is something like this. (containing simple html element + script + iframe) <p>content...<p> <iframe></iframe> <script>...
Priefy's user avatar
  • 25
0 votes
1 answer
814 views

HTML Purifier and spl_autoload_register

Folders of my Page system/ <-- offline files (classes, cronjobs, libraries ...) online/ <-- contain all php scripts ( available online ) system/ classes <-- all my own classes inside. ... ...
user6834389's user avatar
0 votes
0 answers
306 views

HTML Purifier for webmail

I'm working on small webmail client. For safely embedding html I want to use HTML Purifier (BTW: it's a good idea?). I checked it with several emails and some problems. One email (from Google) is ...
ekstro's user avatar
  • 481
0 votes
2 answers
189 views

HTML Purifier and preg_match/$_GET/$_POST/FILTER_VALIDATE_EMAIL - is needed?

I want to ask if i need to use html purifier to avoid XSS atacks if: already used preg_ match for example: $userid = $_POST["userid"]; if(!preg_match("/^[a-zA-Z0-9]{3,15}$/", $userid)){ ...
Daniel's user avatar
  • 21
3 votes
3 answers
11k views

Best practice for storing HTML in mysql DB

I'm working on a mini blog which allows users to add a post using a WYSIWYG editor to the site therefore I will be storing this post in my DB . Having researched markdown I have come to the ...
HP.'s user avatar
  • 63
0 votes
1 answer
505 views

HTMLpurifier is stripping out tables. Anyone know why?

I have just downloaded HTML purifier in order to clean my wysigyg editor inputs but it seems to be stripping out tables. If I input this text: <font face="Times New Roman" size="3"> </...
Dan's user avatar
  • 1,214
3 votes
0 answers
606 views

HTMLPurifier - Editing target tags

I want to add all A elements target="_blank" attribute or change value to "_blank" if different. Is this possible with HTMLPurifier? I couldn't find any information or documentation about this on the ...
hllktlhndd's user avatar
2 votes
1 answer
357 views

HTMLPurifier - Change attribute value instead of remove

htmlpurifier removes attributes if value is not allowed. For example; <div contenteditable="true"></div> I set the permissions for div tags for contenteditable attribute, so the value ...
hllktlhndd's user avatar
0 votes
0 answers
438 views

htmlpurifier producing error 'Fatal error: Class 'HTMLPurifier_AttrTransform_BdoDir' not found' but my paths are correct

I must be missing something or I had way to much coffee because I cannot figure out for the life of me why this is not working. $dirty_html = "<p>test</p>"; require_once 'this/is/my/path/...
Cesar Bielich's user avatar
0 votes
1 answer
263 views

HtmlPurifier - disable special chars replacement

I have been looking in the doc(config part) and in google, I cant find how to do this: I make a simple wysiwig where users can paste html in a text area I thought HtmlPurifier would sanitize it, but ...
phil123456's user avatar
0 votes
0 answers
277 views

How do I validate HTML and make sure it does not contain any Javascript using PHP?

Does anyone know How do I validate (not sanitize) my HTML and make sure it does not contain any Javascript using PHP? If it does contain Javascript, I will just redirect to an error page. I have ...
richie's user avatar
  • 791
0 votes
1 answer
78 views

Problem with output from the database yii2

I have in the database the path to the files that i want to get outputed. like: <audio src="/yii2-biblioteca/frontend/web/uploads/audio/lya1.mp3" controls type="audio/mpeg"> and i am using:...
ChiroV's user avatar
  • 43
3 votes
1 answer
2k views

PHP Cut String On Character Limit

I'm creating a Blog that uses a Faker Factory to generate Demo Data. I have a Post Model which is generated that has a body field which contains randomly generated HTML as well as a text field which ...
Sir Catzilla's user avatar
0 votes
1 answer
22 views

HTMLpurifier how to that instead of deleting any tags (e.g. script) it handles them with the htmlspecialchars function?

HTMLpurifier how to that instead of deleting any tags (e.g. script) it handles them with the htmlspecialchars function? I want that instead of removing the tag, he made him incompetent.
user153742's user avatar
0 votes
2 answers
1k views

Laravel HTMLPurifier filtering base64 encoded images

I am using Laravel HTMLPurifer to filter content inputted by a ckeditor form. However the default configuration is filtering images that have the image content as a base64 encoded src. I've looked ...
Amit Chandrashekar Singh's user avatar
0 votes
0 answers
1k views

Prestashop 1.7: Fatal error Failed opening required HTMLPurifier.standalone.php

My client's website was working normally until This warning and errors appeared and the website has become inaccessible: Warning: require_once(/homepages/19/d729760136/htdocs/clickandbuilds/...
Bearded Ramy's user avatar
0 votes
0 answers
49 views

Adding b64 images support to the default whitelist of HTML Purifier

How can i add b64 images support to the default whitelist ? adding b64 images support like this: $config->set('URI.AllowedSchemes', array('data' => true)); works, but it also resets the ...
Sandersad's user avatar
0 votes
1 answer
333 views

Script, output from HTMLpurifier as plain text

i try in short the HTMLpurifier library, after many input strings test i stack here, and i am wondering why this happened. Specifically, i have that function function filterxss($var){ $config = ...
Jordan Georgiadis's user avatar
1 vote
2 answers
593 views

HTML purifier - allowing inline css style background-image: url()

how do i enable background-image css inline style? I've set these config, but still doesn't work; $config->set('Core.Encoding', 'UTF-8'); $config->set('HTML.Doctype', 'HTML 4.01 Transitional');...
Frumentius's user avatar
0 votes
1 answer
127 views

HTML Purifier new line after shift+enter (As Intagram)

Sorry I'm not sure how to say this (I don't remember the exact term for that). But if the user writes for example: Hi My Name is Phil The result should be (as it is in Instagram) Hi My Name is ...
Philipp Mochine's user avatar
1 vote
1 answer
949 views

HTML Purifier: disable syntax repair

Consider the following setup of HTML Purifier: require_once 'library/HTMLPurifier.auto.php'; $config = HTMLPurifier_Config::createDefault(); $config->set('Core.EscapeInvalidTags', true); $...
Mark Messa's user avatar
0 votes
1 answer
86 views

equivalent of filter_var($some_variable, FILTER_SANITIZE_SPECIAL_CHARS)

I filter my variable like so filter_var($some_variable, FILTER_SANITIZE_SPECIAL_CHARS) Using HTMLPurifier, how do I filter the variable? tried, $htmlpurifier->purify($some_varable); But ...
Mecom's user avatar
  • 401
1 vote
1 answer
191 views

Result from PHP markdown parser is string, not valid html

Goal I am trying to display links that a user has entered as either markdown or html into a description. The description is saved in a database, and then when its read, I'm trying to parse it to ...
Ed Prince's user avatar
  • 714
1 vote
2 answers
3k views

XSS vulnerabilities still exist even after using HTML Purifier

I'm testing one of my web application using Acunetix. To protect this project against XSS attacks, I used HTML Purifier. This library is recommended by most of PHP developers for this purpose, but my ...
Mohammad Saberi's user avatar
2 votes
1 answer
2k views

How to remove alt attribute of img tag in HTML Purifier?

By default, HTML Purifier adds an alt attribute to each img tag (really annoying behavior). So <img src="123.jpg" /> becomes <img src="123.jpg" alt="123.jpg" /> Documentation mentiones ...
user2513149's user avatar
2 votes
1 answer
752 views

Allow 'auto' value for width/height attributes of image tags in HTMLPurifier

Currently my htmlpurifier doesn't allow 'auto' value for the height and width attributes on image tags , but only numeric values . $config = HTMLPurifier_Config::createDefault(); $config->set('...
LeSpotted44's user avatar
0 votes
1 answer
625 views

How to properly escape HTML editor content corretly?

So I am using TinyMCE editor and have handled getting the content in the text area by using htmlspecialchars() which works fine, but I'm a little confused on the other side of using an WYSIWYG editor.....
Erdss4's user avatar
  • 1,085
2 votes
0 answers
138 views

Using htmlpurifier with annotations in symfony 2.8

I would like to use the htmlpurifier not as a form data transformer, but rather as an annotation in the entities property. The problem: In the Symfony 2.8 project we use a lot of different types of ...
tecjam's user avatar
  • 153
0 votes
1 answer
272 views

Undefined variable: purify and method name must be a string while using HTML purifier [closed]

Line with error: $msg = $purifier->$purify($result['Message']); Error: Notice: Undefined variable: purify in /storage/ssd5/777/1537777/public_html/inc/ticketBody.php on line 41 and Fatal error:...
Crackengous's user avatar
1 vote
1 answer
1k views

HTMLPurifier Library removes all custom tags

I am using 4.0.0 version of htmlpurifier library and all my request are getting purified by the library. Some times we need to allow some arbitrary custom tags and xml tags that are not part of ...
vikas's user avatar
  • 61
2 votes
1 answer
902 views

htmlspecialchars() vs htmlpurifier library

What are the differences between the built-in php method htmlspecialchars() and htmlpurifier library?
Raja's user avatar
  • 197
0 votes
1 answer
63 views

HTMLPurifier gives error in links on live server, working properly on localhost

This is my code, require_once 'libraries/htmlpurifier/HTMLPurifier.auto.php'; $config = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($config); $lDesc = $_POST['long-desc']; $...
Bassem Shahin's user avatar
0 votes
2 answers
359 views

Symfony FosUserBundle and HTMLPurifierBundle

On my personal Symfony3.2 project I want to use HtmlPurifier into my UserProfile Form in order to to prvent XSS Attacks. Therefore as described in: https://github.com/Exercise/HTMLPurifierBundle I ...
Dimitrios Desyllas's user avatar
1 vote
1 answer
521 views

PHP HTMLPurifier Not Removing Empty Table (but does on 'Live Demo'..)

Working with HTMLPurifier on my localhost with an html string. Here's my code: require_once '/htmlpurifier-4.9.2/library/HTMLPurifier.auto.php'; $html = '<table class="product-description-table"&...
bbruman's user avatar
  • 667
0 votes
1 answer
412 views

Remove attribute rel follow from Tag a and replace value nofollow

I would like to remove attribute rel following a tag a and replace the value with nofollow using PHP or Yii2, Regex, or HtmlPurifier. I use Yii2. Content: <a href="http://www.hgjhg.com" rel="...
user3770797's user avatar

1
2
3 4 5
9