Welcome! » Log In » Create A New Profile

Spin Link not allowed

Posted by Marck 
Spin Link not allowed
May 12, 2012 07:34AM

Hi!

I am using links such as

<a href='{http://www.url.com|http://www.url2.com}'>anchor</a>

and the result with HtmlPurifier is:

<a>anchor</a>

How can I fix it?

Re: Spin Link not allowed
May 12, 2012 11:55AM

Don't do that? What are you really trying to do?

Re: Spin Link not allowed
May 12, 2012 04:10PM

It is called article spinning and I have a script that needs to use that syntax on the href.

Why the result is anchor and Can I fix this problem?

Thanks.

Re: Spin Link not allowed
May 12, 2012 05:04PM

Because you haven't told me what article spinning is and the syntax you've come up with is nonsense and unsupported by any major browser. Do you mean there's a script that takes links of this form and transforms them to something else? Can you run that before HTML Purifier?

Re: Spin Link not allowed
May 12, 2012 05:13PM

The text will be saved on a database and then processed with a PHP Script. So I need to save the "Spin Version" on a database. It's possible to fix this problem or it's not possible?

Thanks.

Re: Spin Link not allowed
May 12, 2012 05:37PM

Not easily, you'll have to modify some code...

Re: Spin Link not allowed
May 12, 2012 05:38PM

Where I can start to search? What file should I edit?

Re: Spin Link not allowed
May 13, 2012 12:54PM

You'll need to change the behavior of the 'href' AttrDef for the 'a' tag.

http://htmlpurifier.org/docs/enduser-customize.html

You'll need to define a new AttrDef which supports spin link syntax. Then there are a bunch of ways you can add it in but probably $config->getHTMLDefinition()->info['a']->attr['href'] = your_new_class is easiest.

Re: Spin Link not allowed
May 13, 2012 05:43PM

Can I simple disable every check on anchortext?

Re: Spin Link not allowed
May 13, 2012 05:46PM

You do not want to do that. It will make you vulnerable.

Re: Spin Link not allowed
May 13, 2012 05:47PM

It's not a problem because the custom CMS is only for few people (3-4) and it's for an internal use

Re: Spin Link not allowed
May 13, 2012 05:53PM

Why do you need HTML Purifier then?

Re: Spin Link not allowed
May 13, 2012 05:55PM

To clean the dirty code pasted from word

Re: Spin Link not allowed
May 13, 2012 05:57PM

Sure. You can probably disable the check on anchors by using HTMLPurifier_AttrDef_CDATA or something

Re: Spin Link not allowed
May 13, 2012 06:00PM

Can you show me an example? I just read the link but I don't understand what to do :S

Re: Spin Link not allowed
May 14, 2012 09:53AM

Can you tell me what file should I edit?

Re: Spin Link not allowed
May 17, 2012 06:28PM

Marck, unfortunately, I can't go into much more detail without actually writing the thing out, and unfortunately, it's so specific to your use case that I'm not willing to spend that time. If you want, you can hire me to do this customization, but otherwise you need to read some code.

Author:
Your Email:

Subject:

HTML input is enabled. Make sure you escape all HTML and angled brackets with &lt; and &gt;.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

<pre><![CDATA[
Place code here
]]></pre>

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}

Message: